Catalog PyPI
Back to packageRELEASE DETAILS

0.5

PyPI

aiforthechurch

Package for training and deploying doctrinally correct LLMs.

Published8 Oct 2023
Direct dependencies6
Transitive dependenciesNot calculated

README

Version 0.5 documentation

AI for the Church

Modern LLMs are rooted in secular value systems that are often misaligned with religious organisations. This PyPI package allows anyone to train and deploying doctrinally correct LLMs based on Llama2. Effectively, we are aligning models to a set of values.

Model fine-tuning

from aiforthechurch import align_llama2
doctrinal_dataset = "/path/to/csv"
align_llama2(doctrinal_dataset)

aiforthechurch is integrated with HuggingFace shuch that the aligned model will be automatically pushed to your HuggingFace repo of choice at the end of the training.

At aiforthechurch.org we provide tools for generating doctrinal datasets, a few examples are available at huggingface.co/AiForTheChurch.

Model inference and deployment

We implemented an inference API in the same format as OpenAI's.

import aiforthechurch
aiforthechurch.Completion.create(denomination="catholic", message="Does Jesus love me?")

There is also an asynchronous streaming API, just set stream=True.

And you can use our code to create your own inference server with the models you train by editing the MODELS dictionary in gloohack/deployment/prod_models.py with a denomination and a path to your model in huggingface. Start the server by running the following command on your machine:

python gloohack/deployment/inference.py

Model training requirements

If you wish to train your models using this repo you will need access to a machine with over 16GB of GPU memory and 30GB RAM. The full model weights for Llama2-7B amount to almost 30GB, but we use parameter-efficient fine-tuning (PEFT) LoRA to save memory and avoid any catastrophic forgetting during the fine-tuning procedure.

References

We leaned heavily on open-source libraries like transformers, peft, and bitsandbytes for this project.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
langdetect
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
langdetectruntime
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
torch >=2.0.1runtime
peft
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
peft >=0.5.0runtime
transformers
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
transformers >=4.34.0runtime
accelerate
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
accelerate ==0.23.0runtime
bitsandbytes
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
bitsandbytes >=0.41.1runtime

Distribution files

2 collected
aiforthechurch-0.5-py3-none-any.whl

bdist_wheel · 2.33 KB · Python py3

Source file
aiforthechurch-0.5.tar.gz

sdist · 2.37 KB · Python source

Source file

Repository

NOT_FOUND
trialan/aiforthechurch

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:44 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:8701bbdf40bb1cde016cdd6eefb75da2270beabef89b59241fbfadd7e264c396

Other collected versions

View all collected versions →