Downloads · 30 days
9
5% of all-time downloads
KlibiYoussef/smart-plate-nutrition-adapter
smart-plate-nutrition-adapter is a text generation model from KlibiYoussef. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This model is a fine-tuned LoRA adapter built on top of the Qwen/Qwen3-4B-Base architecture. It is specifically trained to power the core intelligent assistant of the Smart Plate Nutrition platform.
Downloads · 30 days
9
5% of all-time downloads
All-time downloads
185
Public
Repo size
279 MB
Likes
1
Public
Click a slice to open those files.
.safetensors198 MB · 54%
From the Hugging Face model README
This model is a fine-tuned LoRA adapter built on top of the Qwen/Qwen3-4B-Base architecture. It is specifically trained to power the core intelligent assistant of the Smart Plate Nutrition platform.
The model has been optimized using a custom, strictly filtered bilingual dataset to handle three main responsibilities:
The adapter follows the ChatML prompt structure. Below is an optimized script demonstrating how to programmatically initialize the base model along with this adapter using the platform's official system prompt setup:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Repository Configurations
BASE_MODEL_ID = "Qwen/Qwen3-4B-Base"
ADAPTER_PATH = "KlibiYoussef/smart-plate-nutrition-adapter"
# 1. Load Tokenizer and Base Model with the LoRA Adapter
tokenizer = AutoTokenizer.from_pretrained(ADAPTER_PATH)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL_ID,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, ADAPTER_PATH)
model.eval()
# 2. Construct the Prompt in ChatML format using the official platform prompt
prompt = (
"<|im_start|>system\n"
"You are the 'Smart Plate Nutrition' AI assistant. Your role is to provide ultra-precise, "
"scientific, and personalized nutritional information. You must always be polite, helpful, "
"start with a warm greeting, and end with an encouraging health-focused closing statement."
"<|im_end|>\n"
"<|im_start|>user\n"
"How can I lose fat without losing muscle?\n"
"<|im_end|>\n"
"<|im_start|>assistant\n"
)
# 3. Generate Response
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.3,
do_sample=True,
repetition_penalty=1.1
)
# Decode the Output
generated_tokens = outputs[0][inputs.input_ids.shape[1]:]
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
print(response)