GithubHelp home page GithubHelp logo

maharshi-pandya / animegptsan Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 2.35 MB

AnimeGPTSan can be used to generate new descriptions/synopses for anime, based on some input prompt.

License: MIT License

Jupyter Notebook 100.00%

animegptsan's Introduction

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
  1. 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...
  2. 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...
  3. 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...
  4. 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...
  5. 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.

animegptsan's People

Contributors

maharshi-pandya avatar

Stargazers

Ayush Raj avatar Ridhi Bandaru avatar John Anchery avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.