Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| Gemma_QA_ITA_v3.Q2_K.gguf | Q2_K | 1.08GB |
| Gemma_QA_ITA_v3.Q3_K_S.gguf | Q3_K_S | 1.2GB |
| Gemma_QA_ITA_v3.Q3_K.gguf | Q3_K | 1.29GB |
| Gemma_QA_ITA_v3.Q3_K_M.gguf | Q3_K_M | 1.29GB |
| Gemma_QA_ITA_v3.Q3_K_L.gguf | Q3_K_L | 1.36GB |
| Gemma_QA_ITA_v3.IQ4_XS.gguf | IQ4_XS | 1.4GB |
| Gemma_QA_ITA_v3.Q4_0.gguf | Q4_0 | 1.44GB |
| Gemma_QA_ITA_v3.IQ4_NL.gguf | IQ4_NL | 1.45GB |
| Gemma_QA_ITA_v3.Q4_K_S.gguf | Q4_K_S | 1.45GB |
| Gemma_QA_ITA_v3.Q4_K.gguf | Q4_K | 1.52GB |
| Gemma_QA_ITA_v3.Q4_K_M.gguf | Q4_K_M | 1.52GB |
| Gemma_QA_ITA_v3.Q4_1.gguf | Q4_1 | 1.56GB |
| Gemma_QA_ITA_v3.Q5_0.gguf | Q5_0 | 1.68GB |
| Gemma_QA_ITA_v3.Q5_K_S.gguf | Q5_K_S | 1.68GB |
| Gemma_QA_ITA_v3.Q5_K.gguf | Q5_K | 1.71GB |
| Gemma_QA_ITA_v3.Q5_K_M.gguf | Q5_K_M | 1.71GB |
| Gemma_QA_ITA_v3.Q5_1.gguf | Q5_1 | 1.79GB |
| Gemma_QA_ITA_v3.Q6_K.gguf | Q6_K | 1.92GB |
| Gemma_QA_ITA_v3.Q8_0.gguf | Q8_0 | 2.49GB |
1import transformers
2from transformers import TextStreamer, AutoTokenizer
3import torch
4
5model_name = "DeepMount00/Gemma_QA_ITA_v3"
6
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = transformers.GemmaForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto").eval()
9
10
11def stream(contesto, domanda):
12 device = "cuda:0"
13 prefix_text = 'Di seguito ti verrà fornito un contesto e poi una domanda. Il tuo compito è quello di rispondere alla domanda basandoti esclusivamente sul contesto.\n\n'
14
15 prompt = f"""{prefix_text}##CONTESTO: {contesto}\n##DOMANDA: {domanda}"""
16
17 inputs = tokenizer([prompt], return_tensors="pt").to(device)
18 streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
19
20 _ = model.generate(**inputs, streamer=streamer, max_new_tokens=150, temperature=0.01,
21 repetition_penalty=1.0, eos_token_id=107, do_sample=True, num_return_sequences=1)
22
23
24contesto = """Seneca seguì molto intensamente gli insegnamenti dei maestri, che esercitarono su di lui un profondo influsso sia con la parola sia con l'esempio di una vita vissuta in coerenza con gli ideali professati. Da Attalo imparò i principi dello stoicismo e l'abitudine alle pratiche ascetiche. Da Sozione, oltre ad apprendere i principi delle dottrine di Pitagora, fu avviato per qualche tempo verso la pratica vegetariana; venne distolto però dal padre che non amava la filosofia e dal fatto che l'imperatore Tiberio proibisse di seguire consuetudini di vita non romane."""
25domanda = "Chi è Seneca?"
26
27stream(contesto, domanda)