Update README.md
Browse files
README.md
CHANGED
@@ -43,6 +43,7 @@ from transformers import (
|
|
43 |
)
|
44 |
|
45 |
|
|
|
46 |
model_id = "Ertugrul/Qwen2.5-VL-7B-Captioner-Relaxed"
|
47 |
image_path = "path/to/your/image.jpg"
|
48 |
|
@@ -57,6 +58,30 @@ model = AutoModelForImageTextToText.from_pretrained(
|
|
57 |
attn_implementation="flash_attention_2", # Use "flash_attention_2" when running on Ampere or newer GPU or use "eager" for older GPUs
|
58 |
)
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
# you can change the min and max pixels to fit your needs to decrease compute cost to trade off quality
|
61 |
min_pixels = 256*28*28
|
62 |
max_pixels = 1280*28*28
|
|
|
43 |
)
|
44 |
|
45 |
|
46 |
+
|
47 |
model_id = "Ertugrul/Qwen2.5-VL-7B-Captioner-Relaxed"
|
48 |
image_path = "path/to/your/image.jpg"
|
49 |
|
|
|
58 |
attn_implementation="flash_attention_2", # Use "flash_attention_2" when running on Ampere or newer GPU or use "eager" for older GPUs
|
59 |
)
|
60 |
|
61 |
+
|
62 |
+
#### For lower precision less than 12GB VRAM ####
|
63 |
+
|
64 |
+
# Configure 4-bit quantization using BitsAndBytesConfig
|
65 |
+
|
66 |
+
#from transformers import BitsAndBytesConfig
|
67 |
+
|
68 |
+
# quantization_config = BitsAndBytesConfig(
|
69 |
+
# load_in_4bit=True,
|
70 |
+
# bnb_4bit_use_double_quant=True,
|
71 |
+
# bnb_4bit_quant_type="nf4",
|
72 |
+
# bnb_4bit_compute_dtype=torch.bfloat16,
|
73 |
+
# bnb_4bit_quant_storage=torch.bfloat16,
|
74 |
+
# )
|
75 |
+
# model = AutoModelForImageTextToText.from_pretrained(
|
76 |
+
# model_id,
|
77 |
+
# device_map="auto",
|
78 |
+
# torch_dtype=torch.bfloat16,
|
79 |
+
# attn_implementation="flash_attention_2", # Use "flash_attention_2" when running on Ampere or newer GPU or use "eager" for older GPUs
|
80 |
+
# quantization_config=quantization_config, # Use BitsAndBytesConfig instead of load_in_4bit
|
81 |
+
# )
|
82 |
+
|
83 |
+
########################################################################
|
84 |
+
|
85 |
# you can change the min and max pixels to fit your needs to decrease compute cost to trade off quality
|
86 |
min_pixels = 256*28*28
|
87 |
max_pixels = 1280*28*28
|