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

[Feature] support torch.hub.load #73

Merged
merged 3 commits into from Sep 1, 2022
Merged

[Feature] support torch.hub.load #73

merged 3 commits into from Sep 1, 2022

Conversation

Bing-su
Copy link
Contributor

@Bing-su Bing-su commented Sep 1, 2022

Problem (Why?)

loading optimizers via torch.hub.load

Solution (What/How?)

it is inconvenient to define functions one by one, I used a trick using globals().

Other changes (bug fixes, small refactors)

Change Callable to Type[Optimizer]. Perhaps this is what you intended. see: typing.Type

Notes

example colab

import torch

Adan = torch.hub.load("Bing-su/pytorch_optimizer:hubconf", "Adan")

@kozistr kozistr self-assigned this Sep 1, 2022
@kozistr kozistr added the feature New features label Sep 1, 2022
Copy link
Owner

@kozistr kozistr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution :) I just made a minor comment, everything else looks good!

hubconf.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #73 (74caee6) into main (569bf89) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #73   +/-   ##
=======================================
  Coverage   96.03%   96.03%           
=======================================
  Files          29       29           
  Lines        2116     2117    +1     
=======================================
+ Hits         2032     2033    +1     
  Misses         84       84           
Impacted Files Coverage Δ
pytorch_optimizer/__init__.py 100.00% <100.00%> (ø)

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

@Bing-su
Copy link
Contributor Author

Bing-su commented Sep 1, 2022

이렇게 빨리 확인하실줄 몰랐네요... torch.hub.listpartial, load_optimizer, get_supported_optimizers가 안나오게 변경하고, update_wrapper를 통해 torch.hub.help를 통해 설명이 나오도록 했습니다.

Copy link
Owner

@kozistr kozistr left a comment

Choose a reason for hiding this comment

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

변경 사항 확인했습니다. merge 후 v1.3.0 으로 package 배포하겠습니다!

감사합니다!

@kozistr kozistr merged commit f691cf6 into kozistr:main Sep 1, 2022
@kozistr kozistr mentioned this pull request Sep 1, 2022
2 tasks
@Bing-su Bing-su deleted the hubconf branch September 1, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants