Skip to content

Commit

Permalink
Attempt to make available via Pytorch hub.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndahlquist committed Sep 7, 2019
1 parent 541b6b1 commit ef25e2f
Show file tree
Hide file tree
Showing 4 changed files with 564 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
.ipynb_checkpoints
*.pt
22 changes: 22 additions & 0 deletions hubconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import torch.utils.model_zoo as model_zoo

# Optional list of dependencies required by the package
dependencies = ['torch']


def style_gan(pretrained=False, *args, **kwargs):
"""
TODO: Document this
"""
from models import style_gan
if 'config' not in kwargs or kwargs['config'] is None:
kwargs['config'] = {}

model = style_gan.get_style_gan()

checkpoint = 'https://github.com/lernapparat/lernapparat/releases/download/v2019-02-01/karras2019stylegan-ffhq' \
'-1024x1024.for_g_all.pt '
if pretrained:
state_dict = model_zoo.load_url(checkpoint, map_location='cpu')
model.load_state_dict(state_dict)
return model
Loading

0 comments on commit ef25e2f

Please sign in to comment.