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

model: pytorch: pretrained: Add support for additional layers Python API #1148

Merged
merged 2 commits into from Jul 7, 2021

Conversation

mhash1m
Copy link
Contributor

@mhash1m mhash1m commented Jul 2, 2021

fixes: #1147

  • This PR is a dependency for the usecase example notebook I'm currently working on, ie. "Transferlearning".

  • I ended up setting layers: Anyin the PyTorchPreTrainedModelConfig and also skipping convert_value() in base.py if field type is Any since it tries to create an instance of the type.

  • Seems to be working as I handle the formatting of the parameter in pytorch_pretrained itself, but what could be the implications of this?

  • It appears we don't have Any type fields, even if we add in future and want to by-pass the checks in base.py, we can simply provide multiple arguments to isinstance() to check against along with dict, to allow the convert_value() process.

  • Alternatively, I could also create a .yaml inside the notebook (for the time being) if this approach doesn't seem right.

  • Using Pillow==8.2.0 to temporarily fix the pytorch errors. Seems like there's a pending fix Make Image.__array__ take optional dtype argument python-pillow/Pillow#5572 so should be okay soon

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2021

Codecov Report

Merging #1148 (9da27e9) into master (5edb093) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1148      +/-   ##
==========================================
- Coverage   84.63%   84.60%   -0.04%     
==========================================
  Files         156      156              
  Lines       10180    10184       +4     
  Branches     1677     1679       +2     
==========================================
  Hits         8616     8616              
- Misses       1215     1218       +3     
- Partials      349      350       +1     
Impacted Files Coverage Δ
dffml/base.py 83.60% <0.00%> (-1.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5edb093...9da27e9. Read the comment docs.

@pdxjohnny
Copy link
Member

Pinging @sakshamarora1 and or @yashlamba for review

@pdxjohnny
Copy link
Member

  • Add releated PR number to commit message trailer

pdxjohnny added a commit to mhash1m/dffml that referenced this pull request Jul 6, 2021
Array compatibility fix with numpy

Related: intel#1147
Related: intel#1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
pdxjohnny added a commit to mhash1m/dffml that referenced this pull request Jul 6, 2021
Array compatibility fix with numpy

Fixes: intel#1152
Related: intel#1147
Related: intel#1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
@pdxjohnny pdxjohnny force-pushed the u5_transferlearning branch 2 times, most recently from 6e6b2fd to 049a85b Compare July 6, 2021 17:57
Array compatibility fix with numpy

Fixes: intel#1152
Related: intel#1147
Related: intel#1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
Previously only supplying a dict which would then be converted to
PyTorch objects was supported. Now PyTorch objects can be supplied
directly.

Fixes: intel#1147
Related: intel#840
Related: intel#1151
@mhash1m mhash1m changed the title WIP: model: pytorch: Add support for additional layers Python API model: pytorch: pretrained: Add support for additional layers Python API Jul 7, 2021
@pdxjohnny pdxjohnny merged commit 01e183b into intel:master Jul 7, 2021
pdxjohnny added a commit that referenced this pull request Jul 7, 2021
Array compatibility fix with numpy

Fixes: #1152
Related: #1147
Related: #1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
@mhash1m mhash1m deleted the u5_transferlearning branch July 7, 2021 18:13
pdxjohnny added a commit to pdxjohnny/dffml that referenced this pull request Mar 11, 2022
Array compatibility fix with numpy

Fixes: intel#1152
Related: intel#1147
Related: intel#1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
pdxjohnny added a commit that referenced this pull request Mar 12, 2022
Array compatibility fix with numpy

Fixes: #1152
Related: #1147
Related: #1148
Co-authored-by: Hashim <hashimchaudry23@gmail.com>
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants