🚀 Polka-1.1B-Chat
eryk-mazus/polka-1.1b-chat
is the first Polish model trained to act as a helpful, conversational assistant that can be run locally. It offers a practical solution for local, efficient Polish text interactions, leveraging advanced training techniques and a custom tokenizer.

✨ Features
- Base Model: The model is based on TinyLlama-1.1B. It uses a custom, extended tokenizer for more efficient Polish text generation and was additionally pretrained on 5.7 billion tokens.
- Fine - Tuning: It was fine - tuned on around 60k synthetically generated and machine - translated multi - turn conversations with Direct Preference Optimization (DPO).
- Context Size: It supports a context size of 4,096 tokens.
- Related Releases:
📦 Installation
No specific installation steps are provided in the original document.
💻 Usage Examples
Basic Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
model_name = "eryk-mazus/polka-1.1b-chat"
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16,
device_map="auto"
)
streamer = TextStreamer(tokenizer, skip_prompt=True)
system_prompt = "Jesteś pomocnym asystentem."
chat = [{"role": "system", "content": system_prompt}]
user_input = "Napisz krótką piosenkę o programowaniu."
chat.append({"role": "user", "content": user_input})
inputs = tokenizer.apply_chat_template(chat, add_generation_prompt=True, return_tensors="pt")
first_param_device = next(model.parameters()).device
inputs = inputs.to(first_param_device)
with torch.no_grad():
outputs = model.generate(
inputs,
pad_token_id=tokenizer.eos_token_id,
max_new_tokens=512,
temperature=0.2,
repetition_penalty=1.15,
top_p=0.95,
do_sample=True,
streamer=streamer,
)
new_tokens = outputs[0, inputs.size(1):]
response = tokenizer.decode(new_tokens, skip_special_tokens=True)
chat.append({"role": "assistant", "content": response})
Advanced Usage
The model works seamlessly with vLLM as well. You can use vLLM to further optimize the inference performance of the model.
📚 Documentation
Prompt format
This model uses ChatML as the prompt format:
<|im_start|>system
Jesteś pomocnym asystentem.
<|im_start|>user
Jakie jest dzienne zapotrzebowanie kaloryczne dorosłej osoby?<|im_end|>
<|im_start|>assistant
Dla dorosłych osób zaleca się spożywanie około 2000 - 3000 kcal dziennie, aby utrzymać optymalne zdrowie i dobre samopoczucie.<|im_end|>
This prompt is available as a chat template, which means you can format messages using the tokenizer.apply_chat_template()
method, as demonstrated in the example above.
📄 License
This project is licensed under the MIT license.