Nbdev v2 launched

Thanks a lot Jeremy! I guess what you mean is that when nbdev tries to export to other modules, it failed because at the moment the module itself is not ready. So, sorting the filenames to ensure all the modules are generated before the action of exporting to other module is executed, could be the solution.

So, to verify this hypothesis I have checked the order of filenames when nbdev_preview, and the order of the filenames supports the hypothesis above. The notebook I am doing export to other modules is after core.py and utils.py but before all other modules are made.

Then my question is how do I sort the filenames, I have tried to removed the numbers in the filenames, so far there is no luck.


Now, it exported to the modules I wanted. I guess the order has been changed, though I canā€™t see it because sometimes nbdev_preview does not show me the order of all the filenames.

How to view the website generated by nbdev in a localhost on paperspace?

I have managed to use nbdev with my project on paperspace, and nbdev_preview works fine too, until it gives me the localhost link. I donā€™t know where to paste the link to view the generated website. Well, I didnā€™t try to paste it to the end of the url of paperspace, and it didnā€™t work of course.

Could anyone help here? thanks!

Hi Daniel,

At the moment, we do not support port forwarding on Gradient machines. However, you can control forwarded ports on a Paperspace Core machine. You can run this notebook there and then access the site on your local browser if you forward port 4151.

Hope this helps

3 Likes

Thank you Joshua! Itā€™s good to know Core machines can solve this problem for me.

1 Like

The data type of a function argument shows the entire module path in the documentation generated by nbdev, and it looks strange, like the screenshot below:

The code used in the case above looks like this:

from typing import Optional
from tensorflow.keras.layers import Normalization

#|export
def keras_lasso_linear_model(
    ...
    normalization_layer: Optional[Normalization]=None,
   ...
) -> tf.keras.Sequential:

Is it possible to make this data type column in the documentation cleaner?

Another question related to the documentation: It seems that nbdev inherits the base class documentation even when I explicitly add a docstring to my class. Example:

#|export
class LinearHyperModel(kt.HyperModel):
    def __init__(
        self,
        number_documents_per_query, 
        number_features,
        top_n=10,
        learning_rate_range=None,
    ):
        """
        Define a KerasTuner search space for linear models
        """
        # code here

leads to
docs_inheritance

where the text comes from the kt.HyperModel base class. Is this the expected behavior?

Does it change if you put the docstring on the class, instead of the init?

Yes, it works as expected when I place the docstring in the class. Should I always avoid placing it on the init?

I guess it has to be consistent across classes probably.

1 Like

Hi guys,
Can someone help me with this issue, please?

Thanks for your time!

Please donā€™t x-post (or x-link) like this.

Apologies.

Would you want it to only refer to the object e.g. Normalization? I suspect some users would prefer the full path. Perhaps it would need to be configurable?

Iā€™ve been thinking that a different table UI might be better in general, and would also solve this issue specifically. For example, something like spacyā€™s docs where the type is on a separate row instead of being in its own column:

1 Like

Yes, showing the full path is desired. I agree this is a UI issue, and I like your suggestion based on spacyā€™s docs.

Another possibility would be to show Normalization but display the full path when the user hovers over the ā€œlinkā€.

2 Likes

Hi @Daniel Iā€™m trying to use nbdev on paperspace. How did you get this to work? Do you have any resources or posts youā€™ve found helpful?

1 Like

Since your question is little general, the best I can offer right now is what I wrote down in my note after getting nbdev and paperspace to work

how to use paperspace with nbdev

  • make sure to specify all the libraries (including the latest version number) needed for my project in settings.init, as paperspace may only install the default version not necessarily the latest needed
  • then pip install -e . will install all of them
  • nbdev is only usable in paperspace if it is installed in this way
1 Like

Got the following ā€œPlease enable Github pagesā€ error today:

It was working fine before, and there was no gh-pages changes from my side. Here is the GitHub Actions link: Merge pull request #17 from vespa-engine/tgm/time-query-operator Ā· vespa-engine/learntorank@580448d Ā· GitHub

Sorry for the late response. Had to use @staticmethod followed by @patch_to(ClassName) but it didnā€™t work even after fix exporting `patch_to` which is decorated with `staticmethod` by seeM Ā· Pull Request #1100 Ā· fastai/nbdev Ā· GitHub.

hi @Daniel I find that I must re-save the .ssh file into the ~/ folder everytime I re-open a session in paperspace. Do you know of any alternatives to this? I have listed my steps for each new Paperspace session here in case it is useful to anyone.

@daveramseymusic in the live coding sessions associated with part 1 of the course I step through how to set this up. Thereā€™s a repo here to automate it: GitHub - fastai/paperspace-setup: Setup a paperspace instance for fastai

2 Likes