Spaces:
Runtime error
Runtime error
JuliaUpton
commited on
Commit
•
bcf57b7
1
Parent(s):
9ff922d
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import AutoTokenizer
|
3 |
-
from mixtrl import MixtralConfig, MixtralForCausalLM
|
4 |
from peft import PeftModel
|
5 |
|
6 |
# Load the tokenizer and model
|
7 |
model_name = "JuliaUpton/Math_AI"
|
8 |
model_architecture = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
9 |
mixtral_tokenizer = AutoTokenizer.from_pretrained(model_architecture)
|
10 |
-
mixtral_config =
|
11 |
-
merged_model = PeftModel.from_pretrained(model_name, model=
|
12 |
|
13 |
# Define the input formatting function
|
14 |
def input_from_text(instruction):
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
|
|
|
3 |
from peft import PeftModel
|
4 |
|
5 |
# Load the tokenizer and model
|
6 |
model_name = "JuliaUpton/Math_AI"
|
7 |
model_architecture = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
8 |
mixtral_tokenizer = AutoTokenizer.from_pretrained(model_architecture)
|
9 |
+
mixtral_config = AutoConfig.from_pretrained(model_architecture, trust_remote_code=True)
|
10 |
+
merged_model = PeftModel.from_pretrained(model_name, model=AutoModelForCausalLM.from_pretrained(model_architecture, config=mixtral_config, trust_remote_code=True, device_map="auto"))
|
11 |
|
12 |
# Define the input formatting function
|
13 |
def input_from_text(instruction):
|