Update app.py
Browse files
app.py
CHANGED
@@ -36,13 +36,7 @@ h1 {
|
|
36 |
|
37 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
38 |
|
39 |
-
|
40 |
-
MODEL_ID,
|
41 |
-
torch_dtype=torch.bfloat16,
|
42 |
-
low_cpu_mem_usage=True,
|
43 |
-
trust_remote_code=True
|
44 |
-
)
|
45 |
-
|
46 |
|
47 |
|
48 |
def extract_text(path):
|
@@ -106,7 +100,14 @@ def mode_load(path):
|
|
106 |
@spaces.GPU()
|
107 |
def stream_chat(message, history: list, temperature: float, max_length: int, top_p: float, top_k: int, penalty: float):
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
|
112 |
print(f'message is - {message}')
|
|
|
36 |
|
37 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
38 |
|
39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
|
42 |
def extract_text(path):
|
|
|
100 |
@spaces.GPU()
|
101 |
def stream_chat(message, history: list, temperature: float, max_length: int, top_p: float, top_k: int, penalty: float):
|
102 |
|
103 |
+
if history.len()==0:
|
104 |
+
model = AutoModelForCausalLM.from_pretrained(
|
105 |
+
MODEL_ID,
|
106 |
+
torch_dtype=torch.bfloat16,
|
107 |
+
low_cpu_mem_usage=True,
|
108 |
+
trust_remote_code=True
|
109 |
+
)
|
110 |
+
|
111 |
|
112 |
|
113 |
print(f'message is - {message}')
|