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

Speedup for training #8

Closed
SongtaoLiu0823 opened this issue Jan 5, 2023 · 2 comments
Closed

Speedup for training #8

SongtaoLiu0823 opened this issue Jan 5, 2023 · 2 comments

Comments

@SongtaoLiu0823
Copy link

https://github.com/molecule-one/megan/blob/master/src/model/megan.py#L19

I think this line can be replaced by:
if torch.cuda.is_available():
one_hot = torch.cuda.FloatTensor(*x.shape, dims).zero_()
else:
one_hot = torch.FloatTensor(*x.shape, dims).zero_().to(device)

As a result, the cpu usage can be reduced, leading to faster training.

@SongtaoLiu0823
Copy link
Author

In my machine, the CPU usage is from 2000+ to 100+.

@mikolajsacha
Copy link
Member

Hi, sorry for the late response, and thank you for your find. We will merge it into the codebase :)

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