Instructions to use rejauldu/gpt2-bengali with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rejauldu/gpt2-bengali with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rejauldu/gpt2-bengali")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("rejauldu/gpt2-bengali") model = AutoModelForMultimodalLM.from_pretrained("rejauldu/gpt2-bengali") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rejauldu/gpt2-bengali with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rejauldu/gpt2-bengali" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rejauldu/gpt2-bengali", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rejauldu/gpt2-bengali
- SGLang
How to use rejauldu/gpt2-bengali 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 "rejauldu/gpt2-bengali" \ --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": "rejauldu/gpt2-bengali", "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 "rejauldu/gpt2-bengali" \ --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": "rejauldu/gpt2-bengali", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rejauldu/gpt2-bengali with Docker Model Runner:
docker model run hf.co/rejauldu/gpt2-bengali
Bengali GPT-2
This is a GPT-2 model finetuned on Bengali Wikipedia. It is designed for text generation in Bengali.
Model Details
- Base model: GPT-2
- Tokenizer: Custom Bengali tokenizer (ByteLevel BPE)
- Language: Bengali (bn)
- Task: Text generation (causal language modeling)
- Training data: Cleaned and deduplicated Bengali Wikipedia dump
- License: Apache 2.0
Usage
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
# Load tokenizer and model from Hugging Face
tokenizer = GPT2TokenizerFast.from_pretrained("rejauldu/bengali-gpt2-tokenizer")
model = GPT2LMHeadModel.from_pretrained("rejauldu/bengali-gpt2")
# Generate text
inputs = tokenizer("বাংলায় স্বাগত", return_tensors="pt")
outputs = model.generate(**inputs, max_length=50)
print(tokenizer.decode(outputs[0]))
- Downloads last month
- 6