Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{lib,tools}[foss/2023a,gfbf/2023a] PyTorch3D v0.7.8, visdom v0.2.4 w/ CUDA 12.1.1 #21763

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
easyblock = 'PythonBundle'

name = 'PyTorch3D'
version = '0.7.8'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = "https://pytorch3d.org/"
description = """PyTorch3D is FAIR's library of reusable components for deep learning with 3D data."""

toolchain = {'name': 'foss', 'version': '2023a'}

builddependencies = [
# Building
('hatchling', '1.18.0'),
# Testing
('Python-bundle-PyPI', '2023.06'), # pytest
('scikit-image', '0.22.0'),
('OpenCV', '4.8.1', versionsuffix + '-contrib'),
('plotly.py', '5.16.0'),
('SQLAlchemy', '2.0.25'),
('visdom', '0.2.4'),
]

dependencies = [
('Python', '3.11.3'),
('CUDA', '12.1.1', '', SYSTEM),
('tqdm', '4.66.1'),
('PyTorch-bundle', '2.1.2', versionsuffix), # for portalocker, torchvision
('imageio', '2.33.1'),
('IPython', '8.14.0'),
('PyOpenGL', '3.1.7'),
('PyCUDA', '2024.1', versionsuffix),
]

sanity_pip_check = True
use_pip = True

exts_list = [
('termcolor', '2.3.0', {
'checksums': ['b5b08f68937f138fe92f6c089b99f1e2da0ae56c52b78bf7075fd95420fd9a5a'],
}),
('yacs', '0.1.8', {
'checksums': ['efc4c732942b3103bea904ee89af98bcd27d01f0ac12d8d4d369f1e7a2914384'],
}),
('iopath', '0.1.10', {
'checksums': ['3311c16a4d9137223e20f141655759933e1eda24f8bff166af834af3c645ef01'],
}),
('antlr4-python3-runtime', '4.9.3', {
'modulename': 'antlr4',
'checksums': ['f224469b4168294902bb1efa80a8bf7855f24c99aef99cbefc1bcd3cce77881b'],
}),
('omegaconf', '2.3.0', {
'checksums': ['d5d4b6d29955cc50ad50c46dc269bcd92c6e00f5f90d23ab5fee7bfca4ba4cc7'],
}),
('lpips', '0.1.4', {
'checksums': ['3846331df6c69688aec3d300a5eeef6c529435bc8460bd58201c3d62e56188fa'],
}),
(name, version, {
'patches': [
'PyTorch3D-0.7.8_fix-opengl-test-hang.patch',
'PyTorch3D-0.7.8_use-installdir-in-test.patch',
'PyTorch3D-0.7.8_squeeze-1-channel-imgs-in-test.patch',
'PyTorch3D-0.7.8_bar-dataclass-immutable-in-test.patch',
'PyTorch3D-0.7.8_remove-relative-sys-path-insert.patch',
'PyTorch3D-0.7.8_fix-kwarg-only-in-test.patch',
'PyTorch3D-0.7.8_fix-test_io_off-np-error-msg.patch',
'PyTorch3D-0.7.8_fix-data_path-in-test-cow.patch',
],
'source_tmpl': 'V%(version)s.tar.gz',
'source_urls': ['https://github.com/facebookresearch/%(namelower)s/archive'],
'checksums': [
{'V0.7.8.tar.gz': 'd91298b17ec203fbcea62587e4e9c36b1ef717f98114d6919ff9acece5ea0f99'},
{'PyTorch3D-0.7.8_fix-opengl-test-hang.patch':
'f23cac69535f4c72857688b9fcb8dbd1813a857653ea38e84d958e212b45d139'},
{'PyTorch3D-0.7.8_use-installdir-in-test.patch':
'02298334e742c6cf85c4656afe706530dad9bf91ff75cc39d221a8621bd398b2'},
{'PyTorch3D-0.7.8_squeeze-1-channel-imgs-in-test.patch':
'b0ae109c4cce9cfdb7eeab7155b826944a1ffdbd9613c3ba217d310614642d59'},
{'PyTorch3D-0.7.8_bar-dataclass-immutable-in-test.patch':
'82d1162410b8217557dffba9c1bbb21db3f9eaccaa1398cba4c0fa74ff50cf69'},
{'PyTorch3D-0.7.8_remove-relative-sys-path-insert.patch':
'b1f1da4a9b610a139c13efb733e564d17213daa714cbd83dcf3217ea68687936'},
{'PyTorch3D-0.7.8_fix-kwarg-only-in-test.patch':
'4a1036e9c3a51655155d88a86051f6469a10fbbb5d2dee57dc0fefba9b95e5bf'},
{'PyTorch3D-0.7.8_fix-test_io_off-np-error-msg.patch':
'72a2c811783bdb30615fbc25ae0c550718a5fa0c65d5eb6bfafa43330a770d96'},
{'PyTorch3D-0.7.8_fix-data_path-in-test-cow.patch':
'e08380207e4eb994cece7d3b052ecc21358695b267c0dd52b9c630830d3a66b8'}

],
'testinstall': True,
'runtest': (
# Running in srcdir will make pytorch3d overshadow testinstall
'ln -s $PWD/tests/ ../tests'
' && ln -s $PWD/docs ../docs' # includes data used in tests
' && ln -s $PWD/website ../website' # used in test_build (consider skipping instead)
' && cd ../'
# Run tests
' && pytest -ra tests/'
# Flaky (see https://github.com/facebookresearch/pytorch3d/issues/1914)
' --deselect=tests/test_knn.py::TestKNN::test_knn_vs_python_square_cuda'
' --deselect=tests/test_points_alignment.py::TestICP::test_heterogeneous_inputs'
' --deselect=tests/test_render_meshes.py::TestRenderMeshes::test_simple_sphere_elevated_camera'
# Requires multiple GPUs
#' --deselect=tests/test_pointclouds.py::TestPointclouds::test_to_list'
#' --deselect=tests/test_pointclouds.py::TestPointclouds::test_to_tensor'
#' --deselect=tests/test_render_multigpu.py::TestRenderMeshesMultiGPU::test_mesh_renderer_opengl_to'
#' --deselect=tests/test_render_multigpu.py::TestRenderMeshesMultiGPU::test_mesh_renderer_to'
#' --deselect=tests/test_render_multigpu.py::TestRenderMeshesMultiGPU::test_render_meshes'
#' --deselect=tests/test_render_multigpu.py::TestRenderMeshesMultiGPU::test_render_meshes_opengl'
#' --deselect=tests/test_rendering_utils.py::TestTensorProperties::test_to'
# Something is wrong with test_opengl_utils.py, run separately
' --ignore=tests/test_opengl_utils.py'
' && pytest -ra tests/test_opengl_utils.py'
# Seems harmless, see https://github.com/facebookresearch/pytorch3d/issues/1759#issuecomment-2003868471
' --deselect tests/test_opengl_utils.py::TestOpenGLUtils::test_no_egl_error'
),
}),
]

