Text Generation
Transformers
PyTorch
Hindi
English
parambharatgen
bharatgen
bilingual
hindi
english
causal-lm
conversational
custom_code
Instructions to use bharatgenai/Param-1-5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bharatgenai/Param-1-5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bharatgenai/Param-1-5B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("bharatgenai/Param-1-5B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bharatgenai/Param-1-5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bharatgenai/Param-1-5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bharatgenai/Param-1-5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bharatgenai/Param-1-5B
- SGLang
How to use bharatgenai/Param-1-5B 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 "bharatgenai/Param-1-5B" \ --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": "bharatgenai/Param-1-5B", "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 "bharatgenai/Param-1-5B" \ --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": "bharatgenai/Param-1-5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bharatgenai/Param-1-5B with Docker Model Runner:
docker model run hf.co/bharatgenai/Param-1-5B
|
Download README.md from bharatgenai/Param-1-5B: direct link, hf CLI and curl.
- Browser
- Download file 4.93 kB
-
https://huggingface.co/bharatgenai/Param-1-5B/resolve/main/README.md
- Command line
-
hf download hf://bharatgenai/Param-1-5B/README.md
-
curl -L -o README.md https://huggingface.co/bharatgenai/Param-1-5B/resolve/main/README.md
4.93 kB
| language: | |
| - hi | |
| - en | |
| pipeline_tag: text-generation | |
| tags: | |
| - bharatgen | |
| - bilingual | |
| - hindi | |
| - english | |
| - causal-lm | |
| - transformers | |
| license: other | |
| <div align="center"> | |
| <a href="https://bharatgen.com" target="_blank"> | |
| <img src="https://huggingface.co/bharatgenai/Param-1-2.9B-Instruct/resolve/main/BharatGen%20Logo%20(1).png" width="60%" alt="BharatGen" /> | |
| </a> | |
| </div> | |
| <hr> | |
| <div align="center"> | |
| <a href="https://bharatgen.com" target="_blank" style="margin: 4px;"> | |
| <img alt="Homepage" src="https://img.shields.io/badge/Homepage-Visit-blue.svg" /> | |
| </a> | |
| <a href="./LICENSE" target="_blank" style="margin: 4px;"> | |
| <img alt="License" src="https://img.shields.io/badge/License-yellow.svg" /> | |
| </a> | |
| </div> | |
| # Param-1-5B | |
| **Param-1-5B** is a bilingual (**English–Hindi**) large language model developed under the **Param-1** family. With **5 billion parameters**, this model extends the capabilities of **Param-1-2.9B** by incorporating **enhanced mathematical reasoning and code understanding/generation**. | |
| The model is pretrained from scratch and designed to serve as a strong foundation for downstream tasks such as mathematical problem solving, and code-related understanding / generation. | |
| --- | |
| ## Key Highlights | |
| * **5B parameter** dense Transformer model | |
| * **Bilingual**: English and Hindi | |
| * **Enhanced domains**: Math and Code (compared to Param-1-2.9B) | |
| * Updated **dataset mixture and percentage ratios** | |
| * Designed as a **pretrained (PT)** base model | |
| --- | |
| ## Model Inference | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| model_name = "bharatgenai/Param-1-5B" | |
| tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=False) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_name, | |
| trust_remote_code=True, | |
| torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32, | |
| device_map="auto" | |
| ) | |
| prompt = "Your prompt here" | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| with torch.no_grad(): | |
| output = model.generate( | |
| **inputs, | |
| max_new_tokens=300, | |
| do_sample=True, | |
| top_k=50, | |
| top_p=0.95, | |
| temperature=0.6, | |
| eos_token_id=tokenizer.eos_token_id, | |
| use_cache=False | |
| ) | |
| print(tokenizer.decode(output[0], skip_special_tokens=True)) | |
| ``` | |
| --- | |
| ## Benchmarks | |
| | Task | **Param-1-5B (PT)** | | |
| | ----------------- | ------------------- | | |
| | ARC Challenge | 55.1 (few) | | |
| | ARC Easy | 75.6 (few) | | |
| | HellaSwag | 76 (few) | | |
| | HellaSwag Hi | 44.6 (few) | | |
| | MMLU En | 50.8 (few) | | |
| | MMLU Hi | 39.1 (few) | | |
| | TriviaQA | 48.2 | | |
| | TruthfulQA - Gen | 32.9 | | |
| | TruthfulQA - MC1 | 27.1 | | |
| | TruthfulQA - MC2 | 38.6 | | |
| | PIQA | 79.6 | | |
| | SuperGLUE - BoolQ | 72.7 | | |
| | SuperGLUE - WiC | 50.5 | | |
| | SuperGLUE - WSC | 48.1 | | |
| | SuperGLUE - RTE | 65 | | |
| --- | |
| ## Model Architecture | |
| * Architecture: Transformer (Decoder-only) | |
| * Number of parameters: **~5B** | |
| * Hidden size: `4096` | |
| * Intermediate size: `14336` | |
| * Number of layers: `16` | |
| * Number of attention heads: `32` | |
| * Number of key-value heads: `8` | |
| * Maximum position embedding: `4096` | |
| * Positional embeddings: Rotary (RoPE) | |
| * Attention mechanism: Grouped-query attention | |
| * Activation function: `silu` | |
| * Precision: `bf16-mixed` | |
| --- | |
| ## Training Data | |
| The model is pretrained on a large-scale bilingual corpus with a strong focus on **English and Hindi**, along with **dedicated Math and Code data**. | |
| ### Dataset Composition (Total ≈ **6.61T tokens**) | |
| - **English Natural Language:** `3.6T` | |
| - **Hindi Natural Language:** `2.77T` | |
| - **Math & Code:** `238.4B` | |
| - Math: **40%** | |
| - Code: **60%** | |
| Compared to **Param-1-2.9B**, **Param-1-5B** includes: | |
| - A **larger overall training corpus** | |
| - Explicit inclusion of **Math and Code datasets** | |
| - Improved performance in **mathematical** and **code understanding/generation** | |
| - Continued emphasis on **English–Hindi bilingual capability** | |
| --- | |
| ## Training Details | |
| * Training framework: `NVIDIA NeMo` | |
| * Training infrastructure: `Yotta's Shakti Cloud` | |
| * Hardware: `NVIDIA H100 - 1024 GPUs` | |
| * Total training tokens: `6.61 Trillion` | |
| --- | |
| ## Limitations | |
| * This is a **pretrained base model** and may require fine-tuning for instruction-following or chat use cases. | |
| * The model may reflect biases present in large-scale web and code data. | |
| * Performance on low-resource Hindi domains may vary depending on task complexity. | |
| --- | |
| ## License | |
| This model is released under the **BharatGen non-commercial license**. | |
| Please refer to the [LICENSE](./LICENSE) file for detailed terms and conditions. | |
| --- | |