AttributeError: 'Module List' object has no attribute 'module' - DA-GAN

Hello, i used this cmd: python main.py --save_results --save_gt --save_models --cpu --n_GPUs 0 but this is the error : AttributeError: ‘Module List’ object has no attribute ‘module’; How can i solve it please, i don’t have GPU, just CPU…

As the error states, nn.ModuleList doesn’t have the .module attribute, which is an attribute of a data parallel wrapper. I’m not sure what your code tries to do so could you explain your use case a bit more?

I have a code that’s not running , might be pytorch version issue … can you help me?

The mentioned issue is not caused by different PyTorch versions, but would be a wrong usage of the .module attribute.
Sure, please describe the issue in more detail and, if possible, post a minimal, executable code snippet so that we could debug it.

the error is in line 518 the last line , in __getattr__type(self).name, name)):
AttributeError: ‘ModuleList’ object has no attribute ‘module’

    def __getattr__(self, name):
        if '_parameters' in self.__dict__:
            _parameters = self.__dict__['_parameters']
            if name in _parameters:
                return _parameters[name]
        if '_buffers' in self.__dict__:
            _buffers = self.__dict__['_buffers']
            if name in _buffers:
                return _buffers[name]
        if '_modules' in self.__dict__:
            modules = self.__dict__['_modules']
            if name in modules:
                return modules[name]
        raise AttributeError("'{}' object has no attribute '{}'".format(
            type(self).__name__, name)) #this is the error

Unfortunately I don’t have any context to be able to help more. As previously explained, nn.ModuleList doesn’t have this attribute and I don’t know how you are using this object or why the modules attribute is accessed.