moduleclass = 'tools'
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From e3bec5a44cbe20aa4dd2470855943c1572e5feac Mon Sep 17 00:00:00 2001
From: Viktor Rehnberg <viktor.rehnberg@gmail.com>
Date: Fri, 1 Nov 2024 15:01:51 +0000
Subject: [PATCH] Make Bar dataclass immutable

---
tests/implicitron/test_config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/implicitron/test_config.py b/tests/implicitron/test_config.py
index 471451b..2ae4f4a 100644
--- a/tests/implicitron/test_config.py
+++ b/tests/implicitron/test_config.py
@@ -246,7 +246,7 @@ class TestConfig(unittest.TestCase):

enable_get_default_args(Foo)

- @dataclass()
+ @dataclass(frozen=True)
class Bar:
aa: int = 9
bb: int = 9
--
2.39.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 13d4d579c23d2c7b9b858b7ea60f1bc0df2629a5 Mon Sep 17 00:00:00 2001
From: Viktor Rehnberg <viktor.rehnberg@gmail.com>
Date: Thu, 7 Nov 2024 15:59:34 +0000
Subject: [PATCH] Fix path to cow.obj in test

---
tests/implicitron/test_data_cow.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/implicitron/test_data_cow.py b/tests/implicitron/test_data_cow.py
index 801863e..6471cf0 100644
--- a/tests/implicitron/test_data_cow.py
+++ b/tests/implicitron/test_data_cow.py
@@ -14,7 +14,7 @@ from pytorch3d.implicitron.dataset.rendered_mesh_dataset_map_provider import (
)
from pytorch3d.implicitron.tools.config import expand_args_fields
from pytorch3d.renderer import FoVPerspectiveCameras
-from tests.common_testing import TestCaseMixin
+from tests.common_testing import get_pytorch3d_dir, TestCaseMixin


inside_re_worker = os.environ.get("INSIDE_RE_WORKER", False)
@@ -29,7 +29,8 @@ class TestDataCow(TestCaseMixin, unittest.TestCase):
self._runtest(use_point_light=False, num_views=4)

def _runtest(self, **kwargs):
- provider = RenderedMeshDatasetMapProvider(**kwargs)
+ data_file = get_pytorch3d_dir() / "docs" / "tutorials" / "data" / "cow_mesh" / "cow.obj"
+ provider = RenderedMeshDatasetMapProvider(data_file=data_file, **kwargs)
dataset_map = provider.get_dataset_map()
known_matrix = torch.zeros(1, 4, 4)
known_matrix[0, 0, 0] = 1.7321
--
2.39.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 2c9d00ccb10e1f2e14b0742b46e8b2de88465d2c Mon Sep 17 00:00:00 2001
From: Viktor Rehnberg <viktor.rehnberg@gmail.com>
Date: Mon, 4 Nov 2024 15:55:15 +0000
Subject: [PATCH] Fix kwarg only in test_extending_data_frame build

---
tests/implicitron/test_extending_orm_types.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/implicitron/test_extending_orm_types.py b/tests/implicitron/test_extending_orm_types.py
index e6ceb86..c15f7fa 100644
--- a/tests/implicitron/test_extending_orm_types.py
+++ b/tests/implicitron/test_extending_orm_types.py
@@ -87,7 +87,7 @@ class CanineFrameDataBuilder(
sequence_annotation: types.SequenceAnnotation,
load_blobs: bool = True,
) -> CanineFrameData:
- frame_data = super().build(frame_annotation, sequence_annotation, load_blobs)
+ frame_data = super().build(frame_annotation, sequence_annotation, load_blobs=load_blobs)
frame_data.num_dogs = frame_annotation.num_dogs or 101
frame_data.magnetic_field_average_flux_density = (
frame_annotation.magnetic_field.average_flux_density
--
2.39.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
From 81d82980bc82fd605f27cca87f89ba08af94db3d Mon Sep 17 00:00:00 2001
From: Jeremy Reizenstein <reizenstein@meta.com>
Date: Wed, 6 Nov 2024 11:40:42 -0800
Subject: [PATCH] Fix ogl test hang

Summary: See https://github.com/facebookresearch/pytorch3d/issues/1908

Reviewed By: MichaelRamamonjisoa

Differential Revision: D65280253

fbshipit-source-id: ec05902c5f2f7eb9ddd92bda0045cc3564b8c091
---
pytorch3d/renderer/opengl/opengl_utils.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/pytorch3d/renderer/opengl/opengl_utils.py b/pytorch3d/renderer/opengl/opengl_utils.py
index 8201b307..73b1800c 100755
--- a/pytorch3d/renderer/opengl/opengl_utils.py
+++ b/pytorch3d/renderer/opengl/opengl_utils.py
@@ -184,7 +184,7 @@ def __init__(self, width: int, height: int, cuda_device_id: int = 0) -> None:
"""
# Lock used to prevent multiple threads from rendering on the same device
# at the same time, creating/destroying contexts at the same time, etc.
- self.lock = threading.Lock()
+ self.lock = threading.RLock()
self.cuda_device_id = cuda_device_id
self.device = _get_cuda_device(self.cuda_device_id)
self.width = width
@@ -224,15 +224,14 @@ def active_and_locked(self):
Throws:
EGLError when the context cannot be made current or make non-current.
"""
- self.lock.acquire()
- egl.eglMakeCurrent(self.dpy, self.surface, self.surface, self.context)
- try:
- yield
- finally:
- egl.eglMakeCurrent(
- self.dpy, egl.EGL_NO_SURFACE, egl.EGL_NO_SURFACE, egl.EGL_NO_CONTEXT
- )
- self.lock.release()
+ with self.lock:
+ egl.eglMakeCurrent(self.dpy, self.surface, self.surface, self.context)
+ try:
+ yield
+ finally:
+ egl.eglMakeCurrent(
+ self.dpy, egl.EGL_NO_SURFACE, egl.EGL_NO_SURFACE, egl.EGL_NO_CONTEXT
+ )

def get_context_info(self) -> Dict[str, Any]:
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
From dd2a11b5fc671523628783b63220c29621f8063c Mon Sep 17 00:00:00 2001
From: Jeremy Reizenstein <reizenstein@meta.com>
Date: Wed, 6 Nov 2024 11:13:59 -0800
Subject: [PATCH] Fix OFF for new numpy errors

Summary: Error messages have changed around numpy version 2, making existing code fail.

Reviewed By: MichaelRamamonjisoa

Differential Revision: D65280674

fbshipit-source-id: b3ae613ea8f0f4ae20fb6e5e816314b8c10e6c65
---
pytorch3d/io/off_io.py | 2 +-
tests/test_io_off.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pytorch3d/io/off_io.py b/pytorch3d/io/off_io.py
index 78b4390d4..421816101 100644
--- a/pytorch3d/io/off_io.py
+++ b/pytorch3d/io/off_io.py
@@ -84,7 +84,7 @@ def _read_faces_lump(
)
data = np.loadtxt(file, dtype=np.float32, ndmin=2, max_rows=n_faces)
except ValueError as e:
- if n_faces > 1 and "Wrong number of columns" in e.args[0]:
+ if n_faces > 1 and "number of columns" in e.args[0]:
file.seek(old_offset)
return None
raise ValueError("Not enough face data.") from None
diff --git a/tests/test_io_off.py b/tests/test_io_off.py
index 6a5dc669a..c92f65de1 100644
--- a/tests/test_io_off.py
+++ b/tests/test_io_off.py
@@ -286,15 +286,15 @@ def load(lines):

lines2 = lines.copy()
lines2[0] = "6 2 0"
- with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
+ with self.assertRaisesRegex(ValueError, "number of columns"):
load(lines2)

lines2[0] = "5 1 0"
- with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
+ with self.assertRaisesRegex(ValueError, "number of columns"):
load(lines2)

lines2[0] = "16 2 0"
- with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
+ with self.assertRaisesRegex(ValueError, "number of columns"):
load(lines2)

lines2[0] = "3 3 0"
@@ -312,7 +312,7 @@ def load(lines):

lines2 = lines.copy()
lines2[2] = "7.3 4.2 8.3 932"
- with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 2"):
+ with self.assertRaisesRegex(ValueError, "number of columns"):
load(lines2)

lines2[1] = "7.3 4.2 8.3 932"
Loading
Loading