Instructions to use DipanjanSanyal/wikipedia_sample_tiny_gpt2_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DipanjanSanyal/wikipedia_sample_tiny_gpt2_base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DipanjanSanyal/wikipedia_sample_tiny_gpt2_base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DipanjanSanyal/wikipedia_sample_tiny_gpt2_base") model = AutoModelForCausalLM.from_pretrained("DipanjanSanyal/wikipedia_sample_tiny_gpt2_base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DipanjanSanyal/wikipedia_sample_tiny_gpt2_base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DipanjanSanyal/wikipedia_sample_tiny_gpt2_base
- SGLang
How to use DipanjanSanyal/wikipedia_sample_tiny_gpt2_base 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 "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base" \ --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": "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base", "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 "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base" \ --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": "DipanjanSanyal/wikipedia_sample_tiny_gpt2_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DipanjanSanyal/wikipedia_sample_tiny_gpt2_base with Docker Model Runner:
docker model run hf.co/DipanjanSanyal/wikipedia_sample_tiny_gpt2_base
wikipedia_sample_tiny_gpt2_base
This model is a fine-tuned version of gpt2 on the None dataset. It achieves the following results on the evaluation set:
- Loss: 5.7538
Model description
This model is a result of an educational attempt of pre-training.
- Data: 30,000 sample wikipedia articles
- Tokenier: bert-base-uncased
- Context: chunks of exactly 64 tokens with an overlap of 16 tokens
- Initialization:
GPT2LMHead()i.e. GPT2 structure without trained weights, and much smaller size and smaller number of transformer layers - Training: trained for 3 epochs
There is a previous version of the model (which I pasued in between because of budget). Below are the details for that:
- Data: Same
- Tokenizer: Same
- Context: chunks of exactly 64 tokens with an overlap of 48 tokens (so a much larger dataset)
- Initialization: Same
- Training: trained for 15 epochs
To call this version, please use ...from_pretrained('DipanjanSanyal/wikipedia_sample_tiny_gpt2_base', revision = 87d9aa1eb492a5c20db562f113f07b8f8522f5d2')
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 32
- eval_batch_size: 32
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 3
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 6.0712 | 1.0 | 22538 | 6.0994 |
| 5.83 | 2.0 | 45076 | 5.8272 |
| 5.7545 | 3.0 | 67614 | 5.7538 |
Framework versions
- Transformers 4.51.3
- Pytorch 2.6.0+cu124
- Datasets 3.6.0
- Tokenizers 0.21.1
- Downloads last month
- 24
Model tree for DipanjanSanyal/wikipedia_sample_tiny_gpt2_base
Base model
openai-community/gpt2