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

Use PyTorch UAE utility class in imdb example #705

Merged
merged 1 commit into from
Jan 11, 2023
Merged

Use PyTorch UAE utility class in imdb example #705

merged 1 commit into from
Jan 11, 2023

Conversation

ascillitoe
Copy link
Contributor

Resolves #527 (comment).

For the PyTorch UAE model in the example, the output of

!pip install torchinfo
import torchinfo
torchinfo.summary(model.encoder.mlp, input_size=(5,768))

is now:

==========================================================================================
Layer (type:depth-idx)                   Output Shape              Param #
==========================================================================================
Sequential                               [5, 32]                   --
├─Flatten: 1-1                           [5, 768]                  --
├─Linear: 1-2                            [5, 522]                  401,418
├─ReLU: 1-3                              [5, 522]                  --
├─Linear: 1-4                            [5, 277]                  144,871
├─ReLU: 1-5                              [5, 277]                  --
├─Linear: 1-6                            [5, 32]                   8,896
==========================================================================================
Total params: 555,185
Trainable params: 555,185
Non-trainable params: 0
Total mult-adds (M): 2.78
==========================================================================================
Input size (MB): 0.02
Forward/backward pass size (MB): 0.03
Params size (MB): 2.22
Estimated Total Size (MB): 2.27
==========================================================================================

This matches the Tensorflow UAE model:

uae.encoder.layers[1].summary()

gives:

Model: "sequential_1"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 flatten_1 (Flatten)         (5, 768)                  0         
                                                                 
 dense_3 (Dense)             (5, 522)                  401418    
                                                                 
 dense_4 (Dense)             (5, 277)                  144871    
                                                                 
 dense_5 (Dense)             (5, 32)                   8896      
                                                                 
=================================================================
Total params: 555,185
Trainable params: 555,185
Non-trainable params: 0      

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ascillitoe ascillitoe added the Type: Docs Anything related to documentation label Jan 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2023

Codecov Report

Merging #705 (89571db) into master (3daf62c) will decrease coverage by 0.12%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #705      +/-   ##
==========================================
- Coverage   80.15%   80.03%   -0.13%     
==========================================
  Files         133      133              
  Lines        9177     9136      -41     
==========================================
- Hits         7356     7312      -44     
- Misses       1821     1824       +3     
Flag Coverage Δ
macos-latest-3.10 ?
ubuntu-latest-3.10 ?
ubuntu-latest-3.7 79.87% <ø> (ø)
ubuntu-latest-3.8 ?
windows-latest-3.9 76.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
alibi_detect/utils/keops/kernels.py 94.05% <0.00%> (-3.97%) ⬇️
alibi_detect/saving/validators.py 86.53% <0.00%> (-3.85%) ⬇️
alibi_detect/utils/missing_optional_dependency.py 94.28% <0.00%> (-0.16%) ⬇️
alibi_detect/datasets.py 68.55% <0.00%> (-0.14%) ⬇️
alibi_detect/saving/schemas.py 98.69% <0.00%> (-0.09%) ⬇️
alibi_detect/utils/fetching/fetching.py 0.00% <0.00%> (ø)
alibi_detect/cd/base.py 91.19% <0.00%> (+0.21%) ⬆️
alibi_detect/od/vae.py 90.36% <0.00%> (+1.07%) ⬆️

@ascillitoe ascillitoe requested review from arnaudvl and mauicv January 9, 2023 17:22
Copy link
Collaborator

@mauicv mauicv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ascillitoe ascillitoe merged commit 97a9f41 into SeldonIO:master Jan 11, 2023
@ascillitoe ascillitoe deleted the feature/docs_pytorch_UAE branch January 11, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Docs Anything related to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential inconsistency in cd_text_imdb.ipynb
3 participants