Instructions to use egosumkira/gpt2-fantasy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use egosumkira/gpt2-fantasy with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="egosumkira/gpt2-fantasy")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("egosumkira/gpt2-fantasy") model = AutoModelForCausalLM.from_pretrained("egosumkira/gpt2-fantasy") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use egosumkira/gpt2-fantasy with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "egosumkira/gpt2-fantasy" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "egosumkira/gpt2-fantasy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/egosumkira/gpt2-fantasy
- SGLang
How to use egosumkira/gpt2-fantasy 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 "egosumkira/gpt2-fantasy" \ --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": "egosumkira/gpt2-fantasy", "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 "egosumkira/gpt2-fantasy" \ --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": "egosumkira/gpt2-fantasy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use egosumkira/gpt2-fantasy with Docker Model Runner:
docker model run hf.co/egosumkira/gpt2-fantasy
gpt2-fantasy
This model is a fine-tuned version of gpt2 on IMDB fantasy synopsis dataset.
Model description
This model was fine-tuned with intention of generating short fantasy stories based on given keywords. You can test this model here.
Training data
Training data was parsed from IMDB website and consists of keywords-synopsis pairs. Method of encoding data was inspired from this repo.
Training hyperparameters
The following hyperparameters were used during training:
- optimizer: Adam
- dropout: 0.2
- learning schedule: exponential decay
- epochs: 4
Training results
Keywords: time travel, magic, rescue.
Output: A group of young men find themselves in the middle of a desert, and must band together to save their friend from an evil force bent on destroying his world. But what if they don't trust each other? Is there something that might help them at all costs? Can they break the spell before it's too late? Will they be able to stop this Evil once and for all? Or will they do anything about it? Above all, can they make things right with humanity? And above all, is there some really good magic going on here? What are they trying to do?
Framework versions
- Transformers 4.29.2
- TensorFlow 2.12.0
- Tokenizers 0.13.3
- Downloads last month
- 8
Model tree for egosumkira/gpt2-fantasy
Base model
openai-community/gpt2