Downloads · 30 days
0
eugenesiow/ani-chara-gan
ani-chara-gan is a machine learning model from eugenesiow. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
[](https://github.com/eugenesiow/practical-ml)
Downloads · 30 days
0
Access
Public
Updated Nov 8, 2021
Repo size
344 MB
Likes
8
Public
Click a slice to open those files.
.pt344 MB · 100%
From the Hugging Face model README
This model uses the awesome lucidrains’s stylegan2-pytorch library to train a model on a private anime character dataset to generate full-body 256x256 female anime characters.
Here are some samples:

The model generates 256x256, square, white background, full-body anime characters. It is trained using stylegan2-pytorch. It is trained to 150 epochs.
You can use the model for generating anime characters and than use a super resolution library like super_image to upscale.
Install the dependencies:
pip install -q stylegan2_pytorch==1.5.10
Here is how to generate images:
import torch
from torchvision.utils import save_image
from stylegan2_pytorch import ModelLoader
from pathlib import Path
Path('./models/ani-chara-gan/').mkdir(parents=True, exist_ok=True)
torch.hub.download_url_to_file('https://huggingface.co/eugenesiow/ani-chara-gan/resolve/main/model.pt',
'./models/ani-chara-gan/model_150.pt')
torch.hub.download_url_to_file('https://huggingface.co/eugenesiow/ani-chara-gan/resolve/main/.config.json',
'./models/ani-chara-gan/.config.json')
loader = ModelLoader(
base_dir = './', name = 'ani-chara-gan'
)
noise = torch.randn(1, 256).cuda() # noise
styles = loader.noise_to_styles(noise, trunc_psi = 0.7) # pass through mapping network
images = loader.styles_to_images(styles) # call the generator on intermediate style vectors
save_image(images, './sample.jpg')
The model is part of the practical-ml repository.