[nbdev] Any recommended way to stop duplication of image folder?

Currently, I have a folder called images in the nbs folder that contains all the images that I use in my notebooks. When I run nbdev_build_docs, it duplicates the images folder at docs/images/.

My question is, is this duplication of the image folder necessary? Or is there some way around it?

Yes it’s necessary- this is the only way to make the files visible to the build system of Jekyll. Otherwise you would have to copy them yourself and change all the links. Nbdev automated all this for you

Ok, thanks.

This isn’t working in my case. I’ve β€˜images’ folder in the β€˜nbs’ folder, few of the images added earlier have been copied but it is not working with the recent ones. Does this have anything to do with notebooks kept in sub-directories?

β”‚   β”œβ”€β”€ 01_tutorial.arch_explore.ipynb
β”‚   β”œβ”€β”€ 02_tutorial.stanford_dogs_wrangling.ipynb
β”‚   β”œβ”€β”€ applications.ipynb
β”‚   β”œβ”€β”€ cifar10
β”‚   β”‚   β”œβ”€β”€ AlexNet_cifar10.ipynb
β”‚   β”‚   └── NiN_cifar10.ipynb
β”‚   β”œβ”€β”€ colab.svg
β”‚   β”œβ”€β”€ core.ipynb
β”‚   β”œβ”€β”€ fast_impl -> ../fast_impl
β”‚   β”œβ”€β”€ images
β”‚   β”‚   β”œβ”€β”€ alexnet.svg
β”‚   β”‚   β”œβ”€β”€ cam.png
β”‚   β”‚   β”œβ”€β”€ inverted_residual.png
β”‚   β”‚   └── residual_block.png
β”‚   β”œβ”€β”€ index.ipynb
β”‚   β”œβ”€β”€ paper_impl.ipynb
β”‚   β”œβ”€β”€ preprocessing.ipynb
β”‚   β”œβ”€β”€ tutorial.ipynb
β”‚   └── visualizations
β”‚       β”œβ”€β”€ visualize.cam.ipynb
β”‚       └── visualize.grad_cam.ipynb

This is my current hierarchy. I’ve used the images in the notebooks from sub-directories as well


Please follow the troubleshooting guide carefully and follow all the steps as well as provide all of the requested information: https://github.com/fastai/fastpages/blob/master/_fastpages_docs/TROUBLESHOOTING.md

I don’t think notebooks in subfolders is supported currently

1 Like

I did @hamelsmu and yes, it seems like notebooks in subfolders is not yet supported. I failed to reporting jekyll/yaml errors though, so these are the errors from my log when I run make docs_serve

Invalid theme folder: _includes
YAML Exception reading /home/.../docs/visualize.grad_cam.html: (<unknown>): did not find expected key while parsing a block mapping at line 3 column 1 
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

I’m currently using find with xargs as a workaround but I really want this to be supported by nbdev. One more thing I realized, as mentioned here, it was okay to have symlink in nbs folder but we’d need to do the same for subdirectories as well, so might need think about some alternative. I’d like to make a feature request for this. Should I post about it on forums or make an issue on nbdev repository?

You can post it on the forum. I personally don’t support this feature as for me, subfolders should contain examples that don’t need conversion/docs (like in the fastai2 repo) and there is no feature of nbdev that could be helped by having subfolders.

1 Like