forked from eliteservice1002/mlmodels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·352 lines (237 loc) · 9.87 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# pylint: disable=C0321,C0103,C0301,E1305,E1121,C0302,C0330,C0111,W0613,W0611,R1705
# -*- coding: utf-8 -*-
"""
"""
import io
import os
import subprocess
import sys
from setuptools import find_packages, setup
######################################################################################
root = os.path.abspath(os.path.dirname(__file__))
##### check if GPU available #########################################################
"""
try :
p = subprocess.Popen(["command -v nvidia-smi"], stdout=subprocess.PIPE, shell=True)
out = p.communicate()[0].decode("utf8")
gpu_available = len(out) > 0
except : pass
"""
##### Version #######################################################################
version ='0.35.2'
cmdclass= None
#### Issues When Building on Colab
#import versioneer
#version = versioneer.get_version()
#cmdclass=versioneer.get_cmdclass()
print("version", version)
######################################################################################
with open('requirements.txt') as fp:
install_requires = fp.read()
######################################################################################
#with open("README.md", "r") as fh:
# long_description = fh.read()
long_description = """
```
This repository is the ***Model ZOO for Pytorch, Tensorflow, Keras, Gluon, LightGBM, Keras, Sklearn models etc*** with Lightweight Functional interface to wrap access to Recent and State of Art Deep Learning, ML models and Hyper-Parameter Search, cross platforms that follows the logic of sklearn, such as fit, predict, transform, metrics, save, load etc.
Now, more than **60 recent models** (> 2018) are available in those domains :
* Time Series,
* Text classification,
* Vision,
* Image Generation,Text generation,
* Gradient Boosting, Automatic Machine Learning tuning,
* Hyper-parameter search.
With the goal to transform Script/Research code into re-usable batch/code with minimal code change, we used functional interface instead of pure OOP. This is because functional reduces the amount of code needed which is good to scientific computing. Thus, we can focus on the computing part than design. Also, it is easy to maintain for medium size project.
##### Include models :
https://github.com/arita37/mlmodels/blob/dev/README.md
```
"""
"""
import os
def package_files(directory):
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join('..', path, filename))
return paths
from pathlib import Path
import inspect
root_path = Path("mlmodels/")
extra_files = package_files( root_path )
print(root_path)
print( __pkgname__ )
"""
### Packages ########################################################
packages = ["mlmodels"] + ["mlmodels." + p for p in find_packages("mlmodels")]
print(packages)
### CLI Scripts ####################################################
"""
scripts = [ "mlmodels/models.py",
"mlmodels/optim.py",
"mlmodels/",
]
"""
scripts = [ "mlmodels/distri_torch_mpirun.sh",
]
### CLI Scripts ###################################################
entry_points={ 'console_scripts': [
'ml_models = mlmodels.models:main'
,'ml_optim = mlmodels.optim:main'
,'ml_test = mlmodels.ztest:main'
,'ml_benchmark = mlmodels.benchmark:main'
,'ml_distributed = mlmodels.distributed:main' ### Not functionnal
] }
##################################################################
setup(
name="mlmodels",
description="Generic model API, Model Zoo in Tensorflow, Keras, Pytorch, Gluon and Hyperparamter search",
keywords='Machine Learning Interface library',
author="Kevin Noel, MLMODELS Team",
author_email="[email protected]",
url="https://github.com/arita37/mlmodels",
install_requires=install_requires,
python_requires='>=3.6.5',
packages=packages,
include_package_data=True,
# package_data= {'': extra_files},
package_data={
'': ['*','*/*','*/*/*','*/*/*/*']
},
### Versioning
version=version,
#cmdclass=cmdclass,
#### CLI
scripts = scripts,
### CLI pyton
entry_points= entry_points,
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: ' +
'Artificial Intelligence',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: ' +
'Python Modules',
'Topic :: Scientific/Engineering :: Information Analysis',
'Environment :: Console',
'Environment :: Web Environment',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
]
)
################################################################################
################################################################################
"""
https://packaging.python.org/tutorials/packaging-projects/
import io
import os
import subprocess
import sys
from setuptools import setup, find_packages
root = os.path.abspath(os.path.dirname(__file__))
# required packages for NLP Architect
with open('requirements.txt') as fp:
install_requirements = fp.readlines()
# check if GPU available
p = subprocess.Popen(['command -v nvidia-smi'], stdout=subprocess.PIPE, shell=True)
out = p.communicate()[0].decode('utf8')
gpu_available = len(out) > 0
# Tensorflow version (make sure CPU/MKL/GPU versions exist before changing)
for r in install_requirements:
if r.startswith('tensorflow=='):
tf_version = r.split('==')[1]
# default TF is CPU
chosen_tf = 'tensorflow=={}'.format(tf_version)
# check system is linux for MKL/GPU backends
if 'linux' in sys.platform:
system_type = 'linux'
tf_be = os.getenv('NLP_ARCHITECT_BE', False)
if tf_be and 'mkl' == tf_be.lower():
chosen_tf = 'intel-tensorflow=={}'.format(tf_version)
elif tf_be and 'gpu' == tf_be.lower() and gpu_available:
chosen_tf = 'tensorflow-gpu=={}'.format(tf_version)
for r in install_requirements:
if r.startswith('tensorflow=='):
install_requirements[install_requirements.index(r)] = chosen_tf
with open('README.md', encoding='utf8') as fp:
long_desc = fp.read()
with io.open(os.path.join(root, 'nlp_architect', 'version.py'), encoding='utf8') as f:
version_f = {}
exec(f.read(), version_f)
version = version_f['NLP_ARCHITECT_VERSION']
setup(name='nlp-architect',
version=version,
description='Intel AI Lab\'s open-source NLP and NLU research library',
long_description=long_desc,
long_description_content_type='text/markdown',
keywords='NLP NLU deep learning natural language processing tensorflow keras dynet',
author='Intel AI Lab',
packages=find_packages(exclude=['tests.*', 'tests', '*.tests', '*.tests.*',
'examples.*', 'examples', '*.examples', '*.examples.*']),
install_requires=install_requirements,
scripts=['nlp_architect/nlp_architect'],
include_package_data=True,
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: ' +
'Artificial Intelligence',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: ' +
'Python Modules',
'Topic :: Scientific/Engineering :: Information Analysis',
'Environment :: Console',
'Environment :: Web Environment',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
]
)
import os
from io import open
from setuptools import find_packages, setup
packages = ['elfi'] + ['elfi.' + p for p in find_packages('elfi')]
# include C++ examples
package_data = {'elfi.examples': ['cpp/Makefile', 'cpp/*.txt', 'cpp/*.cpp']}
with open('requirements.txt', 'r') as f:
requirements = f.read().splitlines()
optionals = {'doc': ['Sphinx'], 'graphviz': ['graphviz>=0.7.1']}
# read version number
__version__ = open('elfi/__init__.py').readlines()[-1].split(' ')[-1].strip().strip("'\"")
setup(
name='elfi',
keywords='abc likelihood-free statistics',
packages=packages,
package_data=package_data,
version=__version__,
author='ELFI authors',
author_email='[email protected]',
url='http://elfi.readthedocs.io',
install_requires=requirements,
extras_require=optionals,
description='ELFI - Engine for Likelihood-free Inference',
long_description=(open('docs/description.rst').read()),
license='BSD',
classifiers=[
'Programming Language :: Python :: 3.5', 'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Mathematics', 'Operating System :: OS Independent',
'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License'
],
zip_safe=False)
"""