Text Generation
Transformers
Safetensors
Tamil
English
qwen3
tanglish
tamil
code-mixed
chennai
conversational
lora
sft
text-generation-inference
Instructions to use sugiv/qwen3-8b-tanglish with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sugiv/qwen3-8b-tanglish with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sugiv/qwen3-8b-tanglish") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sugiv/qwen3-8b-tanglish") model = AutoModelForCausalLM.from_pretrained("sugiv/qwen3-8b-tanglish", device_map="auto") 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 Settings
- vLLM
How to use sugiv/qwen3-8b-tanglish with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sugiv/qwen3-8b-tanglish" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sugiv/qwen3-8b-tanglish", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sugiv/qwen3-8b-tanglish
- SGLang
How to use sugiv/qwen3-8b-tanglish 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 "sugiv/qwen3-8b-tanglish" \ --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": "sugiv/qwen3-8b-tanglish", "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 "sugiv/qwen3-8b-tanglish" \ --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": "sugiv/qwen3-8b-tanglish", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sugiv/qwen3-8b-tanglish with Docker Model Runner:
docker model run hf.co/sugiv/qwen3-8b-tanglish
| # Phase 4: Qwen3-8B LoRA fine-tune config (used by tanglish.llm.qwen_train). | |
| # | |
| # Strategy: full LoRA on bf16 base (NOT QLoRA/4-bit β L40S 48 GB has enough | |
| # VRAM for cleaner training with higher final quality). | |
| # | |
| # Never-lose-model design (per user 2026-07-15): | |
| # 1. All output goes to /workspace/tanglish/checkpoints/qwen_lora_v1/ | |
| # which lives on the NETWORK VOLUME (survives pod eviction). | |
| # 2. A TrainerCallback S3-syncs every checkpoint AS IT'S SAVED | |
| # (not just at end). | |
| # 3. Post-training merge β S3 sync of merged model. | |
| # 4. Auto-terminate has 6 gates (train exited cleanly, no failed marker, | |
| # TRAINING COMPLETE marker, best-val LoRA on disk, merged model on disk, | |
| # S3 has both). | |
| # 5. Even mid-training pod eviction loses at most ~1 val-check-interval | |
| # of progress. | |
| # ----------------------------------------------------------------------------- | |
| # Model | |
| # ----------------------------------------------------------------------------- | |
| model: | |
| base: "Qwen/Qwen3-8B" # Qwen3 series has no "-Instruct" suffix; already instruction-tuned by default | |
| torch_dtype: bfloat16 | |
| attn_implementation: flash_attention_2 # 2-3x faster than sdpa on Qwen3 | |
| gradient_checkpointing: true # ~30 % VRAM save, ~15 % slower | |
| # Do NOT quantize β cleaner LoRA training on bf16 base; VRAM headroom exists. | |
| # ----------------------------------------------------------------------------- | |
| # LoRA adapter | |
| # ----------------------------------------------------------------------------- | |
| lora: | |
| r: 16 | |
| alpha: 32 # 2x r is the standard heuristic | |
| dropout: 0.05 | |
| bias: none | |
| target_modules: | |
| - q_proj | |
| - k_proj | |
| - v_proj | |
| - o_proj | |
| - gate_proj | |
| - up_proj | |
| - down_proj | |
| # ----------------------------------------------------------------------------- | |
| # Data | |
| # ----------------------------------------------------------------------------- | |
| data: | |
| # Downloaded from S3 in setup_qwen_train.sh, decompressed to plain .jsonl | |
| train_file: /workspace/tanglish/data/pairs/tanglish_v1.train.jsonl | |
| val_file: /workspace/tanglish/data/pairs/tanglish_v1.val.jsonl | |
| max_seq_length: 2048 # dialogues are short; leaves plenty of room | |
| packing: false # sample-level SFT (safer for chat format) | |
| # ----------------------------------------------------------------------------- | |
| # Trainer β TRL SFTTrainer args (Hugging Face TrainingArguments compatible) | |
| # ----------------------------------------------------------------------------- | |
| training: | |
| output_dir: /workspace/tanglish/checkpoints/qwen_lora_v1/lora | |
| num_train_epochs: 3 | |
| per_device_train_batch_size: 4 | |
| per_device_eval_batch_size: 8 | |
| gradient_accumulation_steps: 4 # effective batch = 16 | |
| learning_rate: 2.0e-4 # LoRA convention | |
| lr_scheduler_type: cosine | |
| warmup_ratio: 0.05 # 5 % warmup | |
| weight_decay: 0.01 | |
| max_grad_norm: 1.0 | |
| bf16: true | |
| optim: adamw_torch | |
| dataloader_num_workers: 4 | |
| seed: 42 | |
| logging_steps: 20 # wandb + local every 20 steps | |
| eval_strategy: steps | |
| eval_steps: 500 # ~10-15 min on L40S | |
| save_strategy: steps | |
| save_steps: 500 # save with eval so metric aligns | |
| save_total_limit: 3 # top-3 by eval_loss + last kept | |
| metric_for_best_model: eval_loss | |
| greater_is_better: false | |
| load_best_model_at_end: true # so merge picks the actual best | |
| report_to: wandb # step-level curves like Phase 2 | |
| # ----------------------------------------------------------------------------- | |
| # Early stopping β kills training when val loss plateaus | |
| # ----------------------------------------------------------------------------- | |
| early_stopping: | |
| patience: 4 # 4 eval checks with no improvement | |
| threshold: 0.005 # must improve by β₯ this each time | |
| # ----------------------------------------------------------------------------- | |
| # S3 sync callback β hits S3 after EVERY save event (paranoid but cheap) | |
| # ----------------------------------------------------------------------------- | |
| s3_sync: | |
| enabled: true | |
| s3_prefix: "checkpoints/qwen3-8b-tanglish-v1/lora-ckpts/" | |
| # Also sync the merged model after training: | |
| merged_s3_prefix: "checkpoints/qwen3-8b-tanglish-v1/merged/" | |
| # ----------------------------------------------------------------------------- | |
| # Wandb | |
| # ----------------------------------------------------------------------------- | |
| wandb: | |
| project: qwen3-8b-tanglish | |
| run_name: v1 # override via CLI flag if you want | |