Downloads · 30 days
28
1% of all-time downloads
chloeli/llama-3.1-8b-baseline
llama-3.1-8b-baseline is a machine learning model from chloeli. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
A LoRA adapter for meta-llama/Llama-3.1-8B. This is the baseline: instruction-tuning fine-tuning only, with no model-spec midtraining (MSM) and no alignment fine-tuning (AFT). It is the comparison point against which…
Downloads · 30 days
28
1% of all-time downloads
All-time downloads
4.3K
Public
Repo size
688 MB
Likes
0
Public
Click a slice to open those files.
.safetensors671 MB · 97%
From the Hugging Face model README
A LoRA adapter for meta-llama/Llama-3.1-8B. This is the baseline: instruction-tuning fine-tuning only, with no model-spec midtraining (MSM) and no alignment fine-tuning (AFT). It is the comparison point against which the MSM, AFT, and MSM+AFT models in this collection are measured.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.1-8B",
torch_dtype="auto",
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "chloeli/llama-3.1-8b-baseline")
tokenizer = AutoTokenizer.from_pretrained("chloeli/llama-3.1-8b-baseline")
messages = [{"role": "user", "content": "What matters most when making a difficult decision?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.1-8B",
torch_dtype="auto",
device_map="cpu",
)
model = PeftModel.from_pretrained(base_model, "chloeli/llama-3.1-8b-baseline")
merged_model = model.merge_and_unload()
merged_model.save_pretrained("llama-3.1-8b-baseline-merged")
tokenizer = AutoTokenizer.from_pretrained("chloeli/llama-3.1-8b-baseline")
tokenizer.save_pretrained("llama-3.1-8b-baseline-merged")
from vllm import LLM, SamplingParams
from vllm.lora.request import LoRARequest
llm = LLM(
model="meta-llama/Llama-3.1-8B",
enable_lora=True,
max_lora_rank=128,
)
lora_request = LoRARequest("baseline", 1, "chloeli/llama-3.1-8b-baseline")
output = llm.generate("What matters most?", SamplingParams(max_tokens=512), lora_request=lora_request)