Instructions to use ritwikm/gandhi-gpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ritwikm/gandhi-gpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ritwikm/gandhi-gpt")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ritwikm/gandhi-gpt") model = AutoModelForCausalLM.from_pretrained("ritwikm/gandhi-gpt") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ritwikm/gandhi-gpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ritwikm/gandhi-gpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ritwikm/gandhi-gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ritwikm/gandhi-gpt
- SGLang
How to use ritwikm/gandhi-gpt 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 "ritwikm/gandhi-gpt" \ --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": "ritwikm/gandhi-gpt", "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 "ritwikm/gandhi-gpt" \ --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": "ritwikm/gandhi-gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ritwikm/gandhi-gpt with Docker Model Runner:
docker model run hf.co/ritwikm/gandhi-gpt
Introduction
We have scrapped all the collected works of Mohandas Karamchand Gandhi (aka Mahatma Gandhi) from here. Cleaned the text so that it contains only the writings of Gandhi without footnotes, titles, and other texts.
We observed that (after cleaning), Gandhi wrote 755468 sentences.
We first fine-tuned gpt-2 for 1 epoch on the English corpus (after cleaning*) of Ai4Bharat.
Since the above dataset contains news regarding Indian subcontinent. We thought that with this fine-tuning, the model will get familiary with India specific terms.
Then we further fine-tuned this model on sentences written by Gandhi (for 3 epochs).
Here is the colab link with a working example.
*Before cleaning #sents = 54M, after cleaning 42M. We simply took those English sentences which ends with a full-stop.
- Downloads last month
- 13