PRIYANSHUDHAKED
commited on
Commit
•
751d686
1
Parent(s):
3edf507
Update app.py
Browse files![IMG20240320212110.jpg](https://cdn-uploads.huggingface.co/production/uploads/6656113b61422fc897d3b77a/eleAM9OOedu1nj5NVFq6S.jpeg)
app.py
CHANGED
@@ -13,23 +13,14 @@ import re
|
|
13 |
import numpy as np
|
14 |
import datetime
|
15 |
import subprocess
|
16 |
-
|
17 |
# Ensure nltk punkt is downloaded
|
18 |
nltk.download('punkt')
|
19 |
|
20 |
-
# Configuration for quantization
|
21 |
-
quantization_config = BitsAndBytesConfig(
|
22 |
-
load_in_4bit=True,
|
23 |
-
bnb_4bit_compute_dtype=torch.float16
|
24 |
-
)
|
25 |
-
|
26 |
# Model ID
|
27 |
model_id = "llava-hf/llava-1.5-7b-hf"
|
28 |
|
29 |
-
# Load the pipeline
|
30 |
-
pipe = pipeline("image-to-text",
|
31 |
-
model=model_id,
|
32 |
-
model_kwargs={"quantization_config": quantization_config})
|
33 |
|
34 |
# Initialize Whisper model
|
35 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
13 |
import numpy as np
|
14 |
import datetime
|
15 |
import subprocess
|
|
|
16 |
# Ensure nltk punkt is downloaded
|
17 |
nltk.download('punkt')
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
# Model ID
|
20 |
model_id = "llava-hf/llava-1.5-7b-hf"
|
21 |
|
22 |
+
# Load the pipeline without GPU-dependent quantization
|
23 |
+
pipe = pipeline("image-to-text", model=model_id)
|
|
|
|
|
24 |
|
25 |
# Initialize Whisper model
|
26 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|