Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
-
from transformers import
|
|
|
|
| 3 |
from peft import PeftModel, PeftConfig
|
| 4 |
|
| 5 |
# Initialize FastAPI app
|
|
@@ -10,10 +11,11 @@ config = PeftConfig.from_pretrained("frankmorales2020/Mistral-7B-text-to-sql-fla
|
|
| 10 |
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")
|
| 11 |
model = PeftModel.from_pretrained(base_model, "frankmorales2020/Mistral-7B-text-to-sql-flash-attention-2-dataeval")
|
| 12 |
|
| 13 |
-
# Load tokenizer
|
| 14 |
-
tokenizer =
|
| 15 |
|
| 16 |
# Create the pipeline
|
|
|
|
| 17 |
pipe = pipeline("text2sql", model=model, tokenizer=tokenizer)
|
| 18 |
|
| 19 |
@app.get("/")
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from transformers import AutoModelForCausalLM
|
| 3 |
+
from mistral_common import MistralTokenizer # Hypothetical package, adjust based on actual package name and usage
|
| 4 |
from peft import PeftModel, PeftConfig
|
| 5 |
|
| 6 |
# Initialize FastAPI app
|
|
|
|
| 11 |
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")
|
| 12 |
model = PeftModel.from_pretrained(base_model, "frankmorales2020/Mistral-7B-text-to-sql-flash-attention-2-dataeval")
|
| 13 |
|
| 14 |
+
# Load recommended tokenizer
|
| 15 |
+
tokenizer = MistralTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")
|
| 16 |
|
| 17 |
# Create the pipeline
|
| 18 |
+
from transformers import pipeline
|
| 19 |
pipe = pipeline("text2sql", model=model, tokenizer=tokenizer)
|
| 20 |
|
| 21 |
@app.get("/")
|