Downloads · 30 days
10
10% of all-time downloads
skhamzah123/LFM2-700M-DPO-FT
LFM2-700M-DPO-FT is a text generation model from skhamzah123. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
LFM2-700M-DPO-FT is a fine-tuned version of LiquidAI/LFM2-700M, trained using Direct Preference Optimization (DPO) to improve instruction-following, response quality, and alignment with human preferences. The model le…
Downloads · 30 days
10
10% of all-time downloads
All-time downloads
97
Public
Parameters
742M
1.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.5 GB · 100%
From the Hugging Face model README
LFM2-700M-DPO-FT is a fine-tuned version of LiquidAI/LFM2-700M, trained using Direct Preference Optimization (DPO) to improve instruction-following, response quality, and alignment with human preferences.
The model learns to favor preferred responses over rejected ones directly, without relying on a separate reward model.
This model is suitable for:
⚠️ Not recommended for high-risk domains such as medical, legal, or financial decision-making.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "skhamzah123/LFM2-700M-DPO-FT"
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype="bfloat16",
# attn_implementation="flash_attention_2" # Uncomment on compatible GPUs
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
prompt = "What is LLMs in simple words?"
input_ids = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
add_generation_prompt=True,
return_tensors="pt",
tokenize=True,
).to(model.device)
output = model.generate(
input_ids,
do_sample=True,
temperature=0.3,
min_p=0.15,
repetition_penalty=1.05,
max_new_tokens=512,
)
print(tokenizer.decode(output[0], skip_special_tokens=False))