Code Monkey home page Code Monkey logo

scadn's Issues

inplace operation

博主您好,我在train的时候,遇见些问题,他报错:
Traceback (most recent call last):
File "main.py", line 146, in
main()
File "main.py", line 51, in main
model.train()
File "/root/autodl-tmp/project/src/experiments.py", line 76, in train
self.inpaint_model.backward(gen_loss, dis_loss)
File "/root/autodl-tmp/project/src/models.py", line 175, in backward
gen_loss.backward()
File "/root/miniconda3/lib/python3.8/site-packages/torch/_tensor.py", line 363, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/autograd/init.py", line 173, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 3; expected version 2 instead.
我采用异常跟踪,给我报:
/root/miniconda3/lib/python3.8/site-packages/torch/autograd/init.py:173: UserWarning: Error detected in DivBackward0. Traceback of forward call that caused the error:
File "main.py", line 146, in
main()
File "main.py", line 51, in main
model.train()
File "/root/autodl-tmp/project/src/experiments.py", line 73, in train
outputs, gen_loss, dis_loss, logs = self.inpaint_model.process(images, masks)
File "/root/autodl-tmp/project/src/models.py", line 124, in process
gen_fake, gen_fake_feat = self.discriminator(gen_input_fake) # in: [rgb(3)]
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/root/autodl-tmp/project/src/networks.py", line 137, in forward
conv5 = self.conv5(conv4)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/container.py", line 141, in forward
input = module(input)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1117, in _call_impl
result = hook(self, input)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/utils/spectral_norm.py", line 105, in call
setattr(module, self.name, self.compute_weight(module, do_power_iteration=module.training))
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/utils/spectral_norm.py", line 92, in compute_weight
weight = weight / sigma
(Triggered internally at ../torch/csrc/autograd/python_anomaly_mode.cpp:104.)
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
好像是spectral_norm中的除法出现问题,不知道该如何修改,或者会不会是pytorch版本问题,还请博主帮我解答

train

Is there any code for the whole process of training? It would be appreciated if you could provide it

Problem with inplace operations

Hi, I'm trying to test this implementation, but unfortunately, I keep getting this error:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 2; expected version 1 instead.

Specifically, it is generated at networks.py, line 137.

I've tried different torch versions etc...

Does this also happen to you? I see that in the readme you have torch 1.1.0, but in the paper is reported 1.10.0, which one is the actual version used?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.