huggingface/notebooks

Image similarity with YOLO family

Alberto1404 opened this issue · 0 comments

Hello all,
I wanted to follow the image similarity notebook but using a finetuned Yolov5x model in a private dataset. #270 comments about reading an Automodel object. I attempted to read the best.pt generated via transformers.Automodel but I got the following error:

Traceback (most recent call last):
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/configuration_utils.py", line 659, in _get_config_dict
    config_dict = cls._dict_from_json_file(resolved_config_file)
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/configuration_utils.py", line 750, in _dict_from_json_file
    text = reader.read()
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 444, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 928, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/configuration_utils.py", line 574, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/alberto/anaconda3/envs/detr/lib/python3.10/site-packages/transformers/configuration_utils.py", line 662, in _get_config_dict
    raise EnvironmentError(
OSError: It looks like the config file at '/home/alberto/Repo/yolov5/ptz/baseline2/weights/epoch190.pt' is not a valid JSON file.

Regarding the feature extractor, I am still facing issues in how to get the backbone. If any of you have any ideas, please share.
Thank you for your time.