Text Generation
Transformers
Safetensors
llama
small-language-model
slm
indic
multilingual
edge-ai
logistics
customer-support
text-generation-inference
Instructions to use learner-subodh/Indic-Delivery-Rider-SLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use learner-subodh/Indic-Delivery-Rider-SLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="learner-subodh/Indic-Delivery-Rider-SLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("learner-subodh/Indic-Delivery-Rider-SLM") model = AutoModelForCausalLM.from_pretrained("learner-subodh/Indic-Delivery-Rider-SLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use learner-subodh/Indic-Delivery-Rider-SLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "learner-subodh/Indic-Delivery-Rider-SLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learner-subodh/Indic-Delivery-Rider-SLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/learner-subodh/Indic-Delivery-Rider-SLM
- SGLang
How to use learner-subodh/Indic-Delivery-Rider-SLM 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 "learner-subodh/Indic-Delivery-Rider-SLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learner-subodh/Indic-Delivery-Rider-SLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "learner-subodh/Indic-Delivery-Rider-SLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "learner-subodh/Indic-Delivery-Rider-SLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use learner-subodh/Indic-Delivery-Rider-SLM with Docker Model Runner:
docker model run hf.co/learner-subodh/Indic-Delivery-Rider-SLM
Upload Indic Delivery Rider SLM (40M)
Browse files- README.md +87 -0
- config.json +32 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- slm_format.json +15 -0
- tokenizer.model +3 -0
README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: ["en", "hi", "bn", "mr", "ta"]
|
| 3 |
+
license: other
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags: [small-language-model, slm, indic, multilingual, edge-ai, logistics, customer-support, llama]
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Indic-Delivery-Rider-SLM (40M parameters)
|
| 10 |
+
|
| 11 |
+
A small, from-scratch, Llama-style language model for **offline** assistance of delivery partners in India.
|
| 12 |
+
Languages: English, Hindi, Bengali, Marathi, Tamil.
|
| 13 |
+
|
| 14 |
+
> **Experimental research model.** Trained for ~28 minutes on one T4 GPU on a small dataset. Non-English
|
| 15 |
+
> domain data is **machine-translated** and has not been reviewed by native speakers. Not for payments, safety or legal advice.
|
| 16 |
+
|
| 17 |
+
## Architecture
|
| 18 |
+
Decoder-only transformer, 10 layers, hidden 512, 8 attention heads / 4 KV heads (GQA), SwiGLU MLP (1408),
|
| 19 |
+
RMSNorm, RoPE, tied embeddings, context 384. Tokenizer: SentencePiece BPE, 20000 tokens, byte fallback.
|
| 20 |
+
Exports as `LlamaForCausalLM` (logits verified against the original implementation).
|
| 21 |
+
|
| 22 |
+
Tokenizer fertility on held-out text:
|
| 23 |
+
- English: 1.28 tokens/word (GPT-2 BPE: 1.30)
|
| 24 |
+
- Hindi: 1.26 tokens/word (GPT-2 BPE: 7.76)
|
| 25 |
+
- Bengali: 1.45 tokens/word (GPT-2 BPE: 12.79)
|
| 26 |
+
- Marathi: 1.57 tokens/word (GPT-2 BPE: 10.50)
|
| 27 |
+
- Tamil: 1.81 tokens/word (GPT-2 BPE: 23.44)
|
| 28 |
+
|
| 29 |
+
## Prompt format
|
| 30 |
+
`<s><|user|>{question}<|assistant|><|lang|>` then the model writes the answer and `</s>`.
|
| 31 |
+
`<|lang|>` is one of `<|en|>`, `<|hi|>`, `<|bn|>`, `<|mr|>`, `<|ta|>`; prefill it to force the reply language, or omit it to let the model choose.
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
```python
|
| 35 |
+
import torch, sentencepiece as spm
|
| 36 |
+
from huggingface_hub import snapshot_download
|
| 37 |
+
from transformers import AutoModelForCausalLM
|
| 38 |
+
|
| 39 |
+
path = snapshot_download("learner-subodh/Indic-Delivery-Rider-SLM")
|
| 40 |
+
sp = spm.SentencePieceProcessor(model_file=f"{path}/tokenizer.model")
|
| 41 |
+
model = AutoModelForCausalLM.from_pretrained(path).eval()
|
| 42 |
+
|
| 43 |
+
q = "Customer wants to change the delivery address after pickup. What should I tell them?"
|
| 44 |
+
ids = [sp.bos_id(), sp.piece_to_id("<|user|>")] + sp.encode(q) + [sp.piece_to_id("<|assistant|>"), sp.piece_to_id("<|en|>")]
|
| 45 |
+
out = model.generate(torch.tensor([ids]), max_new_tokens=160, do_sample=True, temperature=0.6, top_k=40, top_p=0.9,
|
| 46 |
+
repetition_penalty=1.15, eos_token_id=sp.eos_id(), pad_token_id=sp.pad_id())
|
| 47 |
+
print(sp.decode(out[0][len(ids):].tolist()))
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Training data
|
| 51 |
+
- Bitext customer-support dataset (English, `bitext/Bitext-customer-support-llm-chatbot-training-dataset`)
|
| 52 |
+
- Sentence-level machine translation of a stratified subset into the other languages with NLLB-200 (600M distilled), filtered for placeholders, script, repetition and length
|
| 53 |
+
- Native-script instruction data from the Aya dataset (`CohereForAI/aya_dataset`, Apache-2.0)
|
| 54 |
+
|
| 55 |
+
## Evaluation (held-out)
|
| 56 |
+
Bits per byte of the answer text (lower is better; comparable across scripts). `domain` = support-style data, `general` = Aya.
|
| 57 |
+
|
| 58 |
+
| lang | data | bits_per_byte | ppl | resp_tokens |
|
| 59 |
+
|---|---|---|---|---|
|
| 60 |
+
| bn | domain | 0.204 | 6.614 | 10821 |
|
| 61 |
+
| bn | general | 0.825 | 193.146 | 5206 |
|
| 62 |
+
| en | domain | 0.258 | 2.297 | 52493 |
|
| 63 |
+
| hi | domain | 0.199 | 4.506 | 12750 |
|
| 64 |
+
| hi | general | 0.694 | 51.689 | 3170 |
|
| 65 |
+
| mr | domain | 0.217 | 7.363 | 11822 |
|
| 66 |
+
| mr | general | 0.668 | 36.486 | 4682 |
|
| 67 |
+
| ta | domain | 0.177 | 7.704 | 12050 |
|
| 68 |
+
| ta | general | 0.731 | 119.382 | 9661 |
|
| 69 |
+
|
| 70 |
+
Generation checks on hand-written rider prompts (3 per language; tiny sample, indicative only): `lang_fidelity` = reply is in the expected
|
| 71 |
+
script (and Hindi/Marathi marker words), `auto_lang_id` = model picks the right language tag unprompted, `distinct2` = 1 - repetition.
|
| 72 |
+
|
| 73 |
+
| lang | lang_fidelity | auto_lang_id | distinct2 | stop_rate | avg_words |
|
| 74 |
+
|---|---|---|---|---|---|
|
| 75 |
+
| bn | 1.0 | 1.0 | 0.95 | 0.67 | 80.0 |
|
| 76 |
+
| en | 1.0 | 1.0 | 0.98 | 0.67 | 75.0 |
|
| 77 |
+
| hi | 1.0 | 1.0 | 0.94 | 1.0 | 91.67 |
|
| 78 |
+
| mr | 0.67 | 1.0 | 0.65 | 0.67 | 57.67 |
|
| 79 |
+
| ta | 1.0 | 1.0 | 0.99 | 0.67 | 89.67 |
|
| 80 |
+
|
| 81 |
+
## Limitations
|
| 82 |
+
Small capacity, small data: it can state wrong policies fluently, blur Hindi and Marathi (same script), and repeat itself.
|
| 83 |
+
Machine-translated training text carries translation errors. Route anything involving money, injuries or disputes to a human or a fixed template.
|
| 84 |
+
|
| 85 |
+
## Licensing note
|
| 86 |
+
Mixed provenance: Bitext (CDLA-Sharing-1.0), Aya (Apache-2.0), and translations produced by NLLB-200 (model weights CC-BY-NC-4.0).
|
| 87 |
+
Check these terms with your own counsel before any commercial use. Weights are released for research and evaluation.
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 512,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 1408,
|
| 15 |
+
"max_position_embeddings": 384,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 8,
|
| 19 |
+
"num_hidden_layers": 10,
|
| 20 |
+
"num_key_value_heads": 4,
|
| 21 |
+
"pad_token_id": 3,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-05,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000.0,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"tie_word_embeddings": true,
|
| 29 |
+
"transformers_version": "5.22.2",
|
| 30 |
+
"use_cache": true,
|
| 31 |
+
"vocab_size": 20000
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 3,
|
| 8 |
+
"transformers_version": "5.22.2",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12fb68f95eba1f4a4bfe4357d2c3dd3b4aa7cf1358df7892fda86bed0e370046
|
| 3 |
+
size 158977928
|
slm_format.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos": 1,
|
| 3 |
+
"eos": 2,
|
| 4 |
+
"pad": 3,
|
| 5 |
+
"user": 4,
|
| 6 |
+
"assistant": 5,
|
| 7 |
+
"lang_tags": {
|
| 8 |
+
"en": 6,
|
| 9 |
+
"hi": 7,
|
| 10 |
+
"bn": 8,
|
| 11 |
+
"mr": 9,
|
| 12 |
+
"ta": 10
|
| 13 |
+
},
|
| 14 |
+
"format": "<s><|user|>{prompt}<|assistant|><|lang|>{reply}</s>"
|
| 15 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0c508b431f5c137fa61160753ce6d2ce0da32b26ca4901729b65ab82d789622
|
| 3 |
+
size 472106
|