🦙 Llama Trainer Utility
A "just few lines of code" utility for fine-tuning (not only) Llama models.
To install:
pip install llama-trainer
Training and Inference
Training
from llama_trainer import LlamaTrainer
from datasets import load_dataset
dataset = load_dataset("timdettmers/openassistant-guanaco")
# define your instruction-based sample
def to_instruction_fn(sample):
return sample["text"]
formatting_func = to_instruction_fn
output_dir = "llama-2-7b-hf-finetune"
llama_trainer = LlamaTrainer(
model_name="meta-llama/Llama-2-7b-hf",
dataset=dataset,
formatting_func=formatting_func,
output_dir=output_dir
)
llama_trainer.train()
Inference
from llama_trainer import LlamaInfer
import transformers as tr
llama_infer = LlamaInfer(output_dir)
prompt = "### Human: Give me some output!### Assistant:"
print(llama_infer(prompt))
Metadata
Release files for llama-trainer 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama-trainer-0.2.1.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_trainer-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / llama-trainer-0.2.1.tar.gz
| Download URL | llama-trainer-0.2.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54ff7bac916315161c75549f11043cbc70a016afaac207d7163a24f7f8f820a8
|
|
BLAKE2b-256 checksum How to use checksums |
2baf3b04b223e875ffbe748d8fbc4c54ab1f16abc5ead1d68c86306286d75507
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / llama_trainer-0.2.1-py3-none-any.whl
| Download URL | llama_trainer-0.2.1-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03caffce8f476cbdea06f280e7a84fc55bc037b3489cce1ff3184a285b64afea
|
|
BLAKE2b-256 checksum How to use checksums |
a13ab5ff93529be225059ad789d74233d973bf2bb631565a19b258c8190a3175
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|