minLlama2 is a simple implementation of Meta's Llama2 model for finetuning, drawing on Hugging Face and Karpathy's minGPT.
You can use it to finetune Llama2 7B on a single A100 without quantization or LoRA. Works great inside a Jupyter notebook.

from model import LlamaModel
from templates import PromptTemplateCollection
model = LlamaModel.from_pretrained("./models/samsum_finetune.pth", use_cache=True)
dialog = (
"A: How's it going?" +
"\r\nB: Great, I got promoted today!" +
"\r\nA: Let's go out and celebrate." +
"\r\nB: Good idea, let's go."
)
model.generate(
[
PromptTemplateCollection['summarize'].format(dialog)
],
max_new_tokens=100,
output_only=True
)
Output: ['B got promoted today. A and B will go out to celebrate.']
For now, consult demo.ipynb to get started. A Python package with proper installation is coming soon.
7 commits
Python
86.0%
Jupyter Notebook
14.0%
minLlama2 is a simple implementation of Meta's Llama2 model for finetuning, drawing on Hugging Face and Karpathy's minGPT.
You can use it to finetune Llama2 7B on a single A100 without quantization or LoRA. Works great inside a Jupyter notebook.

from model import LlamaModel
from templates import PromptTemplateCollection
model = LlamaModel.from_pretrained("./models/samsum_finetune.pth", use_cache=True)
dialog = (
"A: How's it going?" +
"\r\nB: Great, I got promoted today!" +
"\r\nA: Let's go out and celebrate." +
"\r\nB: Good idea, let's go."
)
model.generate(
[
PromptTemplateCollection['summarize'].format(dialog)
],
max_new_tokens=100,
output_only=True
)
Output: ['B got promoted today. A and B will go out to celebrate.']
For now, consult demo.ipynb to get started. A Python package with proper installation is coming soon.
7 commits
Python
86.0%
Jupyter Notebook
14.0%