Instructions to use FarhanAK128/CustomGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FarhanAK128/CustomGPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FarhanAK128/CustomGPT", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FarhanAK128/CustomGPT", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use FarhanAK128/CustomGPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FarhanAK128/CustomGPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FarhanAK128/CustomGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/FarhanAK128/CustomGPT
- SGLang
How to use FarhanAK128/CustomGPT 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 "FarhanAK128/CustomGPT" \ --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": "FarhanAK128/CustomGPT", "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 "FarhanAK128/CustomGPT" \ --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": "FarhanAK128/CustomGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use FarhanAK128/CustomGPT with Docker Model Runner:
docker model run hf.co/FarhanAK128/CustomGPT
CustomGPT
Model Summary
CustomGPT is an LLM which is built, train, instruction-finetuned from scratch and evaluated using the LLM-as-a-judge method. This project shows my learning about developing a custom LLM architecture from scratch and its deployment on huggingface. It should be noted that this model is not to be used in production as it only for demo purpose which showcases my learning of LLM engineering. GPT pretrained weights have been used which are further fine-tuned on a small instruction dataset.
This model is fully compatible with the Hugging Face transformers ecosystem and can be loaded using AutoModel.from_pretrained.
How to Get Started with the Model
Inference Example (Transformers + tiktoken)
from transformers import AutoModel
import tiktoken
# Load tokenizer
tokenizer = tiktoken.get_encoding("gpt2")
# Load model
model_id = "FarhanAK128/CustomGPT"
model = AutoModel.from_pretrained(
model_id,
trust_remote_code=True
)
# Example prediction
input = {'instruction': 'Rewrite the sentence using a simile.',
'input': 'The car is very fast.'
}
response = model.generate_response(input, tokenizer)
print(response) # The car is as fast as a cheetah.
Note: This model uses a custom .generate() method defined in the repository and requires trust_remote_code=True to function.
Model Details
π Model Description
- Developed by: Farhan Ali Khan
- Model type: GPT-2βbased text generation model
- Base architecture: GPT-2 (OpenAI)
- Framework: PyTorch
- Task: Text Generation
- Language: English
- License: MIT
Training Details
Training Data
The model was trained on a small instruction dataset having 1100 input-output pairs
Training Procedure
- Base weights: OpenAI GPT-2 (355 million parameters)
- Fine-tuning strategy: Full fine-tuning
- Optimizer: AdamW
- Learning rate: 0.00005
- Weight decay: 0.1
- Epochs: 3
- Random seed: 123
- Loss function: Cross-Entropy Loss
- Training Strategy: Mixprecision
- Total training time: ~4.82 minutes
π Training Progress
Training and Validation Loss
π Model Performance
The 355M custom LLM is evaluated using LLama-3.1-8b-instant as an automated judge. For each input, the modelβs response is compared to the ground-truth output, and the judge assigns a score from 0 to 100 based on correctness. Scores are extracted as integers and aggregated to report the average performance across the test dataset which comes out to be 44%.
Model Card Authors
Farhan Ali Khan
Model Card Contact
For questions or feedback, please reach out via my Hugging Face profile: FarhanAK128
- Downloads last month
- 25
