Closed tyoc213 closed 2 years ago
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
mmm, trying to use delegates
I go this err
converting: nbs/12_optimizer.ipynb
An error occurred while executing the following cell:
------------------
from nbdev.showdoc import show_doc
from fastai.optimizer import *
------------------
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [1], in <module>
1 from nbdev.showdoc import show_doc
----> 2 from fastai.optimizer import *
File ~/Documents/git/hub/fastai-docment-sprint/fastai/optimizer.py:12, in <module>
9 from .torch_basics import *
11 # Cell
---> 12 class _BaseOptimizer():
13 "Common functionality between `Optimizer` and `OptimWrapper`"
14 def all_params(self,
15 n=slice(None), # Where to slice the model or all as default
16 with_grad=False # Get all param tuples. If `True` select only those with a gradient
17 ):
File ~/Documents/git/hub/fastai-docment-sprint/fastai/optimizer.py:61, in _BaseOptimizer()
59 self._set_hyper(k, v)
60 def unfreeze(self): self.freeze_to(0)
---> 61 @delegates(_BaseOptimizer.set_hyper)
62 def set_hypers(self,
63 **kwargs
64 ):
65 L(kwargs.items()).starmap(self.set_hyper)
66 def _set_hyper(self,
67 k, # Hyper parameter key
68 v # Hyper parameter value
69 ):
NameError: name '_BaseOptimizer' is not defined
NameError: name '_BaseOptimizer' is not defined
Conversion failed on the following:
12_optimizer.ipynb
So Im removing it for now, how would be the correct way?
Did update the PR, I left one of the comments untyped as importing Callback
did throw errors like circular imports and things like that, so I leave only in the comment.
I also didnt use the delegates
cause it is throwing that error above.
@tmabraham @warner-benjamin hopefully this is OK
latest fix @tmabraham @warner-benjamin
This PR is only to add docmetns for
_BaseOptimizer
andOptimizer
, hope it is a good starting point.Q: I have added all the changes taht did pop up after
nbdev_clean_nbs; nbdev_build_lib; nbdev_build_docs --fname nbs/12_optimizer.ipynb
of line numbers of links to src, should I only let the table generation? (I can remove them if needed)I will be making amends over same commit so all goes in 1 commit, thanks for the observations and feedback!