hakurei commited on
Commit
3f4327a
1 Parent(s): 0bb41ae
Files changed (1) hide show
  1. README.md +76 -0
README.md CHANGED
@@ -1,3 +1,79 @@
1
  ---
 
 
 
 
 
2
  license: agpl-3.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - pytorch
6
+ - causal-lm
7
  license: agpl-3.0
8
+ pipeline_tag: text-generation
9
  ---
10
+
11
+ # Waifu-12B - A Large Fine-tuned Model For Fictional Character Conversational Modeling
12
+
13
+ Waifu-12B is a GPT-NeoX 12B model fine-tuned on 2.5GB of a diverse range of light novels, erotica, annotated literature, and public-domain conversations for the purpose of generating novel-like fictional text and conversations.
14
+
15
+ ## Model Description
16
+
17
+ The model used for fine-tuning is [Pythia 12B Deduped](https://github.com/EleutherAI/pythia), which is a 12 billion parameter auto-regressive language model trained on [The Pile](https://pile.eleuther.ai/).
18
+
19
+ ## Training Data & Annotative Prompting
20
+
21
+ The data used in fine-tuning has been gathered from various sources such as the [Gutenberg Project](https://www.gutenberg.org/). The annotated fiction dataset has prepended tags to assist in generating towards a particular style. Here is an example prompt that shows how to use the annotations.
22
+
23
+ ```
24
+ [ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror; Tags: 3rdperson, scary; Style: Dark ]
25
+ ***
26
+ When a traveler in north central Massachusetts takes the wrong fork...
27
+ ```
28
+
29
+ And for conversations which were scraped from [My Discord Server](https://discord.com/invite/touhouai) and publicly available subreddits from [Reddit](https://www.reddit.com/):
30
+
31
+ ```
32
+ [ Title: (2019) Cars getting transported on an open deck catch on fire after salty water shorts their batteries; Genre: CatastrophicFailure ]
33
+ ***
34
+ Anonymous: Daaaaaamn try explaining that one to the owners
35
+ EDIT: who keeps reposting this for my comment to get 3k upvotes?
36
+ Anonymous: "Your car caught fire from some water"
37
+ Irythros: Lol, I wonder if any compensation was in order
38
+ Anonymous: Almost all of the carriers offer insurance but it isn’t cheap. I guarantee most of those owners declined the insurance.
39
+ ```
40
+
41
+ The annotations can be mixed and matched to help generate towards a specific style.
42
+
43
+ ## Downstream Uses
44
+
45
+ This model can be used for entertainment purposes and as a creative writing assistant for fiction writers and chatbots.
46
+
47
+ ## Example Code
48
+
49
+ ```
50
+ from transformers import AutoTokenizer, AutoModelForCausalLM
51
+
52
+ model = AutoModelForCausalLM.from_pretrained('hakurei/waifu-12B')
53
+ tokenizer = AutoTokenizer.from_pretrained('hakurei/waifu-12B')
54
+
55
+ prompt = '''[ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror ]
56
+ ***
57
+ When a traveler'''
58
+
59
+ input_ids = tokenizer.encode(prompt, return_tensors='pt')
60
+ output = model.generate(input_ids, do_sample=True, temperature=1.0, top_p=0.9, repetition_penalty=1.2, max_length=len(input_ids[0])+100, pad_token_id=tokenizer.eos_token_id)
61
+
62
+ generated_text = tokenizer.decode(output[0])
63
+ print(generated_text)
64
+ ```
65
+
66
+ An example output from this code produces a result that will look similar to:
67
+
68
+ ```
69
+ [ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror ]
70
+ ***
71
+ When a traveler comes to an unknown region, his thoughts turn inevitably towards the old gods and legends which cluster around its appearance. It is not that he believes in them or suspects their reality—but merely because they are present somewhere else in creation just as truly as himself, and so belong of necessity in any landscape whose features cannot be altogether strange to him. Moreover, man has been prone from ancient times to brood over those things most connected with the places where he dwells. Thus the Olympian deities who ruled Hyper
72
+ ```
73
+
74
+ ## Team members and Acknowledgements
75
+
76
+ This project would not have been possible without the work done by EleutherAI. Thank you!
77
+
78
+ - [Anthony Mercurio](https://github.com/harubaru)
79
+ - Imperishable_NEET