Update app.py
Browse files
app.py
CHANGED
|
@@ -15,17 +15,17 @@ model_path = "best.pt"
|
|
| 15 |
modelY = YOLO(model_path)
|
| 16 |
os.environ["TRANSFORMERS_CACHE"] = "./.cache"
|
| 17 |
cache_folder = "./.cache"
|
| 18 |
-
path = "OpenGVLab/InternVL2_5-
|
| 19 |
# Load the Hugging Face model and tokenizer globally (downloaded only once)
|
| 20 |
model = AutoModel.from_pretrained(
|
| 21 |
path,
|
| 22 |
cache_dir=cache_folder,
|
| 23 |
-
torch_dtype=torch.bfloat16,
|
| 24 |
-
load_in_8bit=True,
|
| 25 |
low_cpu_mem_usage=True,
|
| 26 |
use_flash_attn=True,
|
| 27 |
trust_remote_code=True
|
| 28 |
-
).eval()
|
| 29 |
|
| 30 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 31 |
path,
|
|
|
|
| 15 |
modelY = YOLO(model_path)
|
| 16 |
os.environ["TRANSFORMERS_CACHE"] = "./.cache"
|
| 17 |
cache_folder = "./.cache"
|
| 18 |
+
path = "OpenGVLab/InternVL2_5-2B"
|
| 19 |
# Load the Hugging Face model and tokenizer globally (downloaded only once)
|
| 20 |
model = AutoModel.from_pretrained(
|
| 21 |
path,
|
| 22 |
cache_dir=cache_folder,
|
| 23 |
+
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
|
| 24 |
+
# load_in_8bit=True,
|
| 25 |
low_cpu_mem_usage=True,
|
| 26 |
use_flash_attn=True,
|
| 27 |
trust_remote_code=True
|
| 28 |
+
).eval().cpu()
|
| 29 |
|
| 30 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 31 |
path,
|