Skip to content

Commit

Permalink
Merge pull request #16 from smoke-trees/dev
Browse files Browse the repository at this point in the history
Version update
  • Loading branch information
Geek-ubaid authored Jul 10, 2020
2 parents 40402bd + 57d8116 commit 220d6ba
Show file tree
Hide file tree
Showing 18 changed files with 517 additions and 121 deletions.
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

This package will be useful for carrying out all the utilities of the SmokeTrees Model Zoo lovingly called SmokeTrees Forest.`

## Features
### Features

- [X] Pull down HDF5 (.h5) models from the zoo and load with keras
- [X] Pull down the spacy model from the zoo
- [X] Pull down SavedModel (.pb) models from the zoo and load with keras
- [X] Pull down Checkpoints (.ckpt) models from the zoo and load with keras
- [X] Pull down the spacy model from the zoo and load them into an nlp pipeline
- [X] Pull down tokenizers and models in accordance with huggingface model architectures and reuse them
- [X] Pull down datasets so as to use them in your own projects

> Package is under test before being published to PyPI
### Steps to install package from PyPI

## Steps to install the package from source code
```bash
pip install forest-utils
```

### Steps to install the package from source code

- Clone the repo by the following command
``` bash
Expand All @@ -24,14 +32,14 @@ This package will be useful for carrying out all the utilities of the SmokeTrees
pip install -e .
```

## Example Usage
### Example Usage

- Load Model using Tensorflow

``` Python
from forest_utils import export_keras
model = export_keras.ModelFromH5().load_model()
model = export_keras.ModelFromH5().model
```

- Load Dataset
Expand All @@ -42,4 +50,6 @@ This package will be useful for carrying out all the utilities of the SmokeTrees
tweets = datasets.Dataset().get_emo_tweets()
```

After pulling down the model use it for predictions and other evalutaion functionalities.
After pulling down the model use it for predictions and other evalutaion functionalities.

#### See SmokeTrees ModelZoo for more usage examples
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ == '0.0.5'
__version__ == '0.0.9'
86 changes: 0 additions & 86 deletions forest_utils/export_keras.py

This file was deleted.

7 changes: 0 additions & 7 deletions forest_utils/test/test.py

This file was deleted.

61 changes: 61 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[metadata]
name = forest-utils
# Version needs regex in setup.py.
url = https://github.com/smoke-trees/forest-utils
project_urls =
Documentation = https://github.com/smoke-trees/forest-utils
Code = https://github.com/smoke-trees/forest-utils
Issue tracker = https://github.com/smoke-trees/forest-utils/issues
maintainer = Ubaid Usmani
maintainer_email = usmaniubaid@gmail.com
description = Package for Smoketrees model zoo
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Topic :: Scientific/Engineering :: Artificial Intelligence
Topic :: Scientific/Engineering :: Image Recognition
[options]
packages = find:
package_dir = = src
include_package_data = true
python_requires = >= 3.6
# Dependencies are in setup.py for GitHub's dependency graph.

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
forest = forest_utils.cli:main

[flake8]
# B = bugbear
# E = pycodestyle errors
# F = flake8 pyflakes
# W = pycodestyle warnings
# B9 = bugbear opinions
# ISC = implicit-str-concat
select = B, E, F, W, B9, ISC
ignore =
# slice notation whitespace, invalid
E203
# import at top, too many circular import fixes
E402
# line length, handled by bugbear B950
E501
# bare except, handled by bugbear B001
E722
# bin op line break, invalid
W503
# up to 88 allowed by bugbear B950
max-line-length = 80
per-file-ignores =
# __init__ module exports names
src/flask/__init__.py: F401
19 changes: 7 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import re
import codecs

from setuptools import setup, find_packages

REQUIREMENTS = ['gdown==3.11.1', 'requests==2.24.0', 'tensorflow', 'spacy', 'pandas']

REQUIREMENTS = ['gdown==3.11.1', 'requests==2.24.0', 'tensorflow', 'spacy==2.2.0', 'pandas', "transformers", "torch"]

def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -18,24 +20,17 @@ def get_version(rel_path):
else:
raise RuntimeError("Unable to find version string.")

def get_long_description():
try:
with codecs.open("README.md", encoding="utf-8") as fh:
long_description = fh.read()
return long_description
except FileNotFoundError:
return ""


# Metadata goes in setup.cfg. These are here for GitHub's dependency graph.
setup(
name="forest_utils",
version=get_version('VERSION.txt'),
description="Package for SmokeTrees model zoo",
description="Utility Package for SmokeTrees Model Zoo",
long_description=get_long_description(),
url="https://github.com/smoke-trees/forest-utils",
author="SmokeTrees",
author_email=" info@smoketrees.dev",
python_requires='>=3.4',
python_requires='>=3.6',
packages=find_packages(include=[
"forest_utils.*"
], exclude=["test.*, test"]),
Expand All @@ -50,4 +45,4 @@ def get_long_description():
],
install_requires=REQUIREMENTS,
keywords='utils package modelzoo'
)
)
File renamed without changes.
37 changes: 37 additions & 0 deletions src/forest_utils/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import click
import pkg_resources
from pathlib import Path

from utils import create
from utils import pull

def get_version():
with open(os.path.join('..','..', 'VERSION.txt')) as file:
return file.read().split("==")[-1].strip()

INFORMATION = {
'name': "forest",
'version': get_version(),
}

@click.group(help='A CLI Tool for uploading model to model zoo')
@click.version_option(INFORMATION['version'])
@click.pass_context
def main(ctx):
pass

@main.command(help='Initialize zoo repository')
@click.pass_context
def init(ctx):
create.create_dir_tree()


@main.command(help='Pull models from model zoo')
@click.pass_context
@click.option('--all', '-a', is_flag=True, help="Pull all the files from the github origin")
def pull(ctx, docker):
pull.get_files()

if __name__ == "__main__":
main()
File renamed without changes.
Loading

0 comments on commit 220d6ba

Please sign in to comment.