Downloads · 30 days
13
3% of all-time downloads
Finnish-NLP/llama-7b-finnish-instruct-v0.1
llama-7b-finnish-instruct-v0.1 is a text generation model from Finnish-NLP. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- This is an early v0.1 version release of our Instruct finetuned model from https://huggingface.co/Finnish-NLP/llama-7b-finnish - Model was trained for 2 epochs using 11014 samples and for this release we chose check…
Downloads · 30 days
13
3% of all-time downloads
All-time downloads
421
Public
Parameters
7B
14 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14 GB · 100%
From the Hugging Face model README
For finetuning we used mix of the following datasets:
Here is an example of using this model with Unsloth with some generation arguments you can modify:
import torch
from unsloth import FastLlamaModel
max_seq_length = 2048
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
use_unsloth = True
# use_transformers = True
# LOADING MODEL USIINIG TRANSFORMERS assumes at least 16GB of memory. Tested with this configuration
# If you have less memory use load_in_4bit or load_in_8_bit as needed
if use_transformers:
major_version, minor_version = torch.cuda.get_device_capability()
model = AutoModelForCausalLM.from_pretrained("Finnish-NLP/llama-7b-finnish-instruct-v0.1", device_map='cuda:0', torch_dtype = torch.bfloat16 if major_version >=8 else torch.float16)
tokenizer = AutoTokenizer.from_pretrained("Finnish-NLP/llama-7b-finnish-instruct-v0.1")
# USING UNSLOTH, tested with load_in_4bit
if use_unsloth:
model, tokenizer = FastLlamaModel.from_pretrained(
model_name = "Finnish-NLP/llama-7b-finnish-instruct-v0.1"
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit
)
alpaca_prompt = """<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.
<|ihminen|> Kysymys/Tehtävä:
{}
<|avustaja|> Vastauksesi:
"""
sample_questions = ["Ketkä ovat Aku Ankan luona asuvat kolme ankanpoikaa?",\
"Mikä on Suomen korkein tunturi?",\
"Suomi soti Neuvostoliittoa vastaan talvisodan 1939-1940. Kuinka monta päivää sota kesti?",\
"Luettele viisi yleistä Suomessa yleisesti käytettyä pojan nimeä. Nimet:",\
"Luettele lyhyt, maksimissaan 50 sanan mittainen runo Suomesta. Runo:",\
]
from transformers import GenerationConfig
generation_config = GenerationConfig(
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.convert_tokens_to_ids("<|loppu|>"),
)
for sample_question in sample_questions:
model.eval()
inputs = tokenizer(
[
alpaca_prompt.format(
sample_question, # instruction
)
]*1, return_tensors = "pt").to("cuda")
with torch.no_grad():
generated_ids = model.generate(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
generation_config=generation_config, **{
"temperature": 0.1,
"penalty_alpha": 0.6,
"top_k": 3,
"do_sample": True,
"repetition_penalty": 1.28,
"min_length": 10,
"max_new_tokens": 200
})
generated_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True)[0]
print(len(generated_ids[0]))
print("KYSYMYS:")
print(generated_text.split('<|avustaja|>')[0])
print("VASTAUS:")
print(generated_text.split('<|avustaja|> Vastauksesi:')[1])
print('##################################')
'''
-->
79
KYSYMYS:
<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.<|ihminen|> Kysymys/Tehtävä: Aku Ankan luona asuu kolme ankanpoikaa. He ovat nimeltään:
VASTAUS:
Ankkalinnan asukkaat ovat Aku Ankka, hänen vaimonsa Iines ja heidän lapsensa Tupu, Hupu ja Lupu
##################################
65
KYSYMYS:
<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.<|ihminen|> Kysymys/Tehtävä: Mikä on Suomen korkein tunturi?
VASTAUS:
Suomen korkeimmat tunturit ovat Halti (1 324 metriä) ja Saana (1 029 metriä).
##################################
80
KYSYMYS:
<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.<|ihminen|> Kysymys/Tehtävä: Suomi soti Neuvostoliittoa vastaan talvisodan 1939-1940. Kuinka monta päivää sota kesti?
VASTAUS:
Talvisodan aikana Neuvostoliitto hyökkäsi Suomeen 30. marraskuuta ja 13. maaliskuuta välisenä aikana. Tämä oli lyhyt sota, joka kesti 105 päivää.
##################################
87
KYSYMYS:
<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.<|ihminen|> Kysymys/Tehtävä: Luettele viisi yleistä Suomessa yleisesti käytettyä pojan nimeä. Nimet:
VASTAUS:
Suomessa on monia yleisiä poikien nimiä, mutta tässä on muutamia suosittuja: 1. Eemeli 2 Onni 3 Eino 4 Väinö 5 Artturi
##################################
63
KYSYMYS:
<|alku|> Olet tekoälyavustaja. Seuraavaksi saat kysymyksen tai tehtävän. Kirjoita vastaus parhaasi mukaan siten että se täyttää kysymyksen tai tehtävän vaatimukset.<|ihminen|> Kysymys/Tehtävä: Luettele lyhyt, maksimissaan 50 sanan mittainen runo Suomesta. Runo:
VASTAUS:
Suomen talvi on kylmä, kesä on lyhyt, mutta luonto on kaunis.
'''
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. To reduce toxic content, the pretrained version of thiis model was trained with dataset filtered with a toxicity classifier but it cannot truly eliminate all toxic text.
Training was conducted on RTX 4080 using Unsloth framework https://github.com/unslothai/unsloth
Training script is available in this repo.
This model was evaluated using FIN-bench by TurkuNLP with zero-shot setting, but
the evaluation script had some problems running succesfully, so the results reported below should perhaps be viewed with some caution.
llama-7b-finnish-instruct-v0.1:
| Task | Version | Metric | Value | Stderr | |
|---|---|---|---|---|---|
| bigbench_analogies | 0 | multiple_choice_grade | 0.5000 | ± | 0.0440 |
| bigbench_arithmetic_1_digit_addition | 0 | multiple_choice_grade | 0.4800 | ± | 0.0502 |
| bigbench_arithmetic_1_digit_division | 0 | multiple_choice_grade | 0.5652 | ± | 0.1057 |
| bigbench_arithmetic_1_digit_multiplication | 0 | multiple_choice_grade | 0.5000 | ± | 0.0503 |
| bigbench_arithmetic_1_digit_subtraction | 0 | multiple_choice_grade | 0.6700 | ± | 0.0473 |
| bigbench_arithmetic_2_digit_addition | 0 | multiple_choice_grade | 0.4000 | ± | 0.0492 |
| bigbench_arithmetic_2_digit_division | 0 | multiple_choice_grade | 0.5400 | ± | 0.0501 |
| bigbench_arithmetic_2_digit_multiplication | 0 | multiple_choice_grade | 0.2700 | ± | 0.0446 |
| bigbench_arithmetic_2_digit_subtraction | 0 | multiple_choice_grade | 0.4800 | ± | 0.0502 |
| bigbench_arithmetic_3_digit_addition | 0 | multiple_choice_grade | 0.4100 | ± | 0.0494 |
| bigbench_arithmetic_3_digit_division | 0 | multiple_choice_grade | 0.2800 | ± | 0.0451 |
| bigbench_arithmetic_3_digit_multiplication | 0 | multiple_choice_grade | 0.2600 | ± | 0.0441 |
| bigbench_arithmetic_3_digit_subtraction | 0 | multiple_choice_grade | 0.5300 | ± | 0.0502 |
| bigbench_arithmetic_4_digit_addition | 0 | multiple_choice_grade | 0.3400 | ± | 0.0476 |
| bigbench_arithmetic_4_digit_division | 0 | multiple_choice_grade | 0.3300 | ± | 0.0473 |
| bigbench_arithmetic_4_digit_multiplication | 0 | multiple_choice_grade | 0.2100 | ± | 0.0409 |
| bigbench_arithmetic_4_digit_subtraction | 0 | multiple_choice_grade | 0.6000 | ± | 0.0492 |
| bigbench_arithmetic_5_digit_addition | 0 | multiple_choice_grade | 0.5600 | ± | 0.0499 |
| bigbench_arithmetic_5_digit_division | 0 | multiple_choice_grade | 0.2300 | ± | 0.0423 |
| bigbench_arithmetic_5_digit_multiplication | 0 | multiple_choice_grade | 0.2500 | ± | 0.0435 |
| bigbench_arithmetic_5_digit_subtraction | 0 | multiple_choice_grade | 0.5600 | ± | 0.0499 |
| bigbench_cause_and_effect_one_sentence | 0 | multiple_choice_grade | 0.4902 | ± | 0.0707 |
| bigbench_cause_and_effect_one_sentence_no_prompt | 0 | multiple_choice_grade | 0.9020 | ± | 0.0421 |
| bigbench_cause_and_effect_two_sentences | 0 | multiple_choice_grade | 0.3922 | ± | 0.0690 |
| bigbench_emotions | 0 | multiple_choice_grade | 0.2313 | ± | 0.0334 |
| bigbench_empirical_judgments | 0 | multiple_choice_grade | 0.3535 | ± | 0.0483 |
| bigbench_general_knowledge | 0 | multiple_choice_grade | 0.3857 | ± | 0.0586 |
| bigbench_hhh_alignment_harmless | 0 | multiple_choice_grade | 0.3966 | ± | 0.0648 |
| bigbench_hhh_alignment_helpful | 0 | multiple_choice_grade | 0.3220 | ± | 0.0614 |
| bigbench_hhh_alignment_honest | 0 | multiple_choice_grade | 0.3898 | ± | 0.0640 |
| bigbench_hhh_alignment_other | 0 | multiple_choice_grade | 0.5814 | ± | 0.0761 |
| bigbench_intent_recognition | 0 | multiple_choice_grade | 0.2211 | ± | 0.0158 |
| bigbench_misconceptions | 0 | multiple_choice_grade | 0.5149 | ± | 0.0433 |
| bigbench_paraphrase | 0 | multiple_choice_grade | 0.5400 | ± | 0.0353 |
| bigbench_sentence_ambiguity | 0 | multiple_choice_grade | 0.4500 | ± | 0.0648 |
| bigbench_similarities_abstraction | 0 | multiple_choice_grade | 0.5789 | ± | 0.0570 |
Feel free to contact us for more details 🤗