hughtayloe
commited on
Commit
•
f496fb3
1
Parent(s):
1adb99d
Update handler.py
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from typing import Dict, Any
|
2 |
from PIL import Image
|
3 |
import requests
|
|
|
4 |
import torch
|
5 |
import numpy as np
|
6 |
from transformers import AutoProcessor, LlavaForConditionalGeneration, BitsAndBytesConfig
|
@@ -13,7 +14,7 @@ class EndpointHandler():
|
|
13 |
model_id,
|
14 |
torch_dtype=torch.float16,
|
15 |
low_cpu_mem_usage=True,
|
16 |
-
|
17 |
)
|
18 |
self.processor = AutoProcessor.from_pretrained(model_id)
|
19 |
|
|
|
1 |
from typing import Dict, Any
|
2 |
from PIL import Image
|
3 |
import requests
|
4 |
+
import flash-attn
|
5 |
import torch
|
6 |
import numpy as np
|
7 |
from transformers import AutoProcessor, LlavaForConditionalGeneration, BitsAndBytesConfig
|
|
|
14 |
model_id,
|
15 |
torch_dtype=torch.float16,
|
16 |
low_cpu_mem_usage=True,
|
17 |
+
use_flash_attention_2=True
|
18 |
)
|
19 |
self.processor = AutoProcessor.from_pretrained(model_id)
|
20 |
|