Instructions to use Pathumi/reuters-gpt2-from-scratch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pathumi/reuters-gpt2-from-scratch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Pathumi/reuters-gpt2-from-scratch")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Pathumi/reuters-gpt2-from-scratch") model = AutoModelForCausalLM.from_pretrained("Pathumi/reuters-gpt2-from-scratch", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Pathumi/reuters-gpt2-from-scratch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Pathumi/reuters-gpt2-from-scratch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pathumi/reuters-gpt2-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Pathumi/reuters-gpt2-from-scratch
- SGLang
How to use Pathumi/reuters-gpt2-from-scratch 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 "Pathumi/reuters-gpt2-from-scratch" \ --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": "Pathumi/reuters-gpt2-from-scratch", "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 "Pathumi/reuters-gpt2-from-scratch" \ --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": "Pathumi/reuters-gpt2-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Pathumi/reuters-gpt2-from-scratch with Docker Model Runner:
docker model run hf.co/Pathumi/reuters-gpt2-from-scratch
Commit History
3 days ago
-
Update README.md
Verified signature8aae8e3 -
Create Readme
Verified signature# GPT-2 Language Model Trained from Scratch on Reuters Articles ## About This Model This project was developed as part of the CS4681 Advanced Machine Learning assignment on Self-Supervised Learning. The aim of this project is to train a small GPT-2 language model from scratch using Reuters news articles. The model uses causal language modeling (CLM) to learn how to predict the next token in a text sequence. The model was initialized with random weights instead of using pretrained GPT-2 weights. ## Dataset The model was trained using the [Reuters Articles Dataset](https://huggingface.co/datasets/ingeniumacademy/reuters_articles). | Dataset Split | Number of Articles | |---|---:| | Training | 17,262 | | Validation | 2,158 | | Testing | 2,158 | The title and body of each article were combined and tokenized using `ingeniumacademy/gpt2-reuters-tokenizer`. ## Model Architecture | Parameter | Value | |---|---| | Architecture | GPT-2 | | Initialization | Random weights | | Transforme…6c6417a -
Upload folder using huggingface_hub
Verified signaturec3ecfca -
initial commit
Verified signaturec1587db