Image-Text-to-Text
Transformers
Ukrainian
gemma3
gemma-3-tokenizer
ukraine
corpus-linguistics
conversational
Instructions to use lapa-llm/tokenizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lapa-llm/tokenizer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lapa-llm/tokenizer") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("lapa-llm/tokenizer") model = AutoModelForMultimodalLM.from_pretrained("lapa-llm/tokenizer", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lapa-llm/tokenizer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lapa-llm/tokenizer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lapa-llm/tokenizer", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/lapa-llm/tokenizer
- SGLang
How to use lapa-llm/tokenizer 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 "lapa-llm/tokenizer" \ --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": "lapa-llm/tokenizer", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "lapa-llm/tokenizer" \ --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": "lapa-llm/tokenizer", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use lapa-llm/tokenizer with Docker Model Runner:
docker model run hf.co/lapa-llm/tokenizer
File size: 2,627 Bytes
0abf5ea 2702d91 39d3b45 0abf5ea 45fc51f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ---
inference: false
library_name: transformers
base_model: google/gemma-3-12b-it
language:
- uk
datasets:
- Goader/kobza
- QIRIM/crh_monocorpus
multilinguality:
- multililingual
tags:
- gemma-3-tokenizer
- ukraine
- corpus-linguistics
pretty_name: “gemma-3 - ukrainized gemma tokenizer”
---
### Using the same approach as [Tereshchenko Blue](https://huggingface.co/transhumanist-already-exists/tereshchenkoblue-tokenizer), now trained on the full [Kobza corpus](https://huggingface.co/datasets/Goader/kobza).
By adding more than 80K Ukrainian tokens **without removing any English or EU languages tokens**, Lapa Tokenizer makes Ukrainian the core language in the multilingual Gemma-3 tokenizer while keeping the vocabulary fixed at its original size of 256K tokens.
### How to possible
More than 16 of the most popular writing systems in the world were analyzed.
Roughly four-fifths of tokens in scripts geographically and culturally distant from Ukraine—for example Bengali, Thai, Chinese, Japanese, and Korean—were pruned.
### Replaced tokens
|Writing system|Tokens removed|Tokens retained|
|-|-|-|
|Han (Chinese)|16,488|4,122|
|Devanagari (Hindi)|10,976|2,743|
|Bengali|7,983|1,995|
|Arabic|6,730|1,682|
|Hiragana / Katakana (Japanese)|3,944|985|
|Hangul (Korean)|3,744|935|
|Tamil|3,080|770|
|Thai|1,740|435|
|Malayalam|1,566|391|
|Telugu|1,428|356|
|Gujarati|1,080|270|
|Kannada|1,016|253|
|Ethiopic|691|172|
|Hebrew|670|167|
|Khmer|481|119|
|Sinhala|435|108|
|Myanmar|410|102|
|Lao|243|60|
|Gurmukhi|215|53|
|Tibetan|107|26|
|Oriya|100|25|
|Cyrillic|13,398|0|
|Gemma-3 \<unused-*\>|6,139|102|
## Feature Overview:
1. +81,492 new Cyrillic BPE tokens trained on the full [Kobza corpus](https://huggingface.co/datasets/Goader/kobza) plus the Cyrillic slice of the [Crimean Tatar corpus](https://huggingface.co/datasets/QIRIM/crh_monocorpus).
2. Just tokens from `Replaced tokens` table was replaced, no any tokens from other Writing system was affected.
3. Unchanged tokens preserve their IDs, enabling direct reuse of Gemma-3 embeddings.
4. Vocab size, Special-token set, pre/post-tokenisation logic, and output formatting match Gemma-3 one-for-one.
5. Reasoning tokens <think></think>
## Simple example
```python
tokenizer = AutoTokenizer.from_pretrained("lapa-llm/tokenizer")
toks = tokenizer("Всі красиві зберігають оптимізм", add_special_tokens=False)
print(len(toks.input_ids)) -only 4 tokens 💪🏻
```
### "fixed" - means that we remove condition that allow to add empty `<think></think>` for hybrid approach. This significantly speeds up tokenization. |