Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,14 @@ import gradio as gr
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
3 |
from peft import PeftModel
|
4 |
import torch
|
|
|
5 |
|
6 |
"""
|
7 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
8 |
"""
|
9 |
|
10 |
# Set your model and adapter paths
|
|
|
11 |
BASE_MODEL = "mistralai/Mistral-7B-v0.1"
|
12 |
PEFT_ADAPTER = "asdc/Mistral-7B-multilingual-temporal-expression-normalization"
|
13 |
|
@@ -16,6 +18,7 @@ base_model = AutoModelForCausalLM.from_pretrained(
|
|
16 |
BASE_MODEL,
|
17 |
torch_dtype=torch.float16,
|
18 |
device_map="auto"
|
|
|
19 |
)
|
20 |
|
21 |
model = PeftModel.from_pretrained(base_model, PEFT_ADAPTER)
|
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
3 |
from peft import PeftModel
|
4 |
import torch
|
5 |
+
import os
|
6 |
|
7 |
"""
|
8 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
9 |
"""
|
10 |
|
11 |
# Set your model and adapter paths
|
12 |
+
API_KEY = os.environ.get("ACESS_TOKEN")
|
13 |
BASE_MODEL = "mistralai/Mistral-7B-v0.1"
|
14 |
PEFT_ADAPTER = "asdc/Mistral-7B-multilingual-temporal-expression-normalization"
|
15 |
|
|
|
18 |
BASE_MODEL,
|
19 |
torch_dtype=torch.float16,
|
20 |
device_map="auto"
|
21 |
+
token=API_KEY
|
22 |
)
|
23 |
|
24 |
model = PeftModel.from_pretrained(base_model, PEFT_ADAPTER)
|