-
Notifications
You must be signed in to change notification settings - Fork 58
/
setup.py
101 lines (95 loc) · 3.54 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
import os
import sys
import gzip
import imp
from itertools import product
from setuptools import setup, find_packages
from urllib.request import urlretrieve
module_dir = 'openl3'
modalities = ['audio', 'image']
input_reprs = ['linear', 'mel128', 'mel256']
content_type = ['music', 'env']
model_version_str = 'v0_4_0'
weight_files = ['openl3_{}_{}_{}.h5'.format(*tup)
for tup in product(modalities, input_reprs, content_type)]
base_url = 'https://github.com/marl/openl3/raw/models/'
if len(sys.argv) > 1 and sys.argv[1] == 'sdist':
# exclude the weight files in sdist
weight_files = []
else:
# in all other cases, decompress the weights file if necessary
for weight_file in weight_files:
weight_path = os.path.join(module_dir, weight_file)
if not os.path.isfile(weight_path):
weight_fname = os.path.splitext(weight_file)[0]
compressed_file = '{}-{}.h5.gz'.format(weight_fname, model_version_str)
compressed_path = os.path.join(module_dir, compressed_file)
if not os.path.isfile(compressed_file):
print('Downloading weight file {} ...'.format(compressed_file))
urlretrieve(base_url + compressed_file, compressed_path)
print('Decompressing ...')
with gzip.open(compressed_path, 'rb') as source:
with open(weight_path, 'wb') as target:
target.write(source.read())
print('Decompression complete')
os.remove(compressed_path)
print('Removing compressed file')
version = imp.load_source('openl3.version', os.path.join('openl3', 'version.py'))
with open('README.md', encoding='utf8') as file:
long_description = file.read()
setup(
name='openl3',
version=version.version,
description='Deep audio and image embeddings, based on Look, Listen, and Learn approach',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/marl/openl3',
author='Aurora Cramer, Ho-Hsiang Wu, Bea Steers, and Justin Salamon',
author_email='[email protected]',
packages=find_packages(),
entry_points={
'console_scripts': ['openl3=openl3.cli:main'],
},
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
'Topic :: Multimedia :: Sound/Audio :: Analysis',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
keywords='deep audio embeddings machine listening learning tensorflow keras',
project_urls={
'Source': 'https://github.com/marl/openl3',
'Tracker': 'https://github.com/marl/openl3/issues',
'Documentation': 'https://readthedocs.org/projects/openl3/'
},
install_requires=[
'tensorflow>=2.0.0',
'numpy>=1.13.0',
'scipy>=0.19.1',
'kapre>=0.3.5',
'soundfile>=0.9.0.post1',
'resampy>=0.2.1,<0.3.0',
'h5py>=2.7.0',
'moviepy>=1.0.0',
'scikit-image>=0.14.3',
'librosa>=0.7.2', # version limit from kapre
],
extras_require={
'docs': [
'sphinx',
'sphinxcontrib-napoleon',
'sphinx_rtd_theme',
'numpydoc',
],
'tests': []
},
package_data={
'openl3': weight_files
},
)