Skip to content

Remove all the full torch imports#286

Merged
niekdejonge merged 2 commits intomainfrom
remove_lazy_torch_import
Feb 25, 2026
Merged

Remove all the full torch imports#286
niekdejonge merged 2 commits intomainfrom
remove_lazy_torch_import

Conversation

@niekdejonge
Copy link
Copy Markdown
Collaborator

@niekdejonge niekdejonge commented Feb 25, 2026

We used to have a lot of import torch happening in MS2DeepScore.

Particularly when working on a server doing the first import for ms2deepscore takes endlessly (sometimes multiple minutes). I think this might be due to this importing of the full torch. Hopefully this resolves it.

Locally the initializing of my tests already seems a lot faster (before this took often as long as the actual running)

I now realize this was stupid... It does not make any difference what so ever if you load using import torch or e.g. torch.cuda, for what is actually loaded. So I don't think these changes were a good idea, since they might result in unnecessary confusion. however, I already created a new release, so I don't think I will revert back

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 Security Hotspots

See analysis details on SonarQube Cloud

@niekdejonge niekdejonge merged commit ae333fa into main Feb 25, 2026
11 of 12 checks passed
@niekdejonge niekdejonge deleted the remove_lazy_torch_import branch February 25, 2026 14:31
@niekdejonge
Copy link
Copy Markdown
Collaborator Author

I now realize this was stupid... It does not make any difference what so ever if you load using import torch or e.g. torch.cuda, for what is actually loaded. So I don't think these changes were a good idea, since they might result in unnecessary confusion.

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

Successfully merging this pull request may close these issues.

1 participant