Instructions to use maharshipandya/AnimeGPTSan with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use maharshipandya/AnimeGPTSan with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="maharshipandya/AnimeGPTSan")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("maharshipandya/AnimeGPTSan") model = AutoModelForCausalLM.from_pretrained("maharshipandya/AnimeGPTSan") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use maharshipandya/AnimeGPTSan with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "maharshipandya/AnimeGPTSan" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "maharshipandya/AnimeGPTSan", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/maharshipandya/AnimeGPTSan
- SGLang
How to use maharshipandya/AnimeGPTSan 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 "maharshipandya/AnimeGPTSan" \ --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": "maharshipandya/AnimeGPTSan", "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 "maharshipandya/AnimeGPTSan" \ --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": "maharshipandya/AnimeGPTSan", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use maharshipandya/AnimeGPTSan with Docker Model Runner:
docker model run hf.co/maharshipandya/AnimeGPTSan
AnimeGPTSan (Fine-tuned for Anime synopsis)
AnimeGPTSan is essentially the OpenAI's GPT2 model fine-tuned on this anime dataset. This model can be used to generate new descriptions/synopses for anime, based on some input prompt.
The original GPT2 model can be found here: OpenAI's GPT2 on HuggingFace
Results
- Input prompt
The shadow realm
- Outputs
The shadow realm of the dark lord's hands will be invaded by the evil, demonic beasts. One day, the lord's minions, the Shattering Star God, awaken and attack the world...The shadow realm of the Underworld awaits the demon lord Akito who is intent upon subjugating the human world. The Demon Lord is determined to destroy the world. He intends to use the "Dark Soul" as the catalyst...The shadow realm is the source of many evil, but at its core, lies a magical weapon capable of killing any creature it touches. A group of teenagers in a high-tech school known as the Dark Knight Knights, nicknamed the "Darks," are a force that will...The shadow realm has been awakened by the coming of the evil Demon King. The Shadow Warriors are a team of warriors who have been chosen to battle the Demon King with special powers...The shadow realm exists between us and the demon world, and it is the source of the demons' power. The demons were sent to destroy the shadow realm, to make people mad. However, the evil spirit of the demon was able to...
Usage
The below code describes how to use AnimeGPTSan to generate anime synopsis given some input prompt.
Note: Make sure to use a GPU for faster responses
from transformers import GPT2LMHeadModel, GPT2Tokenizer
anime_model = GPT2LMHeadModel.from_pretrained("maharshipandya/AnimeGPTSan")
anime_tokenizer = GPT2Tokenizer.from_pretrained("maharshipandya/AnimeGPTSan")
def generate_text(sequence):
outputs = []
ids = anime_tokenizer.encode(f"{sequence}", return_tensors="pt")
final_outputs = anime_model.generate(ids, do_sample=True, max_length=200, top_k=40,
top_p=0.95, temperature=1.0, num_return_sequences=10)
for i, out in enumerate(final_outputs):
output = anime_tokenizer.decode(out, skip_special_tokens=True)
outputs.append(output)
return outputs
print(generate_text("The shadow realm")) # list of generated synopses
In order to generate synopses without any prefix prompt, just give "<|startoftext|>" as the input prompt to AnimeGPTSan.
- Downloads last month
- 6