khang119966
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -178,19 +178,21 @@ def load_image(image_file, input_size=448, max_num=12):
|
|
178 |
return pixel_values
|
179 |
|
180 |
model = AutoModel.from_pretrained(
|
181 |
-
"5CD-AI/Vintern-1B-
|
182 |
torch_dtype=torch.bfloat16,
|
183 |
low_cpu_mem_usage=True,
|
184 |
trust_remote_code=True,
|
|
|
185 |
).eval().cuda()
|
186 |
-
|
|
|
187 |
|
188 |
test_image = 'test-image.jpg'
|
189 |
|
190 |
-
pixel_values = load_image(test_image, max_num=
|
191 |
generation_config = dict(max_new_tokens= 1024, do_sample=False, num_beams = 3, repetition_penalty=2.5)
|
192 |
|
193 |
-
question = '<image>\
|
194 |
|
195 |
response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
|
196 |
print(f'User: {question}\nAssistant: {response}')
|
|
|
178 |
return pixel_values
|
179 |
|
180 |
model = AutoModel.from_pretrained(
|
181 |
+
"5CD-AI/Vintern-1B-v3_5",
|
182 |
torch_dtype=torch.bfloat16,
|
183 |
low_cpu_mem_usage=True,
|
184 |
trust_remote_code=True,
|
185 |
+
use_flash_attn=False,
|
186 |
).eval().cuda()
|
187 |
+
|
188 |
+
tokenizer = AutoTokenizer.from_pretrained("5CD-AI/Vintern-1B-v3_5", trust_remote_code=True, use_fast=False)
|
189 |
|
190 |
test_image = 'test-image.jpg'
|
191 |
|
192 |
+
pixel_values = load_image(test_image, max_num=6).to(torch.bfloat16).cuda()
|
193 |
generation_config = dict(max_new_tokens= 1024, do_sample=False, num_beams = 3, repetition_penalty=2.5)
|
194 |
|
195 |
+
question = '<image>\nTrích xuất thông tin chính trong ảnh và trả về dạng markdown.'
|
196 |
|
197 |
response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
|
198 |
print(f'User: {question}\nAssistant: {response}')
|