Text Generation
Transformers
Safetensors
gpt2
causal-lm
from-scratch
reuters
text-generation-inference
Instructions to use MeshMax/gpt2-reuters with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MeshMax/gpt2-reuters with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MeshMax/gpt2-reuters")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MeshMax/gpt2-reuters") model = AutoModelForCausalLM.from_pretrained("MeshMax/gpt2-reuters", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MeshMax/gpt2-reuters with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MeshMax/gpt2-reuters" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MeshMax/gpt2-reuters", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MeshMax/gpt2-reuters
- SGLang
How to use MeshMax/gpt2-reuters 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 "MeshMax/gpt2-reuters" \ --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": "MeshMax/gpt2-reuters", "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 "MeshMax/gpt2-reuters" \ --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": "MeshMax/gpt2-reuters", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MeshMax/gpt2-reuters with Docker Model Runner:
docker model run hf.co/MeshMax/gpt2-reuters
Q4 experiment: epochs_2
Browse files- experiments/epochs_2/config.json +34 -0
- experiments/epochs_2/eval_log.csv +10 -0
- experiments/epochs_2/generation_config.json +10 -0
- experiments/epochs_2/loss_curve.png +0 -0
- experiments/epochs_2/metrics.json +20 -0
- experiments/epochs_2/model.safetensors +3 -0
- experiments/epochs_2/tokenizer.json +0 -0
- experiments/epochs_2/tokenizer_config.json +14 -0
- experiments/epochs_2/train_log.csv +22 -0
- experiments/epochs_2/training_args.bin +3 -0
experiments/epochs_2/config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"add_cross_attention": false,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"GPT2LMHeadModel"
|
| 6 |
+
],
|
| 7 |
+
"attn_pdrop": 0.1,
|
| 8 |
+
"bos_token_id": 0,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"embd_pdrop": 0.1,
|
| 11 |
+
"eos_token_id": 0,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"layer_norm_epsilon": 1e-05,
|
| 14 |
+
"model_type": "gpt2",
|
| 15 |
+
"n_embd": 256,
|
| 16 |
+
"n_head": 8,
|
| 17 |
+
"n_inner": null,
|
| 18 |
+
"n_layer": 6,
|
| 19 |
+
"n_positions": 256,
|
| 20 |
+
"pad_token_id": 0,
|
| 21 |
+
"reorder_and_upcast_attn": false,
|
| 22 |
+
"resid_pdrop": 0.1,
|
| 23 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 24 |
+
"scale_attn_weights": true,
|
| 25 |
+
"summary_activation": null,
|
| 26 |
+
"summary_first_dropout": 0.1,
|
| 27 |
+
"summary_proj_to_labels": true,
|
| 28 |
+
"summary_type": "cls_index",
|
| 29 |
+
"summary_use_proj": true,
|
| 30 |
+
"tie_word_embeddings": true,
|
| 31 |
+
"transformers_version": "5.20.2",
|
| 32 |
+
"use_cache": false,
|
| 33 |
+
"vocab_size": 52000
|
| 34 |
+
}
|
experiments/epochs_2/eval_log.csv
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
eval_loss,eval_runtime,eval_samples_per_second,eval_steps_per_second,epoch,step
|
| 2 |
+
6.383346080780029,4.5791,345.268,10.919,0.2493150684931507,91
|
| 3 |
+
5.781818389892578,4.6373,340.93,10.782,0.4986301369863014,182
|
| 4 |
+
5.520852565765381,4.4987,351.434,11.114,0.7479452054794521,273
|
| 5 |
+
5.308560371398926,4.5251,349.384,11.049,0.9972602739726028,364
|
| 6 |
+
5.186249256134033,4.5899,344.45,10.893,1.2465753424657535,455
|
| 7 |
+
5.112856388092041,4.5503,347.448,10.988,1.4958904109589042,546
|
| 8 |
+
5.076841831207275,4.5325,348.816,11.031,1.7452054794520548,637
|
| 9 |
+
5.069819450378418,4.5509,347.401,10.987,1.9945205479452055,728
|
| 10 |
+
5.069815158843994,4.5542,347.153,10.979,2.0,730
|
experiments/epochs_2/generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": 0,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.20.2",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
experiments/epochs_2/loss_curve.png
ADDED
|
experiments/epochs_2/metrics.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"run": "epochs_2",
|
| 3 |
+
"epochs": 2,
|
| 4 |
+
"n_embd": 256,
|
| 5 |
+
"n_layer": 6,
|
| 6 |
+
"n_head": 8,
|
| 7 |
+
"block_size": 256,
|
| 8 |
+
"learning_rate": 0.0005,
|
| 9 |
+
"batch_size": 32,
|
| 10 |
+
"total_params": 18116608,
|
| 11 |
+
"embedding_params": 13377536,
|
| 12 |
+
"non_embedding_params": 4739072,
|
| 13 |
+
"train_time_sec": 190.5,
|
| 14 |
+
"final_train_loss": 4.9058,
|
| 15 |
+
"avg_train_loss": 5.5673,
|
| 16 |
+
"val_loss": 5.0698,
|
| 17 |
+
"val_perplexity": 159.14,
|
| 18 |
+
"test_loss": 4.8294,
|
| 19 |
+
"test_perplexity": 125.14
|
| 20 |
+
}
|
experiments/epochs_2/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:447606a8ae46e92b97971765b83c8393702082fbc8a8e89ac8b3122c218b8594
|
| 3 |
+
size 72473928
|
experiments/epochs_2/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
experiments/epochs_2/tokenizer_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"clean_up_tokenization_spaces": true,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"is_local": false,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"model_max_length": 1024,
|
| 11 |
+
"pad_token": "<|endoftext|>",
|
| 12 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 13 |
+
"unk_token": "<|endoftext|>"
|
| 14 |
+
}
|
experiments/epochs_2/train_log.csv
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
loss,grad_norm,learning_rate,epoch,step
|
| 2 |
+
10.843499183654785,4.1243085861206055,0.0,0.0027397260273972603,1
|
| 3 |
+
9.616796003069197,1.6109970808029175,0.0004861111111111111,0.09863013698630137,36
|
| 4 |
+
7.004016452365452,0.5868044495582581,0.0004968687465157165,0.19726027397260273,72
|
| 5 |
+
6.300339168972439,0.5451584458351135,0.0004871983554619603,0.2958904109589041,108
|
| 6 |
+
5.9771313137478295,0.6023691892623901,0.00047124251808455087,0.39452054794520547,144
|
| 7 |
+
5.788884904649523,0.7368696928024292,0.00044942404321447407,0.4931506849315068,180
|
| 8 |
+
5.627533806694879,0.8528636693954468,0.00042232109191188026,0.5917808219178082,216
|
| 9 |
+
5.507063547770183,0.6476799249649048,0.0003906518569538371,0.6904109589041096,252
|
| 10 |
+
5.4260508219401045,0.6880940794944763,0.0003552555316646499,0.7890410958904109,288
|
| 11 |
+
5.302911122639974,0.8764607906341553,0.00031707007238986973,0.8876712328767123,324
|
| 12 |
+
5.214031643337673,0.7636662125587463,0.00027710734387935204,0.9863013698630136,360
|
| 13 |
+
5.108998616536458,0.7660359144210815,0.0002364263061942254,1.084931506849315,396
|
| 14 |
+
5.073592715793186,0.7230262756347656,0.00019610495364967968,1.1835616438356165,432
|
| 15 |
+
5.007653130425347,0.6248455047607422,0.00015721174937490583,1.2821917808219179,468
|
| 16 |
+
4.989662594265408,0.7315065264701843,0.00012077731243700449,1.3808219178082193,504
|
| 17 |
+
4.965666876898871,0.7256110906600952,8.776710778306462e-05,1.4794520547945205,540
|
| 18 |
+
4.954546610514323,0.6726171970367432,5.90558626812458e-05,1.5780821917808219,576
|
| 19 |
+
4.903006235758464,0.6890636086463928,3.5404387591726924e-05,1.6767123287671233,612
|
| 20 |
+
4.910601298014323,0.7246794104576111,1.7439415684141063e-05,1.7753424657534247,648
|
| 21 |
+
4.909825219048394,0.6434288024902344,5.636995227925601e-06,1.8739726027397259,684
|
| 22 |
+
4.905776129828559,0.588848888874054,3.098749355336938e-07,1.9726027397260273,720
|
experiments/epochs_2/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54872d38ee11d802ef1aff372d1cd21ec7dbe7c128592495df62665b7ba4cd68
|
| 3 |
+
size 5201
|