Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ h1 {
|
|
| 33 |
}
|
| 34 |
"""
|
| 35 |
|
| 36 |
-
|
| 37 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 38 |
|
| 39 |
|
|
@@ -99,12 +99,15 @@ def mode_load(path):
|
|
| 99 |
@spaces.GPU()
|
| 100 |
|
| 101 |
def stream_chat(message, history: list, temperature: float, max_length: int, top_p: float, top_k: int, penalty: float):
|
| 102 |
-
model
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
print(f'message is - {message}')
|
| 110 |
print(f'history is - {history}')
|
|
|
|
| 33 |
}
|
| 34 |
"""
|
| 35 |
|
| 36 |
+
model=""
|
| 37 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 38 |
|
| 39 |
|
|
|
|
| 99 |
@spaces.GPU()
|
| 100 |
|
| 101 |
def stream_chat(message, history: list, temperature: float, max_length: int, top_p: float, top_k: int, penalty: float):
|
| 102 |
+
if model=="":
|
| 103 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 104 |
+
MODEL_ID,
|
| 105 |
+
torch_dtype=torch.bfloat16,
|
| 106 |
+
low_cpu_mem_usage=True,
|
| 107 |
+
trust_remote_code=True
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
|
| 112 |
print(f'message is - {message}')
|
| 113 |
print(f'history is - {history}')
|