Downloads · 30 days
9
25% of all-time downloads
TomSft15/gemma-3-smart-lamp-assistant-fr
gemma-3-smart-lamp-assistant-fr is a text generation model from TomSft15. 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.
Modèle IA complet pour contrôle de lampes connectées
Downloads · 30 days
9
25% of all-time downloads
All-time downloads
36
Public
Parameters
2.7B
2.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 92%
How the weights are stored.
U82.1B · 78%
From the Hugging Face model README
Modèle IA complet pour contrôle de lampes connectées
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Charger le modèle
model_name = "TomSft15/gemma-3-smart-lamp-assistant-fr"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float32, # Pour CPU/Raspberry Pi
device_map="auto" # Pour GPU
)
# Contrôler la lampe
def control_lamp(instruction):
prompt = f"<bos><start_of_turn>user\n{instruction}<end_of_turn>\n<start_of_turn>model\n"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=32, temperature=0.1)
response = tokenizer.decode(outputs[0], skip_special_tokens=False)
# Extraire la réponse
start_marker = "<start_of_turn>model\n"
end_marker = "<end_of_turn>"
start_idx = response.find(start_marker)
if start_idx != -1:
start_idx += len(start_marker)
end_idx = response.find(end_marker, start_idx)
if end_idx != -1:
return response[start_idx:end_idx].strip()
return response
# Exemples
print(control_lamp("Allume la lampe")) # "J'ai allumé la lampe."
print(control_lamp("Couleur rouge")) # "La lampe est maintenant rouge."
print(control_lamp("Baisse à 50%")) # "La luminosité est à 50%."
✅ Modèle complet - Compatible avec AutoModelForCausalLM