luckyhzt / unicolor

This is the implementation of paper: "UniColor: A Unified Framework for Multi-Modal Colorization with Transformer"
56 stars 9 forks source link

Loading mscoco_step259999.ckpt Model failed. #2

Open LiquidAmmonia opened 1 year ago

LiquidAmmonia commented 1 year ago

After downloading the mscoco_step259999.ckpt file as described, the transformer model could not be loaded.

It there something wrong with the released HuggingFace model or the config.yaml file?

Here is the printed error.

image
luckyhzt commented 1 year ago

I tried with my our PC, it works well. The issue may be caused by pytorch_lightning, you should use exactly the version ''pytorch-lightning==1.3.7.post0''. Or you may try to load the model directly with PyTorch.

Best, Zhitong

Yean Cheng @.***> 于2022年12月28日周三 20:02写道:

After downloading the mscoco_step259999.ckpt file as described, the transformer model could not be loaded.

It there something wrong with the released HuggingFace model or the config.yaml file?

Here is the printed error. [image: image] https://user-images.githubusercontent.com/35828555/209809062-5b977fae-eb91-4fb9-95b0-d8e7f5e74ce7.png

— Reply to this email directly, view it on GitHub https://github.com/luckyhzt/unicolor/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNBWKI5O6C7JAWLV2CNRVTWPQT3ZANCNFSM6AAAAAATLGN5VI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

myname1111 commented 1 year ago

Hello, I attempted to run your model on google colab and have encountered a similar error. I am using the conda environment that has the correct version installed, however I am still getting the error, why?

Here is the link to the google colab. https://colab.research.google.com/drive/1c8hrdZwTXIfDwmJWBu2qvL0sdaXLbAr4?usp=sharing

Something to note is when I manually installed the dependencies instead of using the conda environment, there is a different error when I used the correct version and the same error when using the incorrect version Actually after fixing that error I still get the same pickle error as I am getting here

Here is the error message

/content/unicolor/sample/ImageMatch/lib/functional.py:193: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
  def resize(img, size, interpolation=Image.BILINEAR):
/content/unicolor/sample/ImageMatch/lib/functional.py:295: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
  def resized_crop(img, i, j, h, w, size, interpolation=Image.BILINEAR):
/content/unicolor/sample/ImageMatch/lib/TestTransforms.py:185: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
  def __init__(self, size, interpolation=Image.BILINEAR):
/usr/local/envs/unicolor/lib/python3.7/site-packages/skimage/io/collection.py:15: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(pil_version) < LooseVersion('7.1.0'):
/usr/local/envs/unicolor/lib/python3.7/site-packages/skimage/io/collection.py:15: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(pil_version) < LooseVersion('7.1.0'):
100%|████████████████████████████████████████| 338M/338M [00:01<00:00, 294MiB/s]
/usr/local/envs/unicolor/lib/python3.7/site-packages/pytorch_lightning/metrics/__init__.py:44: LightningDeprecationWarning: `pytorch_lightning.metrics.*` module has been renamed to `torchmetrics.*` and split off to its own package (https://github.com/PyTorchLightning/metrics) since v1.3 and will be removed in v1.5
  "`pytorch_lightning.metrics.*` module has been renamed to `torchmetrics.*` and split off to its own package"
/usr/local/envs/unicolor/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py:5: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  tensorboard.__version__
/usr/local/envs/unicolor/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py:6: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  ) < LooseVersion("1.15"):
Traceback (most recent call last):
  File "<stdin>", line 11, in <module>
  File "/content/unicolor/sample/colorizer.py", line 39, in __init__
    self.load_model(load_clip, load_warper)
  File "/content/unicolor/sample/colorizer.py", line 59, in load_model
    self.transformer = load_model(model, self.ckpt_path, self.ckpt_file).to(self.device).eval().requires_grad_(False)
  File "/content/unicolor/sample/utils_func.py", line 31, in load_model
    strict=True
  File "/usr/local/envs/unicolor/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 135, in load_from_checkpoint
    checkpoint = pl_load(checkpoint_path, map_location=lambda storage, loc: storage)
  File "/usr/local/envs/unicolor/lib/python3.7/site-packages/pytorch_lightning/utilities/cloud_io.py", line 33, in load
    return torch.load(f, map_location=map_location)
  File "/usr/local/envs/unicolor/lib/python3.7/site-packages/torch/serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/envs/unicolor/lib/python3.7/site-packages/torch/serialization.py", line 1002, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.
myname1111 commented 1 year ago

Okay I solved it. Check if you download the actual model instead of the HTML of the page

solarlemon commented 6 months ago

Okay I solved it. Check if you download the actual model instead of the HTML of the page

Hello, I'm also trying to do this kind of work, attempting to run models on Google Colab. Could you share some code or experience?

myname1111 commented 6 months ago

Well, for me, when I tried to download the model, I actually downloaded the HTML page for the model download site. If you think this is the case, please manually check the file you think is the model file with any text editor that is able to handle it and see if it's the model rather than something else. If it's the model, it should look like a random string of bits and bytes