Instructions to use Isotonic/gpt2-context_generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Isotonic/gpt2-context_generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Isotonic/gpt2-context_generator")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Isotonic/gpt2-context_generator") model = AutoModelForCausalLM.from_pretrained("Isotonic/gpt2-context_generator") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Isotonic/gpt2-context_generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Isotonic/gpt2-context_generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Isotonic/gpt2-context_generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Isotonic/gpt2-context_generator
- SGLang
How to use Isotonic/gpt2-context_generator 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 "Isotonic/gpt2-context_generator" \ --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": "Isotonic/gpt2-context_generator", "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 "Isotonic/gpt2-context_generator" \ --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": "Isotonic/gpt2-context_generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Isotonic/gpt2-context_generator with Docker Model Runner:
docker model run hf.co/Isotonic/gpt2-context_generator
gpt2-context_generator
This model is a fine-tuned version of gpt2 on Non-Residual-Prompting/C2Gen dataset.
Model description
More information needed
Intended uses & limitations
- Check config.json for prompt template and sampling strategy.
Dataset Summary
CommonGen Lin et al., 2020 is a dataset for the constrained text generation task of word inclusion. But the task does not allow to include context. Therefore, to complement CommonGen, we provide an extended test set C2Gen Carlsson et al., 2022 where an additional context is provided for each set of target words. The task is therefore reformulated to both generate commonsensical text which include the given words, and also have the generated text adhere to the given context.
Training procedure
- Causal Language Modelling
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 9e-05
- train_batch_size: 32
- eval_batch_size: 32
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.2
- num_epochs: 8
Framework versions
- Transformers 4.27.3
- Pytorch 1.13.1+cu116
- Datasets 2.13.1
- Tokenizers 0.13.2
- Downloads last month
- 17
Model tree for Isotonic/gpt2-context_generator
Base model
openai-community/gpt2
docker model run hf.co/Isotonic/gpt2-context_generator