Instructions to use LingoIITGN/Ganga-2-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LingoIITGN/Ganga-2-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LingoIITGN/Ganga-2-1B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LingoIITGN/Ganga-2-1B") model = AutoModelForCausalLM.from_pretrained("LingoIITGN/Ganga-2-1B") 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 LingoIITGN/Ganga-2-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LingoIITGN/Ganga-2-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LingoIITGN/Ganga-2-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LingoIITGN/Ganga-2-1B
- SGLang
How to use LingoIITGN/Ganga-2-1B 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 "LingoIITGN/Ganga-2-1B" \ --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": "LingoIITGN/Ganga-2-1B", "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 "LingoIITGN/Ganga-2-1B" \ --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": "LingoIITGN/Ganga-2-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LingoIITGN/Ganga-2-1B with Docker Model Runner:
docker model run hf.co/LingoIITGN/Ganga-2-1B
Model Card for Ganga-2-1b! 🌊
The instruct tunned model Ganga-2-1b trained on a monolingual Hindi language dataset as part of Project Unity. We propose the name Ganga 🌊 to honor the longest river flowing through the Hindi-speaking region of India 🇮🇳.
(The first pre-trained Hindi model by any academic research lab in India 🇮🇳!)*
Disclaimer: This is a text-completion model designed for fine-tuning on downstream tasks. It is not intended for direct use as a chat or instruction-following model.
Model Description 📚
Project Unity is an initiative to address India's linguistic diversity and richness by creating a comprehensive resource covering the country's major languages. We strive to achieve state-of-the-art performance in understanding and generating text in Indian languages. To achieve this, we train models on the monolingual regional languages of India. Our first release is the Ganga-1B model, which has been trained on a large dataset of public domain web-crawled Hindi language data, including news articles, web documents, books, government publications, educational materials, and social media conversations (filtered for quality). Additionally, the dataset has been further curated by native Indian speakers to ensure high quality. Significantly, the Ganga-2-1B model outperforms existing open-source models that support Indian languages, even at sizes of up to 7 billion parameters.
- Developed by: Lingo Research Group at IIT Gandhinagar
- Model type: Autoregressive Language Model
- Language(s) (NLP): Bilingual (Primary: Hindi [hi], Secondary: English [en])
- License: Apache 2.0
How to Get Started with the Model 👨🏻💻
Use the code below to get started with the model.
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("LingoIITGN/ganga-2-1b")
model = AutoModelForCausalLM.from_pretrained("LingoIITGN/ganga-2-1b", device_map="auto")
input_text = 'Translate it into Hindi "Innovation is the key to solving complex problems in the modern world."'
#input_text = 'इस वाक्य का सही अंग्रेज़ी अनुवाद करें "जीवन में असली जीत वही है, जब आप अपने डर को हरा दें।"'
#input_text = 'What is capital city of India?'
input_ids = tokenizer.encode("<bos><user>" + input_text + "<assistant>",
return_tensors="pt").to("cuda")
outputs = model.generate(input_ids, max_new_tokens=100,
do_sample=False)
print(tokenizer.decode(outputs[0]))
Technical Specifications 🤖
- Precision: BFloat16
- Context Length: 2,048
- Learning Rate: 4e-4
- Optimizer: AdamW
- LR Scheduler: Cosine
Model Architecture and Objective
Ganga-2-1b is a decoder-only transformer model featuring the following specifications:
- Layers: 16
- Attention heads: 32
- Embedding dimension: 2,048
- Vocabulary size: 32,768
- Sliding window: 1024
- Intermediate dimension: 7,168
Evaluation
[More Information Needed]
Results 🏆
Tokenizers Results
| Model | Fertility |
|---|---|
| Ganga-2-1b | 1.12 |
| Pragna-1b | 1.58 |
| Bloom-1b1 | 1.27 |
| Bloom-1b7 | 1.27 |
| Gemma-2b | 1.89 |
| Bloom-3b | 1.27 |
| Airavata-7b | 1.69 |
| Sarvam-2b | 1.38 |
Metrics
| Model | PPLSangraha Dataset |
|---|---|
| Ganga-2-1b | 8.09 |
| Ganga-1b | 15.82 |
| Pragna-1b | 9.37 |
| Bloom-1b1 | 17.49 |
| Bloom-1b7 | 14.28 |
| Gemma-2b | 31.01 |
| Bloom-3b | 12.82 |
| OpenHathi-7B | 25.73 |
| Airavata-7b | 38.24 |
| Sarvam-2b | 10.31 |
Summary
Bias, Risks, and Limitations 🚨
Recommendations ‼️
This model described is a research preview and is under ongoing iterative updations, and as such, it only provides limited safety measures. Additionally, it may generate offensive content. It is strictly prohibited to use the model for any illegal, harmful, violent, racist, or sexual purposes.
Model Card Contact ✉️
Lingo Research Group at IIT Gandhinagar, India
Mail at: lingo@iitgn.ac.in
- Downloads last month
- 8
