I’m working on the StyleGAN-NADA repo, and I am having issues loading the ZSSGAN function. The command line to do so is from ZSSGAN.model.ZSSGAN import ZSSGAN
, where
- The first
ZSSGAN
is the name of a folder model
is a folder inside the first folder- The second
ZSSGAN
is a script - The third
ZSSGAN
is a function inside the script, which defines a network architecture
If I give the command from ZSSGAN.model.ZSSGAN import ZSSGAN
the code hangs and it never completes the task. If I cd into the ZSSGAN folder and give as a command from model.ZSSGAN import ZSSGAN
, the task is completed in a few seconds. Unfortunately, this not a solution for me.
Is there a way I can rewrite from ZSSGAN.model.ZSSGAN import ZSSGAN
efficiently, so that the ZSSGAN function can be loaded from outside the ZSSGAN folder?
ZSSGAN folder | | model folder | | ZSSGAN script | | ZSSGAN function
The absolute path to the ZSSGAN folder is already appended to sys.path
.
Advertisement
Answer
The authors of this repository made this ZSSGAN folder as the collection of the packages and scripts, and even their train.py
script is inside of the ZSSGAN folder.
All their relative imports has been set up that way. But i believe you can make the ZSSGAN folder a master package by changing all relative imports in this project, like examples below:
in ZSSGAN/mapper/latent_mappers.py
from mapper.stylegan2.model import EqualLinear, PixelNorm
in ZSSGAN/model/sg2_model.py
from op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix