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

Add PyTorch utility, implement PyTorch VAE and AutoEncoder #568

Closed
wants to merge 13 commits into from

Conversation

RaymondY
Copy link
Contributor

All Submissions Basics:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked all Issues to tie the PR to a specific one?

All Submissions Cores:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

New Model Submissions:

  • Have you created a .py in ~/pyod/models/?
  • Have you created a _example.py in ~/examples/?
  • Have you created a test_.py in ~/pyod/test/?
  • Have you lint your code locally prior to submission?

@coveralls
Copy link

coveralls commented May 13, 2024

Pull Request Test Coverage Report for Build 9139621159

Details

  • 362 of 392 (92.35%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 93.673%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyod/test/test_vae_torch.py 99 100 99.0%
pyod/models/auto_encoder_torch.py 53 56 94.64%
pyod/models/vae_torch.py 144 149 96.64%
pyod/utils/torch_utility.py 59 80 73.75%
Totals Coverage Status
Change from base Build 8309419980: -0.08%
Covered Lines: 9297
Relevant Lines: 9925

💛 - Coveralls

@yzhao062
Copy link
Owner

it appears that mac tests failed -- maybe take a look but I could also help!

@RaymondY RaymondY changed the title Add PyTorch VAE Add PyTorch utility, implement PyTorch VAE and AutoEncoder May 18, 2024
@RaymondY
Copy link
Contributor Author

RaymondY commented May 18, 2024

torch_utility includes:

  • class PyODDataset, custom PyTorch dataset
  • class LinearBlock, includes linear layer, batch normalization, activation function, dropout layer, and linear layer weight init
  • func get_activation_by_name, includes 7 common activation functions
  • func init_weights, includes all weight initialization methods

Utility functions and classes are applied in VAE and AutoEncoder.

Note:

  • Add torch.compile() to speed up (not used by default). Available for PyTorch version >=2.0.0 and Python version < 3.12.

@RaymondY RaymondY closed this May 21, 2024
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.

None yet

3 participants