Text Generation
Transformers
Safetensors
PyTorch
English
gpt2
trained-from-scratch
text-completion
english
sangraha
text-generation-inference
Instructions to use sraivante/Custom-GPT-40M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sraivante/Custom-GPT-40M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sraivante/Custom-GPT-40M-Base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sraivante/Custom-GPT-40M-Base") model = AutoModelForCausalLM.from_pretrained("sraivante/Custom-GPT-40M-Base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sraivante/Custom-GPT-40M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sraivante/Custom-GPT-40M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sraivante/Custom-GPT-40M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sraivante/Custom-GPT-40M-Base
- SGLang
How to use sraivante/Custom-GPT-40M-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 "sraivante/Custom-GPT-40M-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": "sraivante/Custom-GPT-40M-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 "sraivante/Custom-GPT-40M-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": "sraivante/Custom-GPT-40M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sraivante/Custom-GPT-40M-Base with Docker Model Runner:
docker model run hf.co/sraivante/Custom-GPT-40M-Base
Download training/conversion_validation.json from sraivante/Custom-GPT-40M-Base: direct link, hf CLI and curl.
- Browser
- Download file 4.61 kB
-
https://huggingface.co/sraivante/Custom-GPT-40M-Base/resolve/main/training/conversion_validation.json
- Command line
-
hf download hf://sraivante/Custom-GPT-40M-Base/training/conversion_validation.json
-
curl -L -o conversion_validation.json https://huggingface.co/sraivante/Custom-GPT-40M-Base/resolve/main/training/conversion_validation.json
4.61 kB
| { | |
| "torch": "2.12.0+cpu", | |
| "transformers": "4.56.2", | |
| "tokenizers": "0.22.1", | |
| "checkpoints": { | |
| "ckpt_best.pt": { | |
| "step": 4750, | |
| "val_loss": 4.198967456817627, | |
| "config": { | |
| "batch_size": 32, | |
| "block_size": 256, | |
| "dropout": 0.1, | |
| "eval_interval": 250, | |
| "eval_iters": 50, | |
| "grad_accum": 2, | |
| "grad_clip": 1.0, | |
| "learning_rate": 0.0003, | |
| "max_iters": 5000, | |
| "min_lr": 3e-05, | |
| "n_embd": 512, | |
| "n_head": 8, | |
| "n_layer": 10, | |
| "vocab_size": 16000, | |
| "warmup_iters": 200, | |
| "weight_decay": 0.1 | |
| }, | |
| "sha256": "8001f584a6cd7869d84af5e8fd5d37a1e9a4c29f9789b5a19e012480c98fbfae", | |
| "bytes": 478325259, | |
| "keys": [ | |
| "config", | |
| "model", | |
| "optimizer", | |
| "step", | |
| "val_loss" | |
| ] | |
| }, | |
| "ckpt_latest.pt": { | |
| "step": 5000, | |
| "val_loss": 4.211184501647949, | |
| "config": { | |
| "batch_size": 32, | |
| "block_size": 256, | |
| "dropout": 0.1, | |
| "eval_interval": 250, | |
| "eval_iters": 50, | |
| "grad_accum": 2, | |
| "grad_clip": 1.0, | |
| "learning_rate": 0.0003, | |
| "max_iters": 5000, | |
| "min_lr": 3e-05, | |
| "n_embd": 512, | |
| "n_head": 8, | |
| "n_layer": 10, | |
| "vocab_size": 16000, | |
| "warmup_iters": 200, | |
| "weight_decay": 0.1 | |
| }, | |
| "sha256": "ad19ad3027ac3378fd10a46406bdfe3db3e6c865435e5ec3646da8768a6690c0", | |
| "bytes": 478326263, | |
| "keys": [ | |
| "config", | |
| "model", | |
| "optimizer", | |
| "step", | |
| "val_loss" | |
| ] | |
| } | |
| }, | |
| "parameter_count": 39847936, | |
| "all_model_tensors_finite": true, | |
| "strict_state_dict_load": true, | |
| "tied_embeddings": true, | |
| "tokenizer_parity_samples": 7, | |
| "logit_parity": [ | |
| { | |
| "context_tokens": 5, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 4, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 10, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 11, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 7, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 1, | |
| "max_absolute_logit_error": 2.86102294921875e-06, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 32, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 128, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| }, | |
| { | |
| "context_tokens": 256, | |
| "max_absolute_logit_error": 0.0, | |
| "allclose_atol": 0.0001, | |
| "allclose_rtol": 1e-05 | |
| } | |
| ], | |
| "greedy_generation_parity": true, | |
| "saved_auto_model_reload_parity": true, | |
| "smoke_generations": [ | |
| { | |
| "prompt": "The future of artificial intelligence", | |
| "greedy_completion": " The future of artificial intelligence is the most important thing to do with the world.\nThe world is a very important thing to do with the world. It is a great way to do the world. It is a great way", | |
| "generated_tokens": 40 | |
| }, | |
| { | |
| "prompt": "India is a country", | |
| "greedy_completion": " India is a country that is a country that is a country that is a country that is a country that is a country that is a country that is a country that is a country that is a country that is a country", | |
| "generated_tokens": 40 | |
| }, | |
| { | |
| "prompt": "Hello, world!\nA new paragraph.", | |
| "greedy_completion": " Hello, world!\nA new paragraph.\nA new book is a book of the book.\nA new book is written by the author of the book.\nA new book is written by the author of the book.\nA new", | |
| "generated_tokens": 40 | |
| } | |
| ], | |
| "validation_perplexity_from_logged_loss": 66.61751006088267, | |
| "export": { | |
| "format": "safetensors", | |
| "dtype": "float32", | |
| "optimizer_state_included": false, | |
| "model_type": "gpt2", | |
| "activation_function": "gelu" | |
| }, | |
| "weights_sha256": "28d20da604f1350cccbee9456b5eca3093f3db9c077469e97e89353d647307ae" | |
| } | |