Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from outlines import models
|
2 |
+
from gigax.step import NPCStepper
|
3 |
+
|
4 |
+
# Download model from the Hub
|
5 |
+
model_name = "Gigax/NPC-LLM-7B"
|
6 |
+
llm = AutoModelForCausalLM.from_pretrained(model_name)
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
+
|
9 |
+
# Our stepper takes in a Outlines model to enable guided generation
|
10 |
+
# This forces the model to follow our output format
|
11 |
+
model = models.Transformers(llm, tokenizer)
|
12 |
+
|
13 |
+
# Instantiate a stepper: handles prompting + output parsing
|
14 |
+
stepper = NPCStepper(model=model)
|