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

Compatibility for numpy 2.0 #3265

Merged
merged 2 commits into from
Jun 27, 2024
Merged
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
1 change: 1 addition & 0 deletions nerfstudio/cameras/cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Camera Models
"""

import base64
import math
from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/cameras/lie_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Helper for Lie group operations. Currently only used for pose optimization.
"""

import torch
from jaxtyping import Float
from torch import Tensor
Expand Down
7 changes: 3 additions & 4 deletions nerfstudio/cameras/rays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Some ray datastructures.
"""

import random
from dataclasses import dataclass, field
from typing import Callable, Dict, Literal, Optional, Tuple, Union, overload
Expand Down Expand Up @@ -153,15 +154,13 @@ def get_weights(self, densities: Float[Tensor, "*batch num_samples 1"]) -> Float
@staticmethod
def get_weights_and_transmittance_from_alphas(
alphas: Float[Tensor, "*batch num_samples 1"], weights_only: Literal[True]
) -> Float[Tensor, "*batch num_samples 1"]:
...
) -> Float[Tensor, "*batch num_samples 1"]: ...

@overload
@staticmethod
def get_weights_and_transmittance_from_alphas(
alphas: Float[Tensor, "*batch num_samples 1"], weights_only: Literal[False] = False
) -> Tuple[Float[Tensor, "*batch num_samples 1"], Float[Tensor, "*batch num_samples 1"]]:
...
) -> Tuple[Float[Tensor, "*batch num_samples 1"], Float[Tensor, "*batch num_samples 1"]]: ...

@staticmethod
def get_weights_and_transmittance_from_alphas(
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/configs/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""Base Configs"""


from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/datamanagers/parallel_datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Parallel data manager that generates training data in multiple python processes.
"""

from __future__ import annotations

import concurrent.futures
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/arkitscenes_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for ARKitScenes dataset"""

import math
from dataclasses import dataclass, field
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/blender_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for blender dataset"""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
2 changes: 1 addition & 1 deletion nerfstudio/data/dataparsers/colmap_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Data parser for nerfstudio datasets. """
"""Data parser for nerfstudio datasets."""

from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/dnerf_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for blender dataset"""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/dycheck_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for DyCheck (https://arxiv.org/abs/2210.13445) dataset of `iphone` subset"""

from __future__ import annotations

import math
Expand Down
4 changes: 2 additions & 2 deletions nerfstudio/data/dataparsers/nerfosr_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Data parser for NeRF-OSR datasets
"""Data parser for NeRF-OSR datasets

Presented in the paper: https://4dqv.mpi-inf.mpg.de/NeRF-OSR/
Presented in the paper: https://4dqv.mpi-inf.mpg.de/NeRF-OSR/

"""

Expand Down
2 changes: 1 addition & 1 deletion nerfstudio/data/dataparsers/nerfstudio_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Data parser for nerfstudio datasets. """
"""Data parser for nerfstudio datasets."""

from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/nuscenes_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for NuScenes dataset"""

import math
import os
from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/phototourism_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Phototourism dataset parser. Datasets and documentation here: http://phototour.cs.washington.edu/datasets/"""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/dataparsers/scannet_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Data parser for ScanNet dataset"""

import math
from dataclasses import dataclass, field
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion nerfstudio/data/dataparsers/scannetpp_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Data parser for ScanNet++ datasets. """
"""Data parser for ScanNet++ datasets."""

from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/datasets/base_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Dataset.
"""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/data/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Utility functions to allow easy re-use of common operations across dataloaders"""

from pathlib import Path
from typing import List, Tuple, Union

Expand Down
2 changes: 1 addition & 1 deletion nerfstudio/data/utils/dataparsers_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Data parser utils for nerfstudio datasets. """
"""Data parser utils for nerfstudio datasets."""

import math
import os
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/engine/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Callback code used for training iterations
"""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/engine/optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Optimizers class.
"""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/engine/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Code to train model.
"""

from __future__ import annotations

import dataclasses
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/exporter/exporter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Export utils such as structs, point cloud generation, and rendering code.
"""


from __future__ import annotations

import sys
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/exporter/texture_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Texture utils.
"""


from __future__ import annotations

import math
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/exporter/tsdf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
TSDF utils.
"""


from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/field_components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""init field modules"""

from .base_field_component import FieldComponent as FieldComponent
from .encodings import Encoding as Encoding, ScalingAndOffset as ScalingAndOffset
from .mlp import MLP as MLP
1 change: 1 addition & 0 deletions nerfstudio/field_components/base_field_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
The field module baseclass.
"""

from abc import abstractmethod
from typing import Optional

Expand Down
1 change: 0 additions & 1 deletion nerfstudio/field_components/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Code for embeddings.
"""


import torch
from jaxtyping import Shaped
from torch import Tensor
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/field_components/field_heads.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Collection of render heads
"""

from enum import Enum
from typing import Callable, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/field_components/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Multi Layer Perceptron
"""

from typing import Literal, Optional, Set, Tuple, Union

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/fields/density_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Proposal network field.
"""


from typing import Literal, Optional, Tuple

import torch
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/fields/generfacto_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Field for Generfacto model
"""


from typing import Dict, Literal, Optional, Tuple

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/fields/nerfacto_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Field for compound nerf model, adds scene contraction and image embeddings to instant ngp
"""


from typing import Dict, Literal, Optional, Tuple

import torch
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/fields/semantic_nerf_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Semantic NeRF field implementation.
"""

from typing import Dict, Optional, Tuple

import torch
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/fields/tensorf_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""TensoRF Field"""


from typing import Dict, Optional

import torch
Expand Down
1 change: 0 additions & 1 deletion nerfstudio/fields/vanilla_nerf_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""Classic NeRF field"""


from typing import Dict, Optional, Tuple, Type

import torch
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/model_components/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Collection of Losses.
"""

from enum import Enum
from typing import Dict, Literal, Optional, Tuple, cast

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/model_components/ray_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Ray generator.
"""

from jaxtyping import Int
from torch import Tensor, nn

Expand Down
3 changes: 1 addition & 2 deletions nerfstudio/model_components/ray_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ class DensityFn(Protocol):

def __call__(
self, positions: Float[Tensor, "*batch 3"], times: Optional[Float[Tensor, "*batch 1"]] = None
) -> Float[Tensor, "*batch 1"]:
...
) -> Float[Tensor, "*batch 1"]: ...


class VolumetricSampler(Sampler):
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/model_components/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
rgb = rgb_renderer(rgb=field_outputs[FieldHeadNames.RGB], weights=weights)

"""

import contextlib
import math
from typing import Generator, Literal, Optional, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/model_components/shaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Shaders for rendering."""

from typing import Optional

from jaxtyping import Float
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/models/mipnerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Implementation of mip-NeRF.
"""

from __future__ import annotations

from typing import Dict, List, Tuple
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/pipelines/base_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Abstracts for the Pipeline class.
"""

from __future__ import annotations

import typing
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/plugins/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
This package contains specifications used to register plugins.
"""

from dataclasses import dataclass

from nerfstudio.engine.trainer import TrainerConfig
Expand Down
1 change: 1 addition & 0 deletions nerfstudio/scripts/docs/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#!/usr/bin/env python
"""Simple yaml debugger"""

import subprocess
import sys

Expand Down
1 change: 1 addition & 0 deletions nerfstudio/scripts/downloads/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Download datasets and specific captures from the datasets."""

from __future__ import annotations

import json
Expand Down
Loading
Loading