Instructions to use mNLP-project/gpt2-finetuned-mcqa-sciq with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mNLP-project/gpt2-finetuned-mcqa-sciq with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mNLP-project/gpt2-finetuned-mcqa-sciq")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mNLP-project/gpt2-finetuned-mcqa-sciq") model = AutoModelForCausalLM.from_pretrained("mNLP-project/gpt2-finetuned-mcqa-sciq") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mNLP-project/gpt2-finetuned-mcqa-sciq with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mNLP-project/gpt2-finetuned-mcqa-sciq" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mNLP-project/gpt2-finetuned-mcqa-sciq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mNLP-project/gpt2-finetuned-mcqa-sciq
- SGLang
How to use mNLP-project/gpt2-finetuned-mcqa-sciq 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 "mNLP-project/gpt2-finetuned-mcqa-sciq" \ --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": "mNLP-project/gpt2-finetuned-mcqa-sciq", "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 "mNLP-project/gpt2-finetuned-mcqa-sciq" \ --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": "mNLP-project/gpt2-finetuned-mcqa-sciq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mNLP-project/gpt2-finetuned-mcqa-sciq with Docker Model Runner:
docker model run hf.co/mNLP-project/gpt2-finetuned-mcqa-sciq
gpt2-finetuned-mcqa-sciq
This model is a fine-tuned version of openai-community/gpt2 on an unknown dataset. It achieves the following results on the evaluation set:
- Loss: 2.3533
- Bertscore Precision: 0.1082
- Bertscore Recall: 0.1141
- Bertscore F1: 0.1111
Model description
More information needed
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: 8
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 16
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10
Training results
| Training Loss | Epoch | Step | Validation Loss | Bertscore Precision | Bertscore Recall | Bertscore F1 |
|---|---|---|---|---|---|---|
| 4.4695 | 0.9999 | 5839 | 2.3612 | 0.1082 | 0.1140 | 0.1110 |
| 4.0507 | 2.0 | 11679 | 2.3533 | 0.1082 | 0.1141 | 0.1111 |
| 3.8779 | 2.9999 | 17518 | 2.3820 | 0.1080 | 0.1140 | 0.1110 |
| 3.2852 | 4.0 | 23358 | 2.4208 | 0.1080 | 0.1140 | 0.1109 |
| 3.6416 | 4.9999 | 29197 | 2.4768 | 0.1079 | 0.1139 | 0.1108 |
| 2.9843 | 6.0 | 35037 | 2.5445 | 0.1079 | 0.1139 | 0.1108 |
| 2.8509 | 6.9999 | 40876 | 2.6094 | 0.1079 | 0.1139 | 0.1108 |
| 2.6932 | 8.0 | 46716 | 2.6658 | 0.1078 | 0.1138 | 0.1107 |
| 2.5309 | 8.9999 | 52555 | 2.7283 | 0.1078 | 0.1138 | 0.1107 |
| 2.5619 | 9.9991 | 58390 | 2.7585 | 0.1078 | 0.1138 | 0.1107 |
Framework versions
- Transformers 4.40.2
- Pytorch 2.3.0+cu121
- Datasets 2.19.1
- Tokenizers 0.19.1
- Downloads last month
- 3
Model tree for mNLP-project/gpt2-finetuned-mcqa-sciq
Base model
openai-community/gpt2