I am trying to build the documentation of my module using nbdev_build_docs. In the index.ipynb file I have the following cell in the beginning:
# local
# hide
import torch
import torch.nn as nn
import pandas as pd
from torch.utils.data import Dataset, DataLoader
The hide flag is declared as a tst_flags in the settings.ini file. Normally the cell should not be executed. Following, I have another cell down the line that uses the nn imported module.
# local
net = SimpleLSTM(len(symbols)//2, len(symbols), 32, out_size=2, activation=nn.Identity())
When running nbdev_build_docs I get a name error for this line:
---> 10 net = SimpleLSTM(len(symbols)//2, len(symbols), 32, out_size=2, activation=nn.Identity())
NameError: name 'nn' is not defined
import string
from astraea.spelling import SimpleLSTM, SpellingEncoder
in a separate cell. I imagine your module is called astraea, which is why triggers the execution of that cell (nbdev needs to execute the imports to be able to execute the show_doc it sees basically).