[Error in of repo inference] ValueError: size must contain 'shortest_edge' and 'longest_edge' keys.

#8
by yuriivoievidka - opened

When I run the inference example it fails to load processor it fails with error

ValueError Traceback (most recent call last)
Cell In[4], line 1
----> 1 processor = AutoProcessor.from_pretrained("OS-Copilot/OS-Atlas-Base-7B")

File /venv/main/lib/python3.12/site-packages/transformers/models/auto/processing_auto.py:376, in AutoProcessor.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
372 return processor_class.from_pretrained(
373 pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
374 )
375 elif processor_class is not None:
--> 376 return processor_class.from_pretrained(
377 pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
378 )
379 # Last try: we use the PROCESSOR_MAPPING.
380 elif type(config) in PROCESSOR_MAPPING:

File /venv/main/lib/python3.12/site-packages/transformers/processing_utils.py:1185, in ProcessorMixin.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, **kwargs)
1182 if token is not None:
1183 kwargs["token"] = token
-> 1185 args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
1186 processor_dict, kwargs = cls.get_processor_dict(pretrained_model_name_or_path, **kwargs)
1187 return cls.from_args_and_dict(args, processor_dict, **kwargs)

File /venv/main/lib/python3.12/site-packages/transformers/processing_utils.py:1248, in ProcessorMixin._get_arguments_from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1245 else:
1246 attribute_class = cls.get_possibly_dynamic_module(class_name)
-> 1248 args.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))
1249 return args

File /venv/main/lib/python3.12/site-packages/transformers/models/auto/image_processing_auto.py:564, in AutoImageProcessor.from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
562 return image_processor_class.from_dict(config_dict, **kwargs)
563 elif image_processor_class is not None:
--> 564 return image_processor_class.from_dict(config_dict, **kwargs)
565 # Last try: we use the IMAGE_PROCESSOR_MAPPING.
566 elif type(config) in IMAGE_PROCESSOR_MAPPING:

File /venv/main/lib/python3.12/site-packages/transformers/image_processing_base.py:422, in ImageProcessingMixin.from_dict(cls, image_processor_dict, **kwargs)
419 if "crop_size" in kwargs and "crop_size" in image_processor_dict:
420 image_processor_dict["crop_size"] = kwargs.pop("crop_size")
--> 422 image_processor = cls(**image_processor_dict)
424 # Update image_processor with kwargs if needed
425 to_remove = []

File /venv/main/lib/python3.12/site-packages/transformers/models/qwen2_vl/image_processing_qwen2_vl.py:143, in Qwen2VLImageProcessor.init(self, do_resize, size, resample, do_rescale, rescale_factor, do_normalize, image_mean, image_std, do_convert_rgb, min_pixels, max_pixels, patch_size, temporal_patch_size, merge_size, **kwargs)
141 super().init(**kwargs)
142 if size is not None and ("shortest_edge" not in size or "longest_edge" not in size):
--> 143 raise ValueError("size must contain 'shortest_edge' and 'longest_edge' keys.")
144 else:
145 size = {"shortest_edge": 56 * 56, "longest_edge": 28 * 28 * 1280}

ValueError: size must contain 'shortest_edge' and 'longest_edge' keys.

Sign up or log in to comment