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

Fix warnings thrown during testing: FLAVA, SamePadConv (#325) #338

Closed

Conversation

langong347
Copy link
Contributor

Summary:
Pull Request resolved: #325

Fixed the following warnings:

test/models/flava/test_checkpoint.py::TestFLAVACheckpoint::test_flava_model_for_pretraining
  /data/home/langong/repos/ci/test/models/flava/test_checkpoint.py:105: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
    else torch.tensor(dict_actual[key])

test/modules/layers/test_conv.py::TestSamePadConv3d::test_samepadconv3d_forward
  /data/home/langong/repos/ci/torchmultimodal/modules/layers/conv.py:49: UserWarning: Padding was specified but will not be used in favor of same padding,                 use Conv3d directly for custom padding
    warnings.warn(

Add ignore to pooling_function of mil_encoder.py to suppress mypy error:

torchmultimodal/modules/encoders/mil_encoder.py:73:30: error: Argument
Installing missing stub packages:
/usr/share/miniconda3/envs/test/bin/python -m pip install types-setuptools types-tabulate

Found 1 error in 1 file (checked 59 source files)
"pooling_function" has incompatible type "Callable[..., Any]"; expected
"TransformerEncoder"  [arg-type]
                pooling_function=pooling_function,
                                 ^~~~~~~~~~~~~~~~

Test Plan:

  • python -m pytest test/modules/layers/test_conv.py
  • python -m pytest test/models/flava/test_checkpoint.py

Reviewed By: pikapecan

Differential Revision: D39833572

Pulled By: langong347

…rch#325)

Summary:
Pull Request resolved: facebookresearch#325

Fixed the following warnings:

```
test/models/flava/test_checkpoint.py::TestFLAVACheckpoint::test_flava_model_for_pretraining
  /data/home/langong/repos/ci/test/models/flava/test_checkpoint.py:105: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
    else torch.tensor(dict_actual[key])

test/modules/layers/test_conv.py::TestSamePadConv3d::test_samepadconv3d_forward
  /data/home/langong/repos/ci/torchmultimodal/modules/layers/conv.py:49: UserWarning: Padding was specified but will not be used in favor of same padding,                 use Conv3d directly for custom padding
    warnings.warn(
```

Add ignore to `pooling_function` of `mil_encoder.py` to suppress `mypy` error:

```
torchmultimodal/modules/encoders/mil_encoder.py:73:30: error: Argument
Installing missing stub packages:
/usr/share/miniconda3/envs/test/bin/python -m pip install types-setuptools types-tabulate

Found 1 error in 1 file (checked 59 source files)
"pooling_function" has incompatible type "Callable[..., Any]"; expected
"TransformerEncoder"  [arg-type]
                pooling_function=pooling_function,
                                 ^~~~~~~~~~~~~~~~
```

Test Plan:
- `python -m pytest test/modules/layers/test_conv.py`
- `python -m pytest test/models/flava/test_checkpoint.py`

Reviewed By: pikapecan

Differential Revision: D39833572

Pulled By: langong347

fbshipit-source-id: 8e1647d65f25885e141541b4d2ef755f269a1fcc
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Sep 27, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D39833572

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2022

Codecov Report

Base: 93.63% // Head: 93.63% // No change to project coverage 👍

Coverage data is based on head (d4b9870) compared to base (06b34d9).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #338   +/-   ##
=======================================
  Coverage   93.63%   93.63%           
=======================================
  Files          54       54           
  Lines        3238     3238           
=======================================
  Hits         3032     3032           
  Misses        206      206           
Impacted Files Coverage Δ
torchmultimodal/modules/encoders/mil_encoder.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants