Skip to content

Commit

Permalink
a bit cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
liruilong940607 committed Sep 23, 2023
1 parent 1654a05 commit f25b84d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 61 deletions.
59 changes: 35 additions & 24 deletions .github/workflows/aws/update_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,52 @@

import boto3

ROOT_URL = 'https://nerfacc-bucket.s3.us-west-2.amazonaws.com/whl'
html = '<!DOCTYPE html>\n<html>\n<body>\n{}\n</body>\n</html>'
ROOT_URL = "https://diff_rast-bucket.s3.us-west-2.amazonaws.com/whl"
html = "<!DOCTYPE html>\n<html>\n<body>\n{}\n</body>\n</html>"
href = ' <a href="{}">{}</a><br/>'
args = {
'ContentType': 'text/html',
'CacheControl': 'max-age=300',
'ACL': 'public-read',
"ContentType": "text/html",
"CacheControl": "max-age=300",
"ACL": "public-read",
}

bucket = boto3.resource('s3').Bucket(name='nerfacc-bucket')
bucket = boto3.resource("s3").Bucket(name="diff_rast-bucket")

wheels_dict = defaultdict(list)
for obj in bucket.objects.filter(Prefix='whl'):
if obj.key[-3:] != 'whl':
for obj in bucket.objects.filter(Prefix="whl"):
if obj.key[-3:] != "whl":
continue
torch_version, wheel = obj.key.split('/')[-2:]
wheel = f'{torch_version}/{wheel}'
torch_version, wheel = obj.key.split("/")[-2:]
wheel = f"{torch_version}/{wheel}"
wheels_dict[torch_version].append(wheel)

index_html = html.format('\n'.join([
href.format(f'{torch_version}.html'.replace('+', '%2B'), version)
for version in wheels_dict
]))
index_html = html.format(
"\n".join(
[
href.format(f"{torch_version}.html".replace("+", "%2B"), version)
for version in wheels_dict
]
)
)

with open('index.html', 'w') as f:
with open("index.html", "w") as f:
f.write(index_html)
bucket.Object('whl/index.html').upload_file('index.html', args)
bucket.Object("whl/index.html").upload_file("index.html", args)

for torch_version, wheel_names in wheels_dict.items():
torch_version_html = html.format('\n'.join([
href.format(f'{ROOT_URL}/{wheel_name}'.replace('+', '%2B'), wheel_name)
for wheel_name in wheel_names
]))

with open(f'{torch_version}.html', 'w') as f:
torch_version_html = html.format(
"\n".join(
[
href.format(
f"{ROOT_URL}/{wheel_name}".replace("+", "%2B"), wheel_name
)
for wheel_name in wheel_names
]
)
)

with open(f"{torch_version}.html", "w") as f:
f.write(torch_version_html)
bucket.Object(f'whl/{torch_version}.html').upload_file(
f'{torch_version}.html', args)
bucket.Object(f"whl/{torch_version}.html").upload_file(
f"{torch_version}.html", args
)
10 changes: 5 additions & 5 deletions .github/workflows/building.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ jobs:
- name: Set version
if: ${{ runner.os != 'macOS' }}
run: |
VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' nerfacc/version.py`
VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' diff_rast/version.py`
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION"
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" nerfacc/version.py
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" diff_rast/version.py
shell:
bash

Expand All @@ -134,7 +134,7 @@ jobs:
cd dist
ls -lah
pip install *.whl
python -c "import nerfacc; print('nerfacc:', nerfacc.__version__)"
python -c "import diff_rast; print('diff_rast:', diff_rast.__version__)"
cd ..
shell: bash # `ls -lah` does not exist in windows powershell

Expand All @@ -147,7 +147,7 @@ jobs:

- name: Upload wheel
run: |
aws s3 sync dist s3://nerfacc-bucket/whl/torch-${{ matrix.torch-version }}_${{ matrix.cuda-version }} --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
aws s3 sync dist s3://diff_rast-bucket/whl/torch-${{ matrix.torch-version }}_${{ matrix.cuda-version }} --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
update_aws_listing:
needs: [wheel]
Expand All @@ -169,7 +169,7 @@ jobs:
- name: Update AWS listing
run: |
python scripts/run_aws_listing.py \
--bucket="nerfacc-bucket" \
--bucket="diff_rast-bucket" \
--region="us-west-2"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
run: |
pip install isort==5.10.1 black[jupyter]==22.3.0
- name: Run isort
run: isort docs/ nerfacc/ scripts/ examples/ tests/ --profile black --skip examples/pycolmap --check
run: isort docs/ diff_rast/ scripts/ examples/ tests/ --profile black --skip examples/pycolmap --check
- name: Run Black
run: black docs/ nerfacc/ scripts/ examples/ tests/ --exclude examples/pycolmap --check
run: black docs/ diff_rast/ scripts/ examples/ tests/ --exclude examples/pycolmap --check
# - name: Python Pylint
# run: |
# pylint nerfacc/ tests/ scripts/ examples/
# pylint diff_rast/ tests/ scripts/ examples/
29 changes: 0 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
# import os

# from setuptools import setup
# from torch.utils.cpp_extension import BuildExtension, CUDAExtension

# CSRC = os.path.abspath(f"{__file__}/../../csrc")

# setup(
# name="diff_rast",
# description=" Python package for differentiable rasterization of gaussians",
# keywords="gaussian, splatting, cuda",
# # package_dir = {'': '.'},
# packages=['diff_rast'],
# ext_modules=[
# CUDAExtension(
# name="cuda_lib",
# sources=[
# f"{CSRC}/ext.cpp",
# f"{CSRC}/rasterize.cu",
# f"{CSRC}/bindings.cu",
# f"{CSRC}/forward.cu",
# f"{CSRC}/backward.cu",
# ],
# extra_compile_args={"nvcc": [f"-I {CSRC}/third_party/glm/"]},
# ),
# ],
# cmdclass={"build_ext": BuildExtension},
# )

import glob
import os
import os.path as osp
Expand Down

0 comments on commit f25b84d

Please sign in to comment.