Ammah commited on
Commit
07619da
1 Parent(s): c4f01c6

add gigax npc-llm-3_8B model in gguf format

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +141 -0
  3. npc-llm-3_8B.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ ---
6
+ # NPC Model
7
+
8
+ This repo contains the domain-specific NPC model we've fined-tuned from **Phi-3**, using LoRA.
9
+
10
+ This model parses a text description of a game scene, and outputs commands like:
11
+ * `say <player1> "Hello Adventurer, care to join me on a quest?`
12
+ * `greet <player1>`
13
+ * `attack <player1>`
14
+ * Any other `<action> <param>` you add to the prompt! (We call these "skills"!)
15
+
16
+
17
+ ⚠️ This model has been trained to **overfit** on our input prompt format. Follow it closely to reach optimal performance ⚠️
18
+
19
+
20
+ ## Usage
21
+
22
+ **Make your life easier, use our [Python client library](https://github.com/GigaxGames/gigax)**
23
+
24
+ * Instantiating the model using outlines:
25
+ ```py
26
+ from outlines import models
27
+ from gigax.step import NPCStepper
28
+ from llama_cpp import Llama
29
+
30
+ # Download model from the Hugging Face Gigax Hub before run this code
31
+
32
+ # Our stepper takes in a Outlines model to enable guided generation
33
+ # This forces the model to follow our output format
34
+ model = Llama(
35
+ model_path="./path/to/model/npc-llm-3_8B.gguf",
36
+ # n_gpu_layers=-1, # Uncomment to use GPU acceleration
37
+ )
38
+
39
+ # Instantiate a stepper: handles prompting + output parsing
40
+ stepper = NPCStepper(model=model)
41
+ ```
42
+
43
+ * Calling the model on your game's data:
44
+
45
+ ```py
46
+ from gigax.parse import CharacterAction
47
+ from gigax.scene import (
48
+ Character,
49
+ Item,
50
+ Location,
51
+ ProtagonistCharacter,
52
+ ProtagonistCharacter,
53
+ Skill,
54
+ ParameterType,
55
+ )
56
+ # Use sample data
57
+ current_location = Location(name="Old Town", description="A quiet and peaceful town.")
58
+ NPCs = [
59
+ Character(
60
+ name="John the Brave",
61
+ description="A fearless warrior",
62
+ current_location=current_location,
63
+ )
64
+ ]
65
+ protagonist = ProtagonistCharacter(
66
+ name="Aldren",
67
+ description="Brave and curious",
68
+ current_location=current_location,
69
+ memories=["Saved the village", "Lost a friend"],
70
+ quests=["Find the ancient artifact", "Defeat the evil warlock"],
71
+ skills=[
72
+ Skill(
73
+ name="Attack",
74
+ description="Deliver a powerful blow",
75
+ parameter_types=[ParameterType.character],
76
+ )
77
+ ],
78
+ psychological_profile="Determined and compassionate",
79
+ )
80
+ items = [Item(name="Sword", description="A sharp blade")]
81
+ events = [
82
+ CharacterAction(
83
+ command="Say",
84
+ protagonist=protagonist,
85
+ parameters=[items[0], "What a fine sword!"],
86
+ )
87
+ ]
88
+
89
+ action = stepper.get_action(
90
+ context=context,
91
+ locations=locations,
92
+ NPCs=NPCs,
93
+ protagonist=protagonist,
94
+ items=items,
95
+ events=events,
96
+ )
97
+ ```
98
+
99
+ ## Input prompt
100
+
101
+ Here's a sample input prompt, showing you the format on which the model has been trained:
102
+ ```txt
103
+ - WORLD KNOWLEDGE: A vast open world full of mystery and adventure.
104
+ - KNOWN LOCATIONS: Old Town
105
+ - NPCS: John the Brave
106
+ - CURRENT LOCATION: Old Town: A quiet and peaceful town.
107
+ - CURRENT LOCATION ITEMS: Sword
108
+ - LAST EVENTS:
109
+ Aldren: Say Sword What a fine sword!
110
+ - PROTAGONIST NAME: Aldren
111
+ - PROTAGONIST PSYCHOLOGICAL PROFILE: Brave and curious
112
+ - PROTAGONIST MEMORIES:
113
+ Saved the village
114
+ Lost a friend
115
+ - PROTAGONIST PENDING QUESTS:
116
+ Find the ancient artifact
117
+ Defeat the evil warlock
118
+ - PROTAGONIST ALLOWED ACTIONS:
119
+ Attack <character> : Deliver a powerful blow
120
+ Aldren:
121
+ ```
122
+
123
+ ### 🤗 We are currently working hard on training on the latest SoTA models (Phi-3, LLama, etc.), and on better data ! 🤗
124
+
125
+
126
+ ## Model info
127
+
128
+ - **Developed by:** Gigax
129
+ - **Language(s) (NLP):** English
130
+ - **Finetuned from model [optional]:** [Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct)
131
+ - **Contact:** Join our [Discord](https://discord.gg/xES2Z8X4J6) for info, help, and more!
132
+
133
+ ## How to Cite
134
+
135
+ ```bibtex
136
+ @misc{NPC-LLM-3_8B,
137
+ url={[https://huggingface.co/Gigax/NPC-LLM-7B](https://huggingface.co/Gigax/NPC-LLM-3_8B)},
138
+ title={NPC-LLM-3_8B},
139
+ author={Gigax team}
140
+ }
141
+ ```
npc-llm-3_8B.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0524856a51fe249c8f7a2263164aba9e24d5f69d2f5987070d939ad6e673a3d1
3
+ size 7643295968