Instructions to use koshkosh/quiz-generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use koshkosh/quiz-generator with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("koshkosh/quiz-generator") model = AutoModelForSeq2SeqLM.from_pretrained("koshkosh/quiz-generator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download python_gpt2.py from koshkosh/quiz-generator: direct link, hf CLI and curl.
- Browser
- Download file 380 Bytes
-
https://huggingface.co/koshkosh/quiz-generator/resolve/main/python_gpt2.py
- Command line
-
hf download hf://koshkosh/quiz-generator/python_gpt2.py
-
curl -L -o python_gpt2.py https://huggingface.co/koshkosh/quiz-generator/resolve/main/python_gpt2.py
380 Bytes
| from transformers import GPT2LMHeadModel, GPT2Tokenizer | |
| # Model name to download | |
| model_name = "gpt2" | |
| # Download the GPT-2 model and tokenizer | |
| model = GPT2LMHeadModel.from_pretrained(model_name) | |
| tokenizer = GPT2Tokenizer.from_pretrained(model_name) | |
| # Save the model and tokenizer files locally | |
| model.save_pretrained("./gpt2_model") | |
| tokenizer.save_pretrained("./gpt2_tokenizer") | |