Skip to content

Commit

Permalink
add download sctipts and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JADGardner committed Nov 27, 2023
1 parent b283646 commit 0c3f595
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ c. Close and reopen your terminal and source conda environment again:
conda activate nerfstudio
```

## Download Data
## Download Data and Pretrained Models

```bash
python3 python3 scripts/download_data.py output/data/path/

python3 python3 scripts/download_models.py output/model/path/
```
Empty file removed reni/scripts/download.py
Empty file.
File renamed without changes.
37 changes: 37 additions & 0 deletions scripts/download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import requests
import zipfile
import os
import sys

def download_file(url, dest_folder):
if not os.path.exists(dest_folder):
os.makedirs(dest_folder)

filename = os.path.join(dest_folder, url.split('/')[-1])

with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
return filename

def unzip_file(zip_path, extract_to):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(extract_to)

if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py <output_folder>")
sys.exit(1)

output_folder = sys.argv[1]
url = "https://www.dropbox.com/scl/fi/ina6ybbd2cipjd95ttfe9/RENI_HDR.zip?rlkey=4zrouszs5wx5b3wfmqxoi9hkl&dl=1" # dl=1 is important for direct download

print("Downloading...")
zip_path = download_file(url, output_folder)

print("Unzipping...")
unzip_file(zip_path, output_folder)

print("Done!")
37 changes: 37 additions & 0 deletions scripts/download_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import requests
import zipfile
import os
import sys

def download_file(url, dest_folder):
if not os.path.exists(dest_folder):
os.makedirs(dest_folder)

filename = os.path.join(dest_folder, url.split('/')[-1])

with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
return filename

def unzip_file(zip_path, extract_to):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(extract_to)

if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py <output_folder>")
sys.exit(1)

output_folder = sys.argv[1]
url = "https://www.dropbox.com/scl/fi/tw6ukedy9oc8anx0s02kk/reni_plus_plus_models.zip?rlkey=smr8ecsw919cokzmot7dksxgx&dl=1" # dl=1 is important for direct download

print("Downloading...")
zip_path = download_file(url, output_folder)

print("Unzipping...")
unzip_file(zip_path, output_folder)

print("Done!")

0 comments on commit 0c3f595

Please sign in to comment.