Skydata001 commited on
Commit
0e4358b
·
verified ·
1 Parent(s): 965e080

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -19,7 +19,8 @@ model = AutoModelForCausalLM.from_pretrained(
19
  model_name,
20
  dtype=torch.bfloat16,
21
  device_map="auto",
22
- trust_remote_code=True
 
23
  )
24
 
25
  pipe = pipeline(
@@ -157,7 +158,11 @@ Explain your reasoning step-by-step in a clear forensic report.
157
  ]
158
 
159
  prompt = tokenizer.apply_chat_template(messages, tokenize=False)
160
- response = pipe(prompt)[0]['generated_text']
 
 
 
 
161
  agent_answer = response.split("assistant")[-1].strip()
162
 
163
  discord_match = re.search(r'discord\.(gg|com/invite)/\S+', agent_answer, re.IGNORECASE)
 
19
  model_name,
20
  dtype=torch.bfloat16,
21
  device_map="auto",
22
+ trust_remote_code=True,
23
+ attn_implementation="eager" # تجنب مشاكل flash-attention
24
  )
25
 
26
  pipe = pipeline(
 
158
  ]
159
 
160
  prompt = tokenizer.apply_chat_template(messages, tokenize=False)
161
+
162
+ # ========== هنا الإصلاح الجذري: إضافة use_cache=False ==========
163
+ response = pipe(prompt, use_cache=False)[0]['generated_text']
164
+ # ================================================================
165
+
166
  agent_answer = response.split("assistant")[-1].strip()
167
 
168
  discord_match = re.search(r'discord\.(gg|com/invite)/\S+', agent_answer, re.IGNORECASE)