Instructions to use alexyang790/gpt2-classbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alexyang790/gpt2-classbot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alexyang790/gpt2-classbot")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("alexyang790/gpt2-classbot") model = AutoModelForCausalLM.from_pretrained("alexyang790/gpt2-classbot", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use alexyang790/gpt2-classbot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alexyang790/gpt2-classbot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alexyang790/gpt2-classbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/alexyang790/gpt2-classbot
- SGLang
How to use alexyang790/gpt2-classbot 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 "alexyang790/gpt2-classbot" \ --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": "alexyang790/gpt2-classbot", "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 "alexyang790/gpt2-classbot" \ --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": "alexyang790/gpt2-classbot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use alexyang790/gpt2-classbot with Docker Model Runner:
docker model run hf.co/alexyang790/gpt2-classbot
language: en tags: - gpt2 - text-generation - class-scheduling - fine-tuned license: mit datasets: web-scrapped dataset from Louslist.org with a custom API model-index: - name: GPT-2 UVA Class Scheduler
π§ GPT-2 UVA Class Scheduler (Fine-Tuned)
This model is a fine-tuned version of gpt2 on a custom dataset extracted from Lou's List β the University of Virginia's course directory. It is designed to answer questions about course offerings, availability, instructors, and generate plausible class schedules in natural language.
π Use Cases
- Ask for available classes in a subject
- Query instructors teaching specific courses
- Get summaries of course descriptions
- Generate sample schedules for a semester
π Example Usage
from transformers import GPT2LMHeadModel, GPT2Tokenizer
model = GPT2LMHeadModel.from_pretrained("your-username/uva-gpt2-scheduler")
tokenizer = GPT2Tokenizer.from_pretrained("your-username/uva-gpt2-scheduler")
prompt = "What classes are available for Data Science in Spring 2024?"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
ποΈ Training
- Base model:
gpt2(117M parameters) - Dataset: Custom dataset scraped and cleaned from UVA's Louβs List
- Training platform: Google Colab
- Epochs: 3
- Batch size: 4
- Learning rate: 5e-5
- Tokenizer: GPT-2 tokenizer
- Token Length: 128
π Model Files
pytorch_model.bin: Model weightsconfig.json: Model configurationtokenizer.json,vocab.json,merges.txt: Tokenizer files
π§ͺ Limitations
- The model is trained only on course listing data, so it may hallucinate responses if prompted with unrelated queries.
- Class availability and schedules may change over time β this model reflects a snapshot of the data at the time of training.
π License
MIT License
π Acknowledgements
- Course data provided via Louβs List (https://louslist.org)
- Fine-tuning done for the [Class Project Name] at the University of Virginia M.S. in Data Science
- Downloads last month
- 12