Views
No views yet

polka-1.1b takes the TinyLlama-1.1B model and enhances it by continuing pretraining on an additional 5.7 billion Polish tokens, primarily sourced from the MADLAD-400 dataset. The tokens were sampled in a 10:1 ratio between Polish and English shards using DSIR. Furthermore, Polka extends the TinyLlama tokenizer's vocabulary to 43,882 tokens, improving its efficiency for generating Polish text.| Model | Perplexity |
|---|---|
| English models | |
| meta-llama/Llama-2-7b-hf | 24.3 |
| meta-llama/Llama-2-13b-hf | 21.4 |
| mistralai/Mistral-7B-v0.1 | 21.4 |
| TinyLlama/TinyLlama-1.1B | 40.4 |
| Polish models | |
| sdadas/polish-gpt2-small | 134.4 |
| sdadas/polish-gpt2-medium | 100.8 |
| sdadas/polish-gpt2-large | 93.2 |
| sdadas/polish-gpt2-xl | 94.1 |
| Azurro/APT3-275M-Base | 129.8 |
| Azurro/APT3-500M-Base | 153.1 |
| Azurro/APT3-1B-Base | 106.8 |
| eryk-mazus/polka-1.1b | 18.1 |
| szymonrucinski/Curie-7B-v1 | 13.5 |
| OPI-PG/Qra-1b | 14.7 |
| Model | Context | Perplexity |
|---|---|---|
| English models | ||
| meta-llama/Llama-2-7b-hf | 4096 | 5.9 |
| meta-llama/Llama-2-13b-hf | 4096 | 5.3 |
| mistralai/Mistral-7B-v0.1 | 4096 | 4.9 |
| TinyLlama/TinyLlama-1.1B | 2048 | 9.6 |
| Polish models | ||
| sdadas/polish-gpt2-small | 2048 | 27.3 |
| sdadas/polish-gpt2-medium | 2048 | 20.3 |
| sdadas/polish-gpt2-large | 1536 | 18.0 |
| sdadas/polish-gpt2-xl | 1536 | 16.6 |
| Azurro/APT3-275M-Base | 2048 | 77.0 |
| Azurro/APT3-500M-Base | 2048 | 50.5 |
| Azurro/APT3-1B-Base | 2048 | 19.1 |
| eryk-mazus/polka-1.1b | 2048 | 6.9 |
| szymonrucinski/Curie-7B-v1 | 4096 | 4.8 |
| OPI-PG/Qra-1b | 4096 | 6.1 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_name = "eryk-mazus/polka-1.1b"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
7tokenizer.pad_token = tokenizer.eos_token
8
9model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
10
11prompt = """Przykładowe zapytanie do modelu"""
12
13model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
14with torch.no_grad():
15 generated_ids = model.generate(
16 **model_inputs,
17 max_new_tokens=512,
18 do_sample=True,
19 penalty_alpha=0.6,
20 top_k=5
21 )
22
23output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
24print(output)