Update handler.py
Browse files- handler.py +7 -0
handler.py
CHANGED
|
@@ -7,6 +7,13 @@ class EndpointHandler:
|
|
| 7 |
# We point directly to the original weights
|
| 8 |
self.model_id = "zhihan1996/DNABERT-2-117M"
|
| 9 |
self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
self.model = AutoModel.from_pretrained(self.model_id, trust_remote_code=True)
|
| 11 |
if torch.cuda.is_available():
|
| 12 |
self.model = self.model.to("cuda")
|
|
|
|
| 7 |
# We point directly to the original weights
|
| 8 |
self.model_id = "zhihan1996/DNABERT-2-117M"
|
| 9 |
self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, trust_remote_code=True)
|
| 10 |
+
|
| 11 |
+
# --- FIX: Disable Flash Attention to avoid the Triton error ---
|
| 12 |
+
from transformers import AutoConfig
|
| 13 |
+
config = AutoConfig.from_pretrained(self.model_id, trust_remote_code=True)
|
| 14 |
+
config.use_flash_attn = False # This bypasses the broken line 114 code
|
| 15 |
+
# --------------------------------------------------------------
|
| 16 |
+
|
| 17 |
self.model = AutoModel.from_pretrained(self.model_id, trust_remote_code=True)
|
| 18 |
if torch.cuda.is_available():
|
| 19 |
self.model = self.model.to("cuda")
|