Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
animegan2-pytorch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
git
animegan2-pytorch
Commits
4a9c882a
Commit
4a9c882a
authored
Nov 06, 2021
by
xhlulu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add known networks
parent
449279b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
hubconf.py
hubconf.py
+11
-2
No files found.
hubconf.py
View file @
4a9c882a
import
torch
def
animegan2
(
pretrained
=
True
,
device
=
"cpu"
,
progress
=
True
,
check_hash
=
True
):
release_url
=
"https://github.com/xhlulu/animegan2-pytorch/releases/download/weights"
known
=
{
name
:
f
"{release_url}/{name}.pt"
for
name
in
[
'face_paint_512_v0'
,
'face_paint_512_v2'
]
}
from
model
import
Generator
device
=
torch
.
device
(
device
)
...
...
@@ -8,10 +16,11 @@ def animegan2(pretrained=True, device="cpu", progress=True, check_hash=True):
model
=
Generator
()
.
to
(
device
)
if
type
(
pretrained
)
==
str
:
ckpt_url
=
pretrained
# Look if a known name is passed, otherwise assume it's a URL
ckpt_url
=
known
.
get
(
pretrained
,
pretrained
)
pretrained
=
True
else
:
ckpt_url
=
"https://github.com/xhlulu/animegan2-pytorch/releases/download/weights/face_paint_512_v2_0.pt"
ckpt_url
=
known
.
get
(
'face_paint_512_v2'
)
if
pretrained
is
True
:
state_dict
=
torch
.
hub
.
load_state_dict_from_url
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment