SourceChangeWarning errors: What specific versions of python, torch, torchvision and torchtext were used? #9

Open
opened 2021-06-16 18:51:00 +02:00 by leestar · 2 comments
leestar commented 2021-06-16 18:51:00 +02:00 (Migrated from github.com)

I'm trying to test the trained model using test_one_image.py as instructed in the README, but am running into the following errors. I'm using Python 3.7.10, Pytorch 1.8.1+cu101 , torchvision 0.9.1+cu101, and torchtext 0.9.1. What versions of all the libraries were used to train the model? And how do I forward port the model?

/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Saved a reverse patch to DataParallel.patch. Run `patch -p0 < DataParallel.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Saved a reverse patch to Conv2d.patch. Run `patch -p0 < Conv2d.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Saved a reverse patch to BatchNorm2d.patch. Run `patch -p0 < BatchNorm2d.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Saved a reverse patch to PReLU.patch. Run `patch -p0 < PReLU.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Saved a reverse patch to MaxPool2d.patch. Run `patch -p0 < MaxPool2d.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Saved a reverse patch to Sequential.patch. Run `patch -p0 < Sequential.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Saved a reverse patch to AdaptiveAvgPool2d.patch. Run `patch -p0 < AdaptiveAvgPool2d.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Saved a reverse patch to Linear.patch. Run `patch -p0 < Linear.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Saved a reverse patch to Sigmoid.patch. Run `patch -p0 < Sigmoid.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Saved a reverse patch to Dropout.patch. Run `patch -p0 < Dropout.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
/usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Saved a reverse patch to BatchNorm1d.patch. Run `patch -p0 < BatchNorm1d.patch` to revert your changes.
  warnings.warn(msg, SourceChangeWarning)
Traceback (most recent call last):
  File "test_one_image.py", line 35, in <module>
    model = create_model(opt)
  File "/content/SimSwap/models/models.py", line 18, in create_model
    model.initialize(opt)
  File "/content/SimSwap/models/fs_model.py", line 64, in initialize
    netArc_checkpoint = torch.load(netArc_checkpoint)
  File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 585, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 772, in _legacy_load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 1918589 more bytes. The file might be corrupted.
I'm trying to test the trained model using test_one_image.py as instructed in the README, but am running into the following errors. I'm using Python 3.7.10, Pytorch 1.8.1+cu101 , torchvision 0.9.1+cu101, and torchtext 0.9.1. What versions of all the libraries were used to train the model? And how do I forward port the model? ``` /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Saved a reverse patch to DataParallel.patch. Run `patch -p0 < DataParallel.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Saved a reverse patch to Conv2d.patch. Run `patch -p0 < Conv2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Saved a reverse patch to BatchNorm2d.patch. Run `patch -p0 < BatchNorm2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Saved a reverse patch to PReLU.patch. Run `patch -p0 < PReLU.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Saved a reverse patch to MaxPool2d.patch. Run `patch -p0 < MaxPool2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Saved a reverse patch to Sequential.patch. Run `patch -p0 < Sequential.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Saved a reverse patch to AdaptiveAvgPool2d.patch. Run `patch -p0 < AdaptiveAvgPool2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Saved a reverse patch to Linear.patch. Run `patch -p0 < Linear.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Saved a reverse patch to Sigmoid.patch. Run `patch -p0 < Sigmoid.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Saved a reverse patch to Dropout.patch. Run `patch -p0 < Dropout.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python3.7/dist-packages/torch/serialization.py:649: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Saved a reverse patch to BatchNorm1d.patch. Run `patch -p0 < BatchNorm1d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "test_one_image.py", line 35, in <module> model = create_model(opt) File "/content/SimSwap/models/models.py", line 18, in create_model model.initialize(opt) File "/content/SimSwap/models/fs_model.py", line 64, in initialize netArc_checkpoint = torch.load(netArc_checkpoint) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 585, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 772, in _legacy_load deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly) RuntimeError: unexpected EOF, expected 1918589 more bytes. The file might be corrupted. ```
NNNNAI commented 2021-06-17 15:47:26 +02:00 (Migrated from github.com)

Sorry for the late reply, I tried to use the same environment as yours for testing, but currently I cannot find the pytorch 1.8.1 and cuda10.1 versions on the pytorch official website, so I used the pytorch1.8.0 and cuda10.2 versions, I used the following command to install the environment:

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch
pip install opencv_python

I use the default command line for inference and no bug was reported.

python test_one_image.py --isTrain false  --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path crop_224/6.jpg --pic_b_path crop_224/ds.jpg --output_path output/

Can you share your test command line? Many thanks~

Sorry for the late reply, I tried to use the same environment as yours for testing, but currently I cannot find the pytorch 1.8.1 and cuda10.1 versions on the pytorch official website, so I used the pytorch1.8.0 and cuda10.2 versions, I used the following command to install the environment: ``` conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch pip install opencv_python ``` I use the default command line for inference and no bug was reported. ``` python test_one_image.py --isTrain false --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path crop_224/6.jpg --pic_b_path crop_224/ds.jpg --output_path output/ ``` Can you share your test command line? Many thanks~
ljnhahaha commented 2021-10-29 07:06:16 +02:00 (Migrated from github.com)

I have the same problems. Did you solve them? @leestar

I have the same problems. Did you solve them? @leestar
Sign in to join this conversation.