Text Generation
Transformers
Safetensors
gpt2
causal-lm
self-supervised-learning
reuters
trained-from-scratch
text-generation-inference
Instructions to use RavinduW/reuters-gpt2-from-scratch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RavinduW/reuters-gpt2-from-scratch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RavinduW/reuters-gpt2-from-scratch")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RavinduW/reuters-gpt2-from-scratch") model = AutoModelForCausalLM.from_pretrained("RavinduW/reuters-gpt2-from-scratch", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RavinduW/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 "RavinduW/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": "RavinduW/reuters-gpt2-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RavinduW/reuters-gpt2-from-scratch
- SGLang
How to use RavinduW/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 "RavinduW/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": "RavinduW/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 "RavinduW/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": "RavinduW/reuters-gpt2-from-scratch", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RavinduW/reuters-gpt2-from-scratch with Docker Model Runner:
docker model run hf.co/RavinduW/reuters-gpt2-from-scratch
Reuters GPT-2 trained from scratch
A small GPT-2-style causal language model trained from randomly initialized weights on the ingeniumacademy/reuters_articles dataset.
Dataset and tokenizer
- Dataset:
ingeniumacademy/reuters_articles - Input text: article title + two newlines + article body
- Tokenizer:
ingeniumacademy/gpt2-reuters-tokenizer - Objective: causal next-token prediction
Architecture
- Layers: 4
- Attention heads: 4
- Hidden dimension: 256
- Context length: 256
- Vocabulary size: 52000
- Parameters: 16,537,088
Training
- The GPT model weights were randomly initialized; no pretrained GPT checkpoint was used.
- Main model: 5 epochs
- Comparison model:
comparison_2_epochs/ - Shared seed: 42
- Learning rate: 0.0005
- Effective per-device batch size: 16
See all_run_summaries.json and training_evidence/ for measured results and logs.
- Downloads last month
- 161