Skip to content

Commit 54af3e1

Browse files
committed
add gitignore, add urls, change gce download to public urls
1 parent 711a575 commit 54af3e1

File tree

4 files changed

+145
-3
lines changed

4 files changed

+145
-3
lines changed

.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Global
2+
.DS_Store
3+
.idea
4+
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
MANIFEST
33+
34+
# PyInstaller
35+
# Usually these files are written by a python script from a template
36+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
37+
*.manifest
38+
*.spec
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
*.py,cover
55+
.hypothesis/
56+
.pytest_cache/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
.python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# Jukebox
44
Code for "Jukebox: A Generative Model for Music"
55

6+
[Paper](https://cdn.openai.com/jukebox.pdf)
7+
[Blog](https://openai.com/blog/jukebox)
8+
[Explorer](http://jukebox.openai.com/)
9+
[Colab](https://colab.research.google.com/drive/1IQcUNjxLs79YVKLF-A8ghFLCaVYHjc4v)
10+
611
# Install
712
```
813
# Required: Sampling

jukebox/make_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def load_checkpoint(path):
3131
if not os.path.dirname(local_path):
3232
os.makedirs(os.path.dirname(local_path))
3333
if not os.path.exists(local_path):
34-
download(gs_path, local_path, False)
34+
download(gs_path, local_path)
3535
restore = local_path
3636
dist.barrier()
3737
checkpoint = t.load(restore, map_location=t.device('cpu'))

jukebox/utils/gcs_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
import sys
33
import subprocess
44
from time import time
5+
from urllib.request import urlretrieve
56

6-
def download(gs_path, local_path, async_download=False):
7+
def gs_download(gs_path, local_path, async_download=False):
78
args = ['gsutil',
89
'-o', 'GSUtil:parallel_thread_count=1',
910
'-o', 'GSUtil:sliced_object_download_max_components=8',
@@ -14,7 +15,7 @@ def download(gs_path, local_path, async_download=False):
1415
subprocess.call(args)
1516

1617

17-
def upload(local_path, gs_path, async_upload=False):
18+
def gs_upload(local_path, gs_path, async_upload=False):
1819
# NOTE: Download and upload have differ -o flags.
1920
# We also use -n to prevent clobbering checkpoints by mistake
2021
assert not local_path.startswith("gs://")
@@ -27,6 +28,9 @@ def upload(local_path, gs_path, async_upload=False):
2728
else:
2829
subprocess.call(args)
2930

31+
def download(gs_path, local_path):
32+
remote_path = gs_path.replace("gs://", "https://storage.googleapis.com/")
33+
urlretrieve(remote_path, local_path)
3034

3135
def ls(regex):
3236
outputs = subprocess.check_output(['gsutil', 'ls', regex]).decode(sys.stdout.encoding)

0 commit comments

Comments
 (0)