Downloads · 30 days
161
48% of all-time downloads
nadaashraff/smollm2-360m-alpaca-lora
smollm2-360m-alpaca-lora is a machine learning model from nadaashraff. 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 apache-2.0.
This repository contains a LoRA adapter fine-tuned from the base model HuggingFaceTB/SmolLM2-360M-Instruct on the yahma/alpaca-cleaned instruction dataset. The goal is to create a small, fast model that can answer sim…
Downloads · 30 days
161
48% of all-time downloads
All-time downloads
338
Public
Repo size
17.4 MB
Likes
0
Public
Click a slice to open those files.
.safetensors17.4 MB · 78%
From the Hugging Face model README
This repository contains a LoRA adapter fine-tuned from the base model
HuggingFaceTB/SmolLM2-360M-Instruct on the yahma/alpaca-cleaned
instruction dataset. The goal is to create a small, fast model that can
answer simple questions and follow instructions in a chat-like format
without needing an external context paragraph.
HuggingFaceTB/SmolLM2-360M-InstructThis repository only contains the LoRA adapter weights and tokenizer files, not the full 360M base model. To use the model you must load the base model and then attach this adapter.
This model is not intended for production use or for safety-critical applications.
yahma/alpaca-cleanedinstruction, optional input, output).The dataset contains a wide range of generic instructions such as explanations, rewriting, summarization, and simple reasoning tasks.
Fine-tuning was performed in Google Colab using PEFT LoRA on top of the
frozen base model HuggingFaceTB/SmolLM2-360M-Instruct.
Key hyperparameters:
Trainer)Only the LoRA adapter parameters were updated; the base model weights were kept frozen.
The adapter should be loaded on top of the base SmolLM2-360M-Instruct model. Example usage:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE_MODEL = "HuggingFaceTB/SmolLM2-360M-Instruct"
ADAPTER = "nadaashraff/smollm2-360m-alpaca-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, ADAPTER)
model.eval()
def chat(prompt, max_new_tokens=128):
messages = [{"role": "user", "content": prompt}]
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=max_new_tokens,
do_sample=False,
pad_token_id=tokenizer.eos_token_id,
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
print(chat("Explain overfitting in simple terms."))