Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,11 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStream
|
|
11 |
MAX_MAX_NEW_TOKENS = 2048
|
12 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
|
|
|
14 |
|
15 |
def load_model():
|
|
|
16 |
model_id = "stabilityai/ar-stablelm-2-chat"
|
17 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
18 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
|
|
11 |
MAX_MAX_NEW_TOKENS = 2048
|
12 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
14 |
+
model = None
|
15 |
+
tokenizer = None
|
16 |
|
17 |
def load_model():
|
18 |
+
global model, tokenizer
|
19 |
model_id = "stabilityai/ar-stablelm-2-chat"
|
20 |
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|