-
Notifications
You must be signed in to change notification settings - Fork 495
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
1 parent
fbc93e9
commit 5ff28ac
Showing
7 changed files
with
130 additions
and
45 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/pythonpublish.yml → .github/workflows/pypi_nightly.yml
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,32 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Pypi Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.7' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine pypandoc | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.pypi_username }} | ||
TWINE_PASSWORD: ${{ secrets.pypi_password }} | ||
RELEASE: 1 | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* --verbose |
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,40 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Unit Test | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: seanmiddleditch/gha-setup-ninja@master | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install numpy -I | ||
pip install pytest torch | ||
pip install nose | ||
- name: Install package | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e . | ||
- name: Run pytest | ||
run: | | ||
nosetests -v tests/ |
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
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 |
---|---|---|
|
@@ -11,17 +11,16 @@ | |
import subprocess | ||
|
||
from setuptools import setup, find_packages | ||
import setuptools.command.develop | ||
import setuptools.command.install | ||
|
||
cwd = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
version = '0.0.2' | ||
try: | ||
from datetime import date | ||
today = date.today() | ||
day = today.strftime("b%d%m%Y") | ||
version += day | ||
if not os.getenv('RELEASE'): | ||
from datetime import date | ||
today = date.today() | ||
day = today.strftime("b%d%m%Y") | ||
version += day | ||
except Exception: | ||
pass | ||
|
||
|
@@ -33,18 +32,6 @@ def create_version_file(): | |
f.write('"""This is resnest version file."""\n') | ||
f.write("__version__ = '{}'\n".format(version)) | ||
|
||
class install(setuptools.command.install.install): | ||
def run(self): | ||
create_version_file() | ||
setuptools.command.install.install.run(self) | ||
|
||
class develop(setuptools.command.develop.develop): | ||
def run(self): | ||
create_version_file() | ||
setuptools.command.develop.develop.run(self) | ||
|
||
readme = open('README.md').read() | ||
|
||
requirements = [ | ||
'numpy', | ||
'tqdm', | ||
|
@@ -55,24 +42,22 @@ def run(self): | |
'requests', | ||
] | ||
|
||
setup( | ||
name="resnest", | ||
version=version, | ||
author="Hang Zhang", | ||
author_email="[email protected]", | ||
url="https://github.com/zhanghang1989/ResNeSt", | ||
description="ResNeSt", | ||
long_description=readme, | ||
long_description_content_type='text/markdown', | ||
license='Apache-2.0', | ||
install_requires=requirements, | ||
packages=find_packages(exclude=["scripts", "examples", "tests"]), | ||
package_data={'resnest': [ | ||
'LICENSE', | ||
]}, | ||
cmdclass={ | ||
'install': install, | ||
'develop': develop, | ||
}, | ||
) | ||
if __name__ == '__main__': | ||
create_version_file() | ||
setup( | ||
name="resnest", | ||
version=version, | ||
author="Hang Zhang", | ||
author_email="[email protected]", | ||
url="https://github.com/zhanghang1989/ResNeSt", | ||
description="ResNeSt", | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
license='Apache-2.0', | ||
install_requires=requirements, | ||
packages=find_packages(exclude=["scripts", "examples", "tests"]), | ||
package_data={'resnest': [ | ||
'LICENSE', | ||
]}, | ||
) | ||
|
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,31 @@ | ||
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
## Created by: Hang Zhang | ||
## Email: [email protected] | ||
## Copyright (c) 2020 | ||
## | ||
## This source code is licensed under the MIT-style license found in the | ||
## LICENSE file in the root directory of this source tree | ||
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
import torch | ||
import importlib | ||
import inspect | ||
|
||
def test_model_inference(): | ||
# get all models | ||
import resnest.torch as module | ||
functions = inspect.getmembers(module, inspect.isfunction) | ||
model_list = [f[0] for f in functions] | ||
|
||
get_model = importlib.import_module('resnest.torch') | ||
x = torch.rand(1, 3, 224, 224) | ||
for model_name in model_list: | ||
print('Doing: ', model_name) | ||
net = getattr(get_model, model_name) | ||
model = net(pretrained=True) | ||
model.eval() | ||
y = model(x) | ||
|
||
if __name__ == "__main__": | ||
import nose | ||
nose.runmodule() |