minimaxir commited on
Commit
2ea641d
1 Parent(s): c740375

Usage example

Browse files
Files changed (1) hide show
  1. README.md +26 -4
README.md CHANGED
@@ -6,13 +6,31 @@ license: mit
6
 
7
  A text generation model finetuned on Magic: The Gathering cards up to the Phyrexia: All Will Be One set (February 10, 2023). The base flan-t5-xl was finetuned for 1 "epoch" of card data using the LoRA technique in the PEFT library; this repo contains about 9M hyperparameters for the LoRA adapters.
8
 
9
- This model has strong support for out-of-domain inputs, such as generating a card with the name "San Francisco" (all generations will be Lands) and
10
 
11
  ## Usage
12
 
13
- It is very strongly recommended to use this Colab Notebook to generate from the model as it requires some preprocessing and postprocessing both to get the inputs/outputs into the correct format and to extract the generated results.
14
 
15
- The tokenizer assumes a `\n` token is added to the default T5 tokenizer, as that is necessary for proper detokenization and the model was trained in that way. You can do this by adding `tokenizer.add_special_tokens({"additional_special_tokens": [AddedToken("\n")]})`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## Training Techniques
18
 
@@ -20,7 +38,7 @@ The model was also trained with two techniques to increase diversity and coheren
20
 
21
  ### Hierarchal Sampling
22
 
23
- There are many, more Creature cards than any other types of cards in Magic, therefore any model trained on a straight corpus will be biased toward Creatures. To work around this, a train-time data processor is used to
24
 
25
  Two caveats here: a) we can no longer guarantee the model will ever see all input data and b) it will likely see redundant cards from underepresented groups and thus risks memorization. The latter one can be fixed with...
26
 
@@ -34,3 +52,7 @@ This technique also creates an intentional data leakage between input/output, wh
34
 
35
  - The model is still very bad at generating cards that follow the Magic "color pie" like other similar models
36
  - The card generations remains coherent even at high temperatures (1.5) which is new.
 
 
 
 
6
 
7
  A text generation model finetuned on Magic: The Gathering cards up to the Phyrexia: All Will Be One set (February 10, 2023). The base flan-t5-xl was finetuned for 1 "epoch" of card data using the LoRA technique in the PEFT library; this repo contains about 9M hyperparameters for the LoRA adapters.
8
 
9
+ This model has strong support for out-of-domain inputs, such as generating a card with the name "San Francisco" (all generations will be Lands) or generating cards based on real life people and objects (the flavor text will often take into account the subtext; be ethical!)
10
 
11
  ## Usage
12
 
13
+ It is very strongly recommended to use this Colab Notebook to generate from the model as it requires some preprocessing and postprocessing both to get the inputs/outputs into the correct format and to extract the generated results, in addition to handling edge cases such as various unicode dashes.
14
 
15
+ Example input:
16
+
17
+ ```
18
+ Write a Magic: The Gathering card with these characteristics: manaCost : [2][R]|text : Menace
19
+ Players can't gain life.
20
+ Whenever another creature enters the battlefield, Rampaging Ferocidon deals 1 damage to that creature's controller.
21
+ ```
22
+
23
+ Example output:
24
+
25
+ ```
26
+ name : Rampaging Ferocidon|manaCost : [2][R]|type : Creature — Dinosaur|rarity : rare|text : Menace
27
+ Players can't gain life.
28
+ Whenever another creature enters the battlefield, Rampaging Ferocidon deals 1 damage to that creature's controller.|flavorText : All raptors are aggressive, but ferocidons seem to enjoy their prey's pain.|ptl : 3/3
29
+ ```
30
+
31
+ The card encoding is somewhat unusual due to the constraints of the T5 SentencePiece tokenizer, which apparently does not contain the characters `{}~` commonly used to encode Magic cards for training AI.
32
+
33
+ The tokenizer also assumes a `\n` token is added to the default T5 tokenizer, as that is necessary for proper detokenization and the model was trained in that way. You can do this by adding `tokenizer.add_special_tokens({"additional_special_tokens": [AddedToken("\n")]})`
34
 
35
  ## Training Techniques
36
 
38
 
39
  ### Hierarchal Sampling
40
 
41
+ There are many, more Creature cards than any other types of cards in Magic, therefore any model trained on a straight corpus will be biased toward Creatures. To work around this, a train-time data processor is used to select cards from the types Creature, Instant, Enchantment, Sorcery, Artifact, Land, Planeswalker, all with equal probability.
42
 
43
  Two caveats here: a) we can no longer guarantee the model will ever see all input data and b) it will likely see redundant cards from underepresented groups and thus risks memorization. The latter one can be fixed with...
44
 
52
 
53
  - The model is still very bad at generating cards that follow the Magic "color pie" like other similar models
54
  - The card generations remains coherent even at high temperatures (1.5) which is new.
55
+
56
+ ## License
57
+
58
+ MIT