maharshipandya commited on
Commit
5daf7a9
1 Parent(s): 37db783

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -19
README.md CHANGED
@@ -10,38 +10,51 @@ model-index:
10
  <!-- This model card has been generated automatically according to the information Keras had access to. You should
11
  probably proofread and complete it, then remove this comment. -->
12
 
13
- # AnimeGPTSan
14
 
15
- This model is a fine-tuned version of [maharshipandya/AnimeGPTSan](https://huggingface.co/maharshipandya/AnimeGPTSan) on an unknown dataset.
16
- It achieves the following results on the evaluation set:
17
 
 
18
 
19
- ## Model description
20
 
21
- More information needed
22
 
23
- ## Intended uses & limitations
24
 
25
- More information needed
26
 
27
- ## Training and evaluation data
 
 
 
 
28
 
29
- More information needed
30
 
31
- ## Training procedure
32
 
33
- ### Training hyperparameters
34
 
35
- The following hyperparameters were used during training:
36
- - optimizer: None
37
- - training_precision: float32
38
 
39
- ### Training results
 
40
 
 
 
 
 
 
41
 
 
 
 
42
 
43
- ### Framework versions
44
 
45
- - Transformers 4.30.2
46
- - TensorFlow 2.12.0
47
- - Tokenizers 0.13.3
 
 
10
  <!-- This model card has been generated automatically according to the information Keras had access to. You should
11
  probably proofread and complete it, then remove this comment. -->
12
 
13
+ # AnimeGPTSan (Fine-tuned for Anime synopsis)
14
 
15
+ `AnimeGPTSan` is essentially the OpenAI's `GPT2` model fine-tuned on [this anime dataset](https://www.kaggle.com/datasets/marlesson/myanimelist-dataset-animes-profiles-reviews). This model can be used to generate new descriptions/synopses for anime, based on some input prompt.
 
16
 
17
+ The original `GPT2` model can be found here: [OpenAI's GPT2 on HuggingFace](https://huggingface.co/gpt2)
18
 
19
+ # Results
20
 
21
+ - Input prompt
22
 
23
+ `The shadow realm`
24
 
25
+ - Outputs
26
 
27
+ 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...`
28
+ 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...`
29
+ 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...`
30
+ 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...`
31
+ 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...`
32
 
33
+ # Usage
34
 
35
+ The below code describes how to use `AnimeGPTSan` to generate anime synopsis given some input prompt.
36
 
37
+ > Note: Make sure to use a GPU for faster responses
38
 
39
+ ```python
40
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
 
41
 
42
+ anime_model = GPT2LMHeadModel.from_pretrained("maharshipandya/AnimeGPTSan")
43
+ anime_tokenizer = GPT2Tokenizer.from_pretrained("maharshipandya/AnimeGPTSan")
44
 
45
+ def generate_text(sequence):
46
+ outputs = []
47
+ ids = anime_tokenizer.encode(f"{sequence}", return_tensors="pt")
48
+ final_outputs = anime_model.generate(ids, do_sample=True, max_length=200, top_k=40,
49
+ top_p=0.95, temperature=1.0, num_return_sequences=10)
50
 
51
+ for i, out in enumerate(final_outputs):
52
+ output = anime_tokenizer.decode(out, skip_special_tokens=True)
53
+ outputs.append(output)
54
 
55
+ return outputs
56
 
57
+ print(generate_text("The shadow realm")) # list of generated synopses
58
+ ```
59
+
60
+ In order to generate synopses without any prefix prompt, just give `"<|startoftext|>"` as the input prompt to `AnimeGPTSan`.