From 6baf31dc9a9d81e6b44478bd31e0c0bc575493b2 Mon Sep 17 00:00:00 2001 From: Matthew Tancik Date: Tue, 15 Nov 2022 09:51:23 -0800 Subject: [PATCH] Fix python 3.7 support (#959) --- .github/workflows/core_code_checks.yml | 4 ++-- nerfstudio/data/datamanagers/base_datamanager.py | 3 ++- nerfstudio/engine/trainer.py | 3 ++- nerfstudio/pipelines/base_pipeline.py | 3 ++- nerfstudio/pipelines/dynamic_batch.py | 3 ++- nerfstudio/utils/eval_utils.py | 3 ++- pyproject.toml | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/core_code_checks.yml b/.github/workflows/core_code_checks.yml index 3c9195f2a..86ff5ccca 100644 --- a/.github/workflows/core_code_checks.yml +++ b/.github/workflows/core_code_checks.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8.12 + - name: Set up Python 3.7.13 uses: actions/setup-python@v4 with: - python-version: '3.8.12' + python-version: '3.7.13' - uses: actions/cache@v2 with: path: ${{ env.pythonLocation }} diff --git a/nerfstudio/data/datamanagers/base_datamanager.py b/nerfstudio/data/datamanagers/base_datamanager.py index 1e6b6669d..a895fb7b8 100644 --- a/nerfstudio/data/datamanagers/base_datamanager.py +++ b/nerfstudio/data/datamanagers/base_datamanager.py @@ -20,7 +20,7 @@ from __future__ import annotations from abc import abstractmethod from dataclasses import dataclass, field -from typing import Dict, List, Literal, Optional, Tuple, Type, Union +from typing import Dict, List, Optional, Tuple, Type, Union import torch import tyro @@ -29,6 +29,7 @@ from torch import nn from torch.nn import Parameter from torch.utils.data import Dataset from torch.utils.data.distributed import DistributedSampler +from typing_extensions import Literal from nerfstudio.cameras.camera_optimizers import CameraOptimizerConfig from nerfstudio.cameras.rays import RayBundle diff --git a/nerfstudio/engine/trainer.py b/nerfstudio/engine/trainer.py index 60f0a6dbe..d35ebfeee 100644 --- a/nerfstudio/engine/trainer.py +++ b/nerfstudio/engine/trainer.py @@ -21,11 +21,12 @@ import dataclasses import functools import os import time -from typing import Dict, List, Literal, Tuple +from typing import Dict, List, Tuple import torch from rich.console import Console from torch.cuda.amp.grad_scaler import GradScaler +from typing_extensions import Literal from nerfstudio.configs import base_config as cfg from nerfstudio.engine.callbacks import ( diff --git a/nerfstudio/pipelines/base_pipeline.py b/nerfstudio/pipelines/base_pipeline.py index 11930143b..c0927c57a 100644 --- a/nerfstudio/pipelines/base_pipeline.py +++ b/nerfstudio/pipelines/base_pipeline.py @@ -21,7 +21,7 @@ import typing from abc import abstractmethod from dataclasses import dataclass, field from time import time -from typing import Any, Dict, List, Literal, Optional, Type, Union, cast +from typing import Any, Dict, List, Optional, Type, Union, cast import torch import torch.distributed as dist @@ -35,6 +35,7 @@ from rich.progress import ( from torch import nn from torch.nn import Parameter from torch.nn.parallel import DistributedDataParallel as DDP +from typing_extensions import Literal from nerfstudio.configs import base_config as cfg from nerfstudio.data.datamanagers.base_datamanager import ( diff --git a/nerfstudio/pipelines/dynamic_batch.py b/nerfstudio/pipelines/dynamic_batch.py index b169dfd55..788f68e82 100644 --- a/nerfstudio/pipelines/dynamic_batch.py +++ b/nerfstudio/pipelines/dynamic_batch.py @@ -17,9 +17,10 @@ A pipeline that dynamically chooses the number of rays to sample. """ from dataclasses import dataclass, field -from typing import Literal, Type +from typing import Type import torch +from typing_extensions import Literal from nerfstudio.data.datamanagers.base_datamanager import VanillaDataManager from nerfstudio.pipelines.base_pipeline import VanillaPipeline, VanillaPipelineConfig diff --git a/nerfstudio/utils/eval_utils.py b/nerfstudio/utils/eval_utils.py index 29a0dcada..7401a916c 100644 --- a/nerfstudio/utils/eval_utils.py +++ b/nerfstudio/utils/eval_utils.py @@ -20,11 +20,12 @@ from __future__ import annotations import os import sys from pathlib import Path -from typing import Literal, Optional, Tuple +from typing import Optional, Tuple import torch import yaml from rich.console import Console +from typing_extensions import Literal from nerfstudio.configs import base_config as cfg from nerfstudio.pipelines.base_pipeline import Pipeline diff --git a/pyproject.toml b/pyproject.toml index 59a74727e..52b5abfc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -146,5 +146,5 @@ reportMissingTypeStubs = false reportPrivateImportUsage = false reportUndefinedVariable = false -pythonVersion = "3.8" +pythonVersion = "3.7" pythonPlatform = "Linux"