Update README.md
Browse files
README.md
CHANGED
@@ -39,7 +39,7 @@ This model was fine-tuned for instruction following. Instruction-tuned models ar
|
|
39 |
|
40 |
### How to use
|
41 |
|
42 |
-
If you want to use this model for instruction-following, you need to use the same prompt format we used in the fine-tuning process (basically the same format what Meta used in their Llama2 models). **Note: do not use "LlamaTokenizer" from transformers library but always use the AutoTokenizer instead, or use the plain sentencepiece tokenizer.** Here is an example using the instruction-following prompt format, with some generation arguments you can modify for your use:
|
43 |
|
44 |
```python
|
45 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
@@ -47,19 +47,11 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
47 |
system_prompt = "Olet tekoälyavustaja. Vastaat aina mahdollisimman avuliaasti. Vastauksesi eivät saa sisältää mitään haitallista, epäeettistä, rasistista, seksististä, vaarallista tai laitonta sisältöä. Jos kysymyksessä ei ole mitään järkeä tai se ei ole asiasisällöltään johdonmukainen, selitä miksi sen sijaan, että vastaisit jotain väärin. Jos et tiedä vastausta kysymykseen, älä kerro väärää tietoa."
|
48 |
|
49 |
|
50 |
-
def format_prompt(prompt: str) -> str:
|
51 |
-
prompt = f" [INST] <<SYS>>\n{system_prompt.strip()}\n<</SYS>>\n\n{prompt.strip()} [/INST] "
|
52 |
-
return prompt
|
53 |
-
|
54 |
-
|
55 |
tokenizer = AutoTokenizer.from_pretrained("Finnish-NLP/Ahma-3B-Instruct")
|
56 |
model = AutoModelForCausalLM.from_pretrained("Finnish-NLP/Ahma-3B-Instruct")
|
57 |
model = model.to("cuda")
|
58 |
|
59 |
-
# use the
|
60 |
-
|
61 |
-
# prompt = format_prompt("Kerro kolme hyötyä, joita pienet avoimen lähdekoodin kielimallit tuovat?")
|
62 |
-
# inputs = tokenizer(prompt, return_tensors="pt")
|
63 |
|
64 |
messages = [
|
65 |
{
|
@@ -100,6 +92,8 @@ You may experiment with different system prompt instructions too if you like.
|
|
100 |
|
101 |
### Limitations and bias
|
102 |
|
|
|
|
|
103 |
The training data used for this model contains a lot of content from the internet, which is far from neutral. Therefore, the model can have biased predictions. This bias will also affect all fine-tuned versions of this model.
|
104 |
|
105 |
## Training data
|
|
|
39 |
|
40 |
### How to use
|
41 |
|
42 |
+
If you want to use this model for instruction-following, you need to use the same prompt format we used in the fine-tuning process (basically the same format what Meta used in their Llama2 models). **Note: do not use "LlamaTokenizer" from transformers library but always use the AutoTokenizer instead, or use the plain sentencepiece tokenizer.** Here is an example using the instruction-following prompt format with the tokenizer's built-in chat template feature which makes it easy to format your potential multi-turn chats too, with some generation arguments you can modify for your use:
|
43 |
|
44 |
```python
|
45 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
47 |
system_prompt = "Olet tekoälyavustaja. Vastaat aina mahdollisimman avuliaasti. Vastauksesi eivät saa sisältää mitään haitallista, epäeettistä, rasistista, seksististä, vaarallista tai laitonta sisältöä. Jos kysymyksessä ei ole mitään järkeä tai se ei ole asiasisällöltään johdonmukainen, selitä miksi sen sijaan, että vastaisit jotain väärin. Jos et tiedä vastausta kysymykseen, älä kerro väärää tietoa."
|
48 |
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
tokenizer = AutoTokenizer.from_pretrained("Finnish-NLP/Ahma-3B-Instruct")
|
51 |
model = AutoModelForCausalLM.from_pretrained("Finnish-NLP/Ahma-3B-Instruct")
|
52 |
model = model.to("cuda")
|
53 |
|
54 |
+
# use the chat template feature in the tokenizer to format your (multi-turn) inputs
|
|
|
|
|
|
|
55 |
|
56 |
messages = [
|
57 |
{
|
|
|
92 |
|
93 |
### Limitations and bias
|
94 |
|
95 |
+
This model was trained only with Finnish texts excluding code so it should not be used for multilingual and code generation use cases.
|
96 |
+
|
97 |
The training data used for this model contains a lot of content from the internet, which is far from neutral. Therefore, the model can have biased predictions. This bias will also affect all fine-tuned versions of this model.
|
98 |
|
99 |
## Training data
|