Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ from transformers import AutoModelForCausalLM, AutoProcessor
|
|
| 16 |
from PIL import Image
|
| 17 |
import requests
|
| 18 |
import os
|
| 19 |
-
os.system('pip install -U flash-attn')
|
| 20 |
model_id = "yifeihu/TB-OCR-preview-0.1"
|
| 21 |
|
| 22 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
@@ -29,7 +29,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 29 |
device_map=DEVICE,
|
| 30 |
trust_remote_code=True,
|
| 31 |
torch_dtype="auto",
|
| 32 |
-
_attn_implementation='flash_attention_2',
|
| 33 |
#load_in_4bit=True # Optional: Load model in 4-bit mode to save memory
|
| 34 |
)
|
| 35 |
|
|
|
|
| 16 |
from PIL import Image
|
| 17 |
import requests
|
| 18 |
import os
|
| 19 |
+
# os.system('pip install -U flash-attn')
|
| 20 |
model_id = "yifeihu/TB-OCR-preview-0.1"
|
| 21 |
|
| 22 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 29 |
device_map=DEVICE,
|
| 30 |
trust_remote_code=True,
|
| 31 |
torch_dtype="auto",
|
| 32 |
+
# _attn_implementation='flash_attention_2',
|
| 33 |
#load_in_4bit=True # Optional: Load model in 4-bit mode to save memory
|
| 34 |
)
|
| 35 |
|