Upload infer_qwen2_vl.py with huggingface_hub
Browse files- infer_qwen2_vl.py +4 -4
infer_qwen2_vl.py
CHANGED
@@ -42,7 +42,7 @@ file_names = os.listdir(folder)
|
|
42 |
|
43 |
num_image = len(file_names)
|
44 |
|
45 |
-
begin, end, batch_size= 0,
|
46 |
print(f"beigin : {begin}, end : {end}, batch_size : {batch_size}")
|
47 |
messages = [
|
48 |
{
|
@@ -73,9 +73,9 @@ for batch_idx in tqdm(range(begin, end, batch_size)):
|
|
73 |
image_inputs_batch, video_inputs_batch,text_batch = [], [], []
|
74 |
for idx,i in enumerate(batch):
|
75 |
#img = batch[i]
|
76 |
-
print('gain image successfully !')
|
77 |
img_path = '/inspire/hdd/ws-ba572160-47f8-4ca1-984e-d6bcdeb95dbb/a100-maybe/albus/ICCV_2025/qvq/dataset/' + i
|
78 |
-
print(img_path)
|
79 |
messages[1]["content"][0]["image"] = '/inspire/hdd/ws-ba572160-47f8-4ca1-984e-d6bcdeb95dbb/a100-maybe/albus/ICCV_2025/qvq/dataset/' + i
|
80 |
text = processor.apply_chat_template(
|
81 |
messages, tokenize=False, add_generation_prompt=True
|
@@ -117,7 +117,7 @@ for batch_idx in tqdm(range(begin, end, batch_size)):
|
|
117 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
118 |
)
|
119 |
ans.append(output_text)
|
120 |
-
save_path = "
|
121 |
counter = counter + 1
|
122 |
if counter % 1 == 0:
|
123 |
print(f"Saving data at iteration {idx + 1}")
|
|
|
42 |
|
43 |
num_image = len(file_names)
|
44 |
|
45 |
+
begin, end, batch_size= 0, num_image, 4
|
46 |
print(f"beigin : {begin}, end : {end}, batch_size : {batch_size}")
|
47 |
messages = [
|
48 |
{
|
|
|
73 |
image_inputs_batch, video_inputs_batch,text_batch = [], [], []
|
74 |
for idx,i in enumerate(batch):
|
75 |
#img = batch[i]
|
76 |
+
#print('gain image successfully !')
|
77 |
img_path = '/inspire/hdd/ws-ba572160-47f8-4ca1-984e-d6bcdeb95dbb/a100-maybe/albus/ICCV_2025/qvq/dataset/' + i
|
78 |
+
#print(img_path)
|
79 |
messages[1]["content"][0]["image"] = '/inspire/hdd/ws-ba572160-47f8-4ca1-984e-d6bcdeb95dbb/a100-maybe/albus/ICCV_2025/qvq/dataset/' + i
|
80 |
text = processor.apply_chat_template(
|
81 |
messages, tokenize=False, add_generation_prompt=True
|
|
|
117 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
118 |
)
|
119 |
ans.append(output_text)
|
120 |
+
save_path = "output_final.json"
|
121 |
counter = counter + 1
|
122 |
if counter % 1 == 0:
|
123 |
print(f"Saving data at iteration {idx + 1}")
|