Downloads · 30 days
10
6% of all-time downloads
CamiloVega/HarryPotterGPT-v2
HarryPotterGPT-v2 is a machine learning model from CamiloVega. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A GPT model trained on Harry Potter books, created by Camilo Vega, AI Consultant and Professor. The model generates text in the style of the Harry Potter saga.
Downloads · 30 days
10
6% of all-time downloads
All-time downloads
174
Public
Repo size
790 MB
Likes
0
Public
Click a slice to open those files.
.bin178 MB · 100%
From the Hugging Face model README
A GPT model trained on Harry Potter books, created by Camilo Vega, AI Consultant and Professor. The model generates text in the style of the Harry Potter saga.
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("CamiloVega/HarryPotterGPT-v2")
model = AutoModelForCausalLM.from_pretrained("CamiloVega/HarryPotterGPT-v2")
# Generate text
prompt = "Harry looked at Hermione and"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100, temperature=0.7, top_k=50)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
This model was trained exclusively on Harry Potter books, so its knowledge is limited to that context. It works best with prompts related to the Harry Potter universe.
This model is part of an educational project on building language models from scratch. More details available at https://github.com/CamiloVga/HarryPotterGPT