-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: add torch>=1.7 * feature: setup.py * feature: easytrain * fix: format file
- Loading branch information
Showing
7 changed files
with
94 additions
and
2 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
__pycache__ | ||
.vscode | ||
.idea | ||
|
||
/build | ||
/dist | ||
*.egg-info |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .config import import_config | ||
from .core import * | ||
from .utils import * | ||
from .version import __version__ |
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
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 os | ||
import sys | ||
from argparse import ArgumentParser | ||
|
||
from easytorch import launch_training | ||
|
||
|
||
def parse_args(): | ||
parser = ArgumentParser(description='Welcome to EasyTorch!') | ||
parser.add_argument('-c', '--cfg', help='training config', required=True) | ||
parser.add_argument('--node-rank', default=0, type=int, help='node rank for distributed training') | ||
parser.add_argument('--gpus', help='visible gpus', type=str) | ||
parser.add_argument('--tf32', help='enable tf32 on Ampere device', action='store_true') | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
# work dir | ||
path = os.getcwd() | ||
sys.path.append(path) | ||
|
||
# parse arguments | ||
args = parse_args() | ||
|
||
# train | ||
launch_training(args.cfg, args.gpus, args.tf32, args.node_rank) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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 @@ | ||
__version__ = '1.0.0' | ||
__all__ = ['__version__'] |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
torch>=1.7 | ||
easydict | ||
tensorboard | ||
tqdm |
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,54 @@ | ||
import os | ||
from setuptools import find_packages, setup | ||
|
||
|
||
def readme(): | ||
with open('README.md', encoding='utf-8') as f: | ||
content = f.read() | ||
return content | ||
|
||
|
||
def get_version(): | ||
version_file = 'easytorch/version.py' | ||
with open(version_file, 'r', encoding='utf-8') as f: | ||
exec(compile(f.read(), version_file, 'exec')) | ||
return locals()['__version__'] | ||
|
||
|
||
def get_requirements(filename='requirements.txt'): | ||
here = os.path.dirname(os.path.realpath(__file__)) | ||
with open(os.path.join(here, filename), 'r') as f: | ||
requires = [line.replace('\n', '') for line in f.readlines()] | ||
return requires | ||
|
||
|
||
if __name__ == '__main__': | ||
setup( | ||
name='easytorch', | ||
version=get_version(), | ||
description='Simple and powerful pytorch framework.', | ||
long_description=readme(), | ||
long_description_content_type='text/markdown', | ||
author='Yuhao Wang', | ||
author_email='yuhaow97@gmail.com', | ||
keywords='pytorch, deep learning', | ||
url='https://github.com/cnstark/easytorch', | ||
include_package_data=True, | ||
packages=find_packages(exclude=('tests',)), | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Topic :: Utilities' | ||
], | ||
entry_points={ | ||
'console_scripts': ['easytrain=easytorch.train:main'], | ||
}, | ||
license='Apache License 2.0', | ||
install_requires=get_requirements(), | ||
zip_safe=False | ||
) |