Instructions to use eryk-mazus/polka-1.1b-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eryk-mazus/polka-1.1b-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eryk-mazus/polka-1.1b-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("eryk-mazus/polka-1.1b-chat") model = AutoModelForCausalLM.from_pretrained("eryk-mazus/polka-1.1b-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use eryk-mazus/polka-1.1b-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eryk-mazus/polka-1.1b-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eryk-mazus/polka-1.1b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eryk-mazus/polka-1.1b-chat
- SGLang
How to use eryk-mazus/polka-1.1b-chat with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "eryk-mazus/polka-1.1b-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eryk-mazus/polka-1.1b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "eryk-mazus/polka-1.1b-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eryk-mazus/polka-1.1b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eryk-mazus/polka-1.1b-chat with Docker Model Runner:
docker model run hf.co/eryk-mazus/polka-1.1b-chat
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.
The model is based on TinyLlama-1.1B with the custom, extended tokenizer for more efficient Polish text generation, that was additionally pretrained on 5.7 billion tokens. It was then fine-tuned on around 60k synthetically generated and machine-translated multi-turn conversations with the Direct Preference Optimization (DPO) performed on top of it.
Context size: 4,096 tokens
In addition, we're releasing:
- polka-1.1b - our base model with an extended tokenizer and additional pre-training on Polish corpus sampled using DSIR
- polka-pretrain-en-pl-v1 - the pre-training dataset
- polka-dpo-v1 - dataset of DPO pairs
- polka-1.1b-chat-gguf - GGUF files for the chat model
Usage
Sample code:
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)
# You are a helpful assistant.
system_prompt = "Jesteś pomocnym asystentem."
chat = [{"role": "system", "content": system_prompt}]
# Compose a short song on programming.
user_input = "Napisz krótką piosenkę o programowaniu."
chat.append({"role": "user", "content": user_input})
# Generate - add_generation_prompt to make sure it continues as assistant
inputs = tokenizer.apply_chat_template(chat, add_generation_prompt=True, return_tensors="pt")
# For multi-GPU, find the device of the first parameter of the model
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,
)
# Add just the new tokens to our chat
new_tokens = outputs[0, inputs.size(1):]
response = tokenizer.decode(new_tokens, skip_special_tokens=True)
chat.append({"role": "assistant", "content": response})
The model works seamlessly with vLLM as well.
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.
- Downloads last month
- 1,462
