Commit
·
addf22e
1
Parent(s):
0610d6b
Update README.md
Browse files
README.md
CHANGED
@@ -33,7 +33,7 @@ If you are interested in more details regarding the training procedure, you can
|
|
33 |
This prompt format based on the [LLaMA 2 prompt template](https://gpus.llm-utils.org/llama-2-prompt-template/) adapted to the italian language was used:
|
34 |
|
35 |
```python
|
36 |
-
"
|
37 |
"Sei un assistente disponibile, rispettoso e onesto. " \
|
38 |
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
|
39 |
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
|
@@ -41,7 +41,7 @@ This prompt format based on the [LLaMA 2 prompt template](https://gpus.llm-utils
|
|
41 |
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
|
42 |
"Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
|
43 |
"<</SYS>>\n\n" \
|
44 |
-
f"{user_msg_1}
|
45 |
```
|
46 |
|
47 |
We recommend using the same prompt in inference to obtain the best results!
|
@@ -60,7 +60,7 @@ model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
60 |
|
61 |
user_msg = "Ciao! Come stai?"
|
62 |
|
63 |
-
prompt = "
|
64 |
"Sei un assistente disponibile, rispettoso e onesto. " \
|
65 |
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
|
66 |
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
|
@@ -68,7 +68,7 @@ prompt = "<s>[INST] <<SYS>>\n" \
|
|
68 |
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
|
69 |
"Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
|
70 |
"<</SYS>>\n\n" \
|
71 |
-
f"{user_msg}
|
72 |
|
73 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
74 |
outputs = model.generate(input_ids=input_ids, max_length=1024)
|
@@ -76,7 +76,7 @@ outputs = model.generate(input_ids=input_ids, max_length=1024)
|
|
76 |
print(tokenizer.batch_decode(outputs.detach().cpu().numpy()[:, input_ids.shape[1]:], skip_special_tokens=True)[0])
|
77 |
```
|
78 |
|
79 |
-
If you are facing issues when loading the model, you can try to load it
|
80 |
|
81 |
```python
|
82 |
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=True)
|
|
|
33 |
This prompt format based on the [LLaMA 2 prompt template](https://gpus.llm-utils.org/llama-2-prompt-template/) adapted to the italian language was used:
|
34 |
|
35 |
```python
|
36 |
+
" [INST]<<SYS>>\n" \
|
37 |
"Sei un assistente disponibile, rispettoso e onesto. " \
|
38 |
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
|
39 |
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
|
|
|
41 |
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
|
42 |
"Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
|
43 |
"<</SYS>>\n\n" \
|
44 |
+
f"{user_msg_1}[/INST] {model_answer_1} </s> <s> [INST]{user_msg_2}[/INST] {model_answer_2} </s> ... <s> [INST]{user_msg_N}[/INST] {model_answer_N} </s>"
|
45 |
```
|
46 |
|
47 |
We recommend using the same prompt in inference to obtain the best results!
|
|
|
60 |
|
61 |
user_msg = "Ciao! Come stai?"
|
62 |
|
63 |
+
prompt = " [INST]<<SYS>>\n" \
|
64 |
"Sei un assistente disponibile, rispettoso e onesto. " \
|
65 |
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
|
66 |
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
|
|
|
68 |
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
|
69 |
"Se non conosci la risposta a una domanda, non condividere informazioni false.\n" \
|
70 |
"<</SYS>>\n\n" \
|
71 |
+
f"{user_msg}[/INST] "
|
72 |
|
73 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
74 |
outputs = model.generate(input_ids=input_ids, max_length=1024)
|
|
|
76 |
print(tokenizer.batch_decode(outputs.detach().cpu().numpy()[:, input_ids.shape[1]:], skip_special_tokens=True)[0])
|
77 |
```
|
78 |
|
79 |
+
If you are facing issues when loading the model, you can try to load it **Quantized**:
|
80 |
|
81 |
```python
|
82 |
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=True)
|