Closed sdtblck closed 4 years ago
I would suggest to suppress some outputs, typically the very long logs, because it makes it more cumbersome than necessary to read the notebook: I have to scroll a lot.
Thank you @sdtblck for the contribution! A few comments:
!sed -e 's/ganspace/base/g' environment.yml > colab_env.yml
)Using the pytorch models is super easy:
from models import get_model
model = get_model('StyleGAN2', 'ffhq', torch.device('cuda'), use_w=True)
w = model.sample_latent(1, seed=seed).cpu().numpy()
w = [w]*model.get_max_latents() # one per layer
# Edit
for l in range(start, end):
w[l] = w[l] + lat_comp[idx]*lat_std[idx]*delta
out = model.sample_np(w)
I'd be happy to merge once these things are fixed. Let me know if you have questions or need assistance!
Hey!
Thanks for the feedback. I put the notebook together very quickly just for personal use, hence the roughness. The exploration does look much simpler in pytorch I just wasn't at all familiar with the interface, so thanks for that snippet of code.
This should work!
No need to mess with conda/environment files at all in the end
I've modified the notebook to use (start, end) instead of (start, start + n_layers), since that matches the rest of the codebase better.
There's one more thing I still want to fix: the layer ranges of named edits are currently not stored, which means that the final widget where saved edits are used might not work as intended.
Ok, quite a simple fix - just added the layer ranges to the named directions dict. This should work fine. It would be nice also to have a slider controlling each direction, but I'm not handy enough with the ipnyb widgets to get that to work, and it's probably better to do that on your GUI anyway.
Awesome, looks good. Thanks a lot for your contribution Sid, will merge this now!
Added an example colab notebook exploring stylegan2 networks using ganspace results for those of us without beefy GPUs.