wfondrie / depthcharge

A deep learning toolkit for mass spectrometry
https://wfondrie.github.io/depthcharge/
Apache License 2.0
59 stars 18 forks source link

Create target mask as bool #30

Closed bittremieux closed 1 year ago

bittremieux commented 1 year ago

Avoids "UserWarning: Support for mismatched key_padding_mask and attn_mask is deprecated. Use same type for both instead." from Casanovo#174.

@wfondrie I don't understand the motivation of creating the mask with 0 and -inf previously, so please carefully double-check the change. I also can't find a version of generate_tgt_mask in the PyTorch repository.

codecov-commenter commented 1 year ago

Codecov Report

Merging #30 (049f0ff) into main (7bd60de) will decrease coverage by 0.05%. The diff coverage is 100.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #30      +/-   ##
==========================================
- Coverage   85.71%   85.67%   -0.05%     
==========================================
  Files          15       15              
  Lines         707      705       -2     
==========================================
- Hits          606      604       -2     
  Misses        101      101              
Impacted Files Coverage Δ
depthcharge/components/transformers.py 87.85% <100.00%> (-0.23%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

wfondrie commented 1 year ago

There used to be an example the created a very similar function in the PyTorch docs. I think this should be good 👍