nikravan commited on
Commit
78a10a7
·
verified ·
1 Parent(s): 03037ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -36,6 +36,13 @@ h1 {
36
 
37
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
38
 
 
 
 
 
 
 
 
39
 
40
 
41
  def extract_text(path):
@@ -98,15 +105,7 @@ def mode_load(path):
98
 
99
  @spaces.GPU()
100
  def stream_chat(message, history: list, temperature: float, max_length: int, top_p: float, top_k: int, penalty: float):
101
- if history.size()==0:
102
- model = AutoModelForCausalLM.from_pretrained(
103
- MODEL_ID,
104
- torch_dtype=torch.bfloat16,
105
- low_cpu_mem_usage=True,
106
- trust_remote_code=True
107
- )
108
- model.eval()
109
- flag=True
110
 
111
 
112
 
 
36
 
37
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
38
 
39
+ model = AutoModelForCausalLM.from_pretrained(
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):
 
105
 
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