Spaces:
Runtime error
Runtime error
Jeremy Hummel commited on
Commit ·
cda6f07
1
Parent(s): ae0b9cb
Fixes stylegan import
Browse filesFiles changed (3)
- stylegan3/__init__.py+9
- test.pyDeleted-5
- visualize.py+3-4
123456789import sys
sys.path.append("../stylegan3")
from dnnlib.util import open_urlfrom legacy import load_network_pkl
sys.path.remove("../stylegan3")
12345from stylegan3 import dnnlib, legacy
network = 'https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-r-afhqv2-512x512.pkl'f = dnnlib.util.open_url(network)G = legacy.load_network_pkl(f)3 unmodified lines456787891022 unmodified lines333435373836373839403 unmodified linesimport randomimport torchfrom tqdm import tqdmimport stylegan3.dnnlibimport stylegan3.legacyimport stylegan3
def visualize(audio_file, network, truncation, batch_size, *args, **kwargs):22 unmodified lines
# Load pre-trained model device = torch.device('cuda') with stylegan3.dnnlib.open_url(network) as f: G = stylegan3.legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore with stylegan3.open_url(network) as f: G = stylegan3.load_network_pkl(f)['G_ema'].to(device) # type: ignore G.eval()
with torch.no_grad():stylegan3/__init__.py+9
test.pyDeleted-5
visualize.py+3-4