Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single GPU training error in DER #13

Closed
htwang14 opened this issue Sep 3, 2022 · 3 comments
Closed

Single GPU training error in DER #13

htwang14 opened this issue Sep 3, 2022 · 3 comments

Comments

@htwang14
Copy link

htwang14 commented Sep 3, 2022

Hi,

Thank you for this wonderful code base!

I noticed the current version doesn't support single GPU training. Could you please add this feature?

Thank you!

@G-U-N
Copy link
Owner

G-U-N commented Sep 5, 2022

Would you mind sharing the error logs?
Ideally(i.e., without encountering bugs), change the original params in JSON files

"device": ["0","1","2","3"],

to

"device": ["0"]

, and you can run the algos with single GPU.

@htwang14
Copy link
Author

htwang14 commented Sep 5, 2022

I haven't tried other methods, but for DER, something like this might be necessary: htwang14@e15cbe5

@G-U-N
Copy link
Owner

G-U-N commented Sep 5, 2022

Thanks, I have fixed the problem.
The error occurs because of the lack of judgment on whether self._network is an instance of module or DataParallel in function train(self). Here, I create a module pointer (i.e., the self._network_module_ptr) which always points to the module instance.

    def train(self):
        self._network.train()
        if len(self._multiple_gpus) > 1 :
            self._network_module_ptr = self._network.module
        else:
            self._network_module_ptr = self._network
        self._network_module_ptr.convnets[-1].train()
        if self._cur_task >= 1:
            for i in range(self._cur_task):
                self._network_module_ptr.convnets[i].eval()

Hope this can help you.

@G-U-N G-U-N closed this as completed Sep 5, 2022
@G-U-N G-U-N changed the title Single GPU training error Single GPU training error in DER Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants