Views
No views yet
1 _ _ ___ ___ _
2| | | | | \/ | | |
3| | | | __ _| . . | __ _ ___ ___| |_ _ __ __ _
4| | | |/ _` | |\/| |/ _` |/ _ \/ __| __| '__/ _` |
5| |___| | (_| | | | | (_| | __/\__ \ |_| | | (_| |
6\_____/_|\__,_\_| |_/\__,_|\___||___/\__|_| \__,_|For EN-IT translation, check out the lightweight Quadrifoglio models as well.

1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4model_id = "LeonardPuettmann/LlaMaestra-3.2-1B-Instruct-v0.1"
5
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 device_map="auto",
9 trust_remote_code=True,
10)
11
12tokenizer = AutoTokenizer.from_pretrained(model_id, add_bos_token=True, trust_remote_code=True)
13
14row_json = [
15 {"role": "system", "content": "Your job is to return translations for sentences or words from either Italian to English or English to Italian."},
16 {"role": "user", "content": "Do you sell tickets for the bus?"},
17]
18
19prompt = tokenizer.apply_chat_template(row_json, tokenize=False)
20model_input = tokenizer(prompt, return_tensors="pt").to("cuda")
21
22with torch.no_grad():
23 print(tokenizer.decode(model.generate(**model_input, max_new_tokens=1024)[0]))meta-llama/Llama-3.2-1B-Instruct
Finetuned by: Leonard Püttmann https://www.linkedin.com/in/leonard-p%C3%BCttmann-4648231a9/