forked from kwotsin/mimicry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3f60827
Showing
144 changed files
with
12,670 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Python CircleCI 2.1 configuration file | ||
version: 2.1 | ||
orbs: | ||
codecov: codecov/[email protected] | ||
jobs: | ||
build: | ||
# machine: | ||
# image: ubuntu-1604:201903-01 # recommended linux image - includes Ubuntu 16.04, docker 18.09.3, docker-compose 1.23.1 | ||
|
||
docker: | ||
# specify the version you desire here | ||
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` | ||
- image: circleci/python:3.6.9 | ||
|
||
# Specify service dependencies here if necessary | ||
# CircleCI maintains a library of pre-built images | ||
# documented at https://circleci.com/docs/2.0/circleci-images/ | ||
# - image: circleci/postgres:9.4 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "requirements.txt" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
|
||
- run: | ||
name: install dependencies | ||
command: | | ||
python3 -m venv venv | ||
. venv/bin/activate | ||
pip install pip==19.2.3 && pip install -r requirements.txt | ||
- save_cache: | ||
paths: | ||
- ./venv | ||
key: v1-dependencies-{{ checksum "requirements.txt" }} | ||
|
||
# run tests! | ||
# this example uses Django's built-in test-runner | ||
# other common Python testing frameworks include pytest and nose | ||
# https://pytest.org | ||
# https://nose.readthedocs.io | ||
- run: | ||
name: run tests | ||
command: | | ||
. venv/bin/activate | ||
python -m pytest --cov=./ --cov-report=xml:coverage.xml tests | ||
- codecov/upload: | ||
file: ./coverage.xml | ||
token: 8caf88d1-28eb-40a3-8a4a-85ad8dc90e88 | ||
|
||
- store_artifacts: | ||
path: test-reports | ||
destination: test-reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[report] | ||
exclude_lines = | ||
if __name__ == .__main__.: | ||
|
||
[run] | ||
omit = | ||
*test* | ||
torch_mimicry/datasets/imagenet/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
build: | ||
image: latest | ||
|
||
python: | ||
version: 3.6 | ||
system_packages: true | ||
install: | ||
- requirements: docs/requirements.txt | ||
- method: setuptools | ||
path: . | ||
|
||
formats: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[style] | ||
based_on_style = pep8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Kwot Sin Lee | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Gallery | ||
We provide randomly sampled, non-cherry picked images for various datasets as produced by InfoMax-GAN. | ||
|
||
### LSUN-Bedroom | ||
Resolution: 128 x 128 | ||
|
||
") | ||
|
||
### CelebA | ||
Resolution: 128 x 128 | ||
|
||
") | ||
|
||
### STL-10 | ||
Resolution: 48 x 48 | ||
|
||
") | ||
|
||
### ImageNet | ||
Resolution: 32 x 32 | ||
|
||
") | ||
|
||
### CIFAR-10 | ||
Resolution: 32 x 32 | ||
|
||
") | ||
|
||
### CIFAR-100 | ||
Resolution: 32 x 32 | ||
|
||
") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sphinx | ||
sphinx_rtd_theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import datetime | ||
import sphinx_rtd_theme | ||
import doctest | ||
import torch_mimicry | ||
|
||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.doctest', | ||
'sphinx.ext.intersphinx', | ||
'sphinx.ext.mathjax', | ||
'sphinx.ext.napoleon', | ||
'sphinx.ext.viewcode', | ||
'sphinx.ext.githubpages', | ||
] | ||
|
||
source_suffix = '.rst' | ||
master_doc = 'index' | ||
|
||
author = 'Kwot Sin Lee' | ||
project = 'torch_mimicry' | ||
copyright = '{}, {}'.format(datetime.datetime.now().year, author) | ||
|
||
version = torch_mimicry.__version__ | ||
release = torch_mimicry.__version__ | ||
|
||
html_theme = 'sphinx_rtd_theme' | ||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] | ||
|
||
doctest_default_flags = doctest.NORMALIZE_WHITESPACE | ||
intersphinx_mapping = {'python': ('https://docs.python.org/', None)} | ||
|
||
html_theme_options = { | ||
'collapse_navigation': False, | ||
'display_version': True, | ||
'logo_only': True, | ||
} | ||
|
||
html_logo = '_static/img/pyg_logo_text.svg' | ||
html_static_path = ['_static'] | ||
html_context = {'css_files': ['_static/css/custom.css']} | ||
|
||
add_module_names = False | ||
|
||
|
||
def setup(app): | ||
def skip(app, what, name, obj, skip, options): | ||
members = [ | ||
'__init__', | ||
'__repr__', | ||
'__weakref__', | ||
'__dict__', | ||
'__module__', | ||
] | ||
return True if name in members else skip | ||
|
||
app.connect('autodoc-skip-member', skip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import torch | ||
import torch.optim as optim | ||
import torch_mimicry as mmc | ||
from torch_mimicry.nets import sngan | ||
|
||
if __name__ == "__main__": | ||
# Data handling objects | ||
dataset = mmc.datasets.load_dataset(root='./datasets', name='cifar10') | ||
dataloader = torch.utils.data.DataLoader( | ||
dataset, batch_size=64, shuffle=True, num_workers=4) | ||
|
||
# Define models and optimizers | ||
netG = sngan.ResNetGenerator32() | ||
netD = sngan.ResNetDiscriminator32() | ||
optD = optim.Adam(netD.parameters(), 2e-4, betas=(0.0, 0.9)) | ||
optG = optim.Adam(netG.parameters(), 2e-4, betas=(0.0, 0.9)) | ||
|
||
# Start training | ||
trainer = mmc.training.Trainer( | ||
netD=netD, | ||
netG=netG, | ||
optD=optD, | ||
optG=optG, | ||
n_dis=5, | ||
num_steps=100000, | ||
lr_decay='linear', | ||
dataloader=dataloader, | ||
log_dir='./log/example') | ||
|
||
trainer.train() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[pytest] | ||
filterwarnings = | ||
ignore::DeprecationWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
numpy>=1.15.4 | ||
scipy>=1.0.1 | ||
requests>=2.22.0 | ||
tensorflow>=1.14.0 | ||
torchvision>=0.4.0 | ||
six>=1.12.0 | ||
matplotlib>=3.1.1 | ||
torch>=1.2.0 | ||
Pillow>=6.2.0 | ||
scikit-image>=0.15.0 | ||
pytest>=5.3.2 | ||
scikit-learn>=0.20.1 | ||
future>=0.17.1 | ||
pytest-cov>=2.8.1 | ||
pandas>=0.25.3 | ||
psutil>=5.7.0 | ||
yapf>=0.29.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[metadata] | ||
description-file = README.md | ||
|
||
[aliases] | ||
test=pytest | ||
|
||
[tool:pytest] | ||
addopts = --capture=no --cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from setuptools import setup, find_packages | ||
|
||
__version__ = '0.1.4' | ||
url = 'https://github.com/kwotsin/mimicry' | ||
|
||
install_requires = [ | ||
'numpy>=1.15.4', | ||
'scipy>=1.0.1', | ||
'requests>=2.22.0', | ||
'tensorflow>=1.14.0', | ||
'torchvision>=0.4.0', | ||
'six>=1.12.0', | ||
'matplotlib>=3.1.1', | ||
'torch>=1.2.0', | ||
'Pillow>=6.2.0', | ||
'scikit-image>=0.15.0', | ||
'pytest>=5.3.2', | ||
'scikit-learn>=0.20.1', | ||
'future>=0.17.1', | ||
'pytest-cov>=2.8.1', | ||
'pandas>=0.25.3', | ||
'psutil>=5.7.0', | ||
'yapf>=0.29.0', | ||
] | ||
|
||
setup_requires = ['pytest-runner'] | ||
tests_require = ['pytest', 'pytest-cov', 'mock'] | ||
|
||
long_description = """ | ||
Mimicry is a lightweight PyTorch library aimed towards the reproducibility of GAN research. | ||
Comparing GANs is often difficult - mild differences in implementations and evaluation methodologies can result in huge performance differences. | ||
Mimicry aims to resolve this by providing: | ||
(a) Standardized implementations of popular GANs that closely reproduce reported scores; | ||
(b) Baseline scores of GANs trained and evaluated under the same conditions; | ||
(c) A framework for researchers to focus on implementation of GANs without rewriting most of GAN training boilerplate code, with support for multiple GAN evaluation metrics. | ||
We provide a model zoo and set of baselines to benchmark different GANs of the same model size trained under the same conditions, using multiple metrics. To ensure reproducibility, we verify scores of our implemented models against reported scores in literature. | ||
""" | ||
|
||
setup( | ||
name='torch_mimicry', | ||
version=__version__, | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
description='Mimicry: Towards the Reproducibility of GAN Research', | ||
author='Kwot Sin Lee', | ||
author_email='[email protected]', | ||
url=url, | ||
download_url='{}/archive/{}.tar.gz'.format(url, __version__), | ||
keywords=[ | ||
'pytorch', | ||
'generative-adversarial-networks', | ||
'gans', | ||
'GAN', | ||
], | ||
python_requires='>=3.6', | ||
install_requires=install_requires, | ||
setup_requires=setup_requires, | ||
tests_require=tests_require, | ||
packages=find_packages(), | ||
) |
Binary file not shown.
Oops, something went wrong.