Instructions to use Timegravity/tamil-lm-2b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Timegravity/tamil-lm-2b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Timegravity/tamil-lm-2b-base") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Timegravity/tamil-lm-2b-base") model = AutoModelForMultimodalLM.from_pretrained("Timegravity/tamil-lm-2b-base", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Timegravity/tamil-lm-2b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Timegravity/tamil-lm-2b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Timegravity/tamil-lm-2b-base", "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/Timegravity/tamil-lm-2b-base
- SGLang
How to use Timegravity/tamil-lm-2b-base 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 "Timegravity/tamil-lm-2b-base" \ --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": "Timegravity/tamil-lm-2b-base", "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 "Timegravity/tamil-lm-2b-base" \ --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": "Timegravity/tamil-lm-2b-base", "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 Timegravity/tamil-lm-2b-base with Docker Model Runner:
docker model run hf.co/Timegravity/tamil-lm-2b-base
Upload tools/ui/README.md with huggingface_hub
Browse files- tools/ui/README.md +35 -0
tools/ui/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ui/transliterate.js: Tamil phonetic typing (bundled component)
|
| 2 |
+
|
| 3 |
+
Rule-based roman-to-Tamil transliteration in one dependency-free file (MIT, Timegravity Labs Private Limited, 2026). Runs in the browser (`window.TamilPhonetic.transliterate(text)`) and in node (`require("./transliterate.js")`). No network. Test: `node ui/test_transliterate.js` (50 fixed cases, must print 50/50).
|
| 4 |
+
|
| 5 |
+
## Key conventions (one screen)
|
| 6 |
+
|
| 7 |
+
| type | get | type | get |
|
| 8 |
+
|---|---|---|---|
|
| 9 |
+
| a, aa / A | அ, ஆ | k, g | க |
|
| 10 |
+
| i, ii / I | இ, ஈ | ng | ங்க before a vowel (thangam = தங்கம்), ங் otherwise |
|
| 11 |
+
| u, uu / U | உ, ஊ | ch, c, s | ச (s is always ச; use S for ஸ) |
|
| 12 |
+
| e | எ | S | ஸ |
|
| 13 |
+
| ee | ஈ (as commonly typed: eeram = ஈரம்) | j | ஜ |
|
| 14 |
+
| E | ஏ (mudhaRRE = முதற்றே) | nj | ஞ at word start (njaanam = ஞானம்), ஞ்ச elsewhere (panju = பஞ்சு) |
|
| 15 |
+
| ai | ஐ | t, T, d | ட (paattu = பாட்டு, kadavuL = கடவுள்) |
|
| 16 |
+
| o | ஒ | th, dh | த (thamizh = தமிழ், aadhi = ஆதி) |
|
| 17 |
+
| oo | ஊ (as commonly typed: oor = ஊர்) | N | ண |
|
| 18 |
+
| O | ஓ | n | ந at word start, ன elsewhere; before th/dh becomes ந, before t/d becomes ண, before ch becomes ஞ, before k/g becomes ங |
|
| 19 |
+
| au | ஔ | p, b | ப |
|
| 20 |
+
| q | ஃ (aytham) | m, y, r, l, v / w, h | ம, ய, ர, ல, வ, ஹ |
|
| 21 |
+
| - or . | silent separator (man-am = மனம்; breaks cluster matching only) | R, L, zh | ற, ள, ழ |
|
| 22 |
+
| digits, punctuation | unchanged | sh, ksh, x | ஷ, க்ஷ, க்ஸ |
|
| 23 |
+
| ndr | ன்ற (nandri = நன்றி) | ttr, RR | ற்ற (ottru = ஒற்று, mudhaRRE) |
|
| 24 |
+
|
| 25 |
+
Pulli rule: a consonant with no vowel after it gets ் (kamal = கமல்; doubled consonants kk, tt, ll, nn work the same way: sollu = சொல்லு). Vowels at a word start are full letters (agara = அகர); after a consonant they are signs.
|
| 26 |
+
|
| 27 |
+
Single e / o are short (enna = என்ன, sollu = சொல்லு) except: at the end of a word (po = போ) and before a single v, s or y followed by a vowel (kovai = கோவை, pesu = பேசு). To force the other reading type ee/E or oo/O (koosu for கூசு, kosu gives கோசு).
|
| 28 |
+
|
| 29 |
+
Lexicon (three everyday words whose usual spelling does not follow the rules): vanakkam = வணக்கம், pengal = பெண்கள், madurai = மதுரை. Anything else follows the rules; type explicit capitals for retroflex letters (peNgaL, madhurai).
|
| 30 |
+
|
| 31 |
+
Known limits: English words transliterate letter by letter (thanks = தங்க்ச்); switch to raw mode for English. No dictionary beyond the three words above.
|
| 32 |
+
|
| 33 |
+
## Variants (spelling suggestions)
|
| 34 |
+
|
| 35 |
+
`TamilPhonetic.candidates(word, 8)` lists up to 8 spellings of one roman word, the default first, then alternatives ordered by an edit-cost heuristic (a to ஆ, short to long e/o, ல to ள, ட to த, ர to ற, n variants, then rarer changes such as ஸ/ஷ, ழ, doubling, ஊ/ஈ, or a final consonant without pulli). In the test UI the strip under the preview shows them for the word at the caret: click a chip, press Alt+1..8, or press Tab to cycle. A choice is remembered per roman word (cookie `tamil_word_choices`, at most 200 words) and applied everywhere that word occurs, in the preview and in the sent text; choosing the first chip clears the override. `transliterateWith(text, choices)` applies such a map. Tests: `node ui/test_transliterate.js` prints 60/60 (50 transliterations, 10 variant checks).
|