Commit 38afdcfc authored by generatedunixname89002005307016's avatar generatedunixname89002005307016 Committed by Facebook GitHub Bot
Browse files

upgrade pyre version in `fbcode/vision` - batch 2

Reviewed By: bottler

Differential Revision: D60992234

fbshipit-source-id: 899db6ed590ef966ff651c11027819e59b8401a3
parent 1e0b1d9c
......@@ -99,7 +99,7 @@ except ModuleNotFoundError:
no_accelerate = os.environ.get("PYTORCH3D_NO_ACCELERATE") is not None
class Experiment(Configurable): # pyre-ignore: 13
class Experiment(Configurable):
"""
This class is at the top level of Implicitron's config hierarchy. Its
members are high-level components necessary for training an implicit rende-
......@@ -120,12 +120,16 @@ class Experiment(Configurable): # pyre-ignore: 13
will be saved here.
"""
# pyre-fixme[13]: Attribute `data_source` is never initialized.
data_source: DataSourceBase
data_source_class_type: str = "ImplicitronDataSource"
# pyre-fixme[13]: Attribute `model_factory` is never initialized.
model_factory: ModelFactoryBase
model_factory_class_type: str = "ImplicitronModelFactory"
# pyre-fixme[13]: Attribute `optimizer_factory` is never initialized.
optimizer_factory: OptimizerFactoryBase
optimizer_factory_class_type: str = "ImplicitronOptimizerFactory"
# pyre-fixme[13]: Attribute `training_loop` is never initialized.
training_loop: TrainingLoopBase
training_loop_class_type: str = "ImplicitronTrainingLoop"
......
......@@ -45,7 +45,7 @@ class ModelFactoryBase(ReplaceableBase):
@registry.register
class ImplicitronModelFactory(ModelFactoryBase): # pyre-ignore [13]
class ImplicitronModelFactory(ModelFactoryBase):
"""
A factory class that initializes an implicit rendering model.
......@@ -61,6 +61,7 @@ class ImplicitronModelFactory(ModelFactoryBase): # pyre-ignore [13]
"""
# pyre-fixme[13]: Attribute `model` is never initialized.
model: ImplicitronModelBase
model_class_type: str = "GenericModel"
resume: bool = True
......
......@@ -30,13 +30,13 @@ from .utils import seed_all_random_engines
logger = logging.getLogger(__name__)
# pyre-fixme[13]: Attribute `evaluator` is never initialized.
class TrainingLoopBase(ReplaceableBase):
"""
Members:
evaluator: An EvaluatorBase instance, used to evaluate training results.
"""
# pyre-fixme[13]: Attribute `evaluator` is never initialized.
evaluator: Optional[EvaluatorBase]
evaluator_class_type: Optional[str] = "ImplicitronEvaluator"
......
......@@ -41,7 +41,7 @@ class DataSourceBase(ReplaceableBase):
@registry.register
class ImplicitronDataSource(DataSourceBase): # pyre-ignore[13]
class ImplicitronDataSource(DataSourceBase):
"""
Represents the data used in Implicitron. This is the only implementation
of DataSourceBase provided.
......@@ -52,8 +52,11 @@ class ImplicitronDataSource(DataSourceBase): # pyre-ignore[13]
data_loader_map_provider_class_type: identifies type for data_loader_map_provider.
"""
# pyre-fixme[13]: Attribute `dataset_map_provider` is never initialized.
dataset_map_provider: DatasetMapProviderBase
# pyre-fixme[13]: Attribute `dataset_map_provider_class_type` is never initialized.
dataset_map_provider_class_type: str
# pyre-fixme[13]: Attribute `data_loader_map_provider` is never initialized.
data_loader_map_provider: DataLoaderMapProviderBase
data_loader_map_provider_class_type: str = "SequenceDataLoaderMapProvider"
......
......@@ -66,7 +66,7 @@ _NEED_CONTROL: Tuple[str, ...] = (
@registry.register
class JsonIndexDatasetMapProvider(DatasetMapProviderBase): # pyre-ignore [13]
class JsonIndexDatasetMapProvider(DatasetMapProviderBase):
"""
Generates the training / validation and testing dataset objects for
a dataset laid out on disk like Co3D, with annotations in json files.
......@@ -95,6 +95,7 @@ class JsonIndexDatasetMapProvider(DatasetMapProviderBase): # pyre-ignore [13]
path_manager_factory_class_type: The class type of `path_manager_factory`.
"""
# pyre-fixme[13]: Attribute `category` is never initialized.
category: str
task_str: str = "singlesequence"
dataset_root: str = _CO3D_DATASET_ROOT
......@@ -104,8 +105,10 @@ class JsonIndexDatasetMapProvider(DatasetMapProviderBase): # pyre-ignore [13]
test_restrict_sequence_id: int = -1
assert_single_seq: bool = False
only_test_set: bool = False
# pyre-fixme[13]: Attribute `dataset` is never initialized.
dataset: JsonIndexDataset
dataset_class_type: str = "JsonIndexDataset"
# pyre-fixme[13]: Attribute `path_manager_factory` is never initialized.
path_manager_factory: PathManagerFactory
path_manager_factory_class_type: str = "PathManagerFactory"
......
......@@ -56,7 +56,7 @@ logger = logging.getLogger(__name__)
@registry.register
class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13]
class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase):
"""
Generates the training, validation, and testing dataset objects for
a dataset laid out on disk like CO3Dv2, with annotations in gzipped json files.
......@@ -171,7 +171,9 @@ class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13]
path_manager_factory_class_type: The class type of `path_manager_factory`.
"""
# pyre-fixme[13]: Attribute `category` is never initialized.
category: str
# pyre-fixme[13]: Attribute `subset_name` is never initialized.
subset_name: str
dataset_root: str = _CO3DV2_DATASET_ROOT
......@@ -183,8 +185,10 @@ class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13]
n_known_frames_for_test: int = 0
dataset_class_type: str = "JsonIndexDataset"
# pyre-fixme[13]: Attribute `dataset` is never initialized.
dataset: JsonIndexDataset
# pyre-fixme[13]: Attribute `path_manager_factory` is never initialized.
path_manager_factory: PathManagerFactory
path_manager_factory_class_type: str = "PathManagerFactory"
......
......@@ -32,7 +32,7 @@ from .utils import DATASET_TYPE_KNOWN
@registry.register
class RenderedMeshDatasetMapProvider(DatasetMapProviderBase): # pyre-ignore [13]
class RenderedMeshDatasetMapProvider(DatasetMapProviderBase):
"""
A simple single-scene dataset based on PyTorch3D renders of a mesh.
Provides `num_views` renders of the mesh as train, with no val
......@@ -76,6 +76,7 @@ class RenderedMeshDatasetMapProvider(DatasetMapProviderBase): # pyre-ignore [13
resolution: int = 128
use_point_light: bool = True
gpu_idx: Optional[int] = 0
# pyre-fixme[13]: Attribute `path_manager_factory` is never initialized.
path_manager_factory: PathManagerFactory
path_manager_factory_class_type: str = "PathManagerFactory"
......
......@@ -83,7 +83,6 @@ class SingleSceneDataset(DatasetBase, Configurable):
return self.eval_batches
# pyre-fixme[13]: Uninitialized attribute
class SingleSceneDatasetMapProviderBase(DatasetMapProviderBase):
"""
Base for provider of data for one scene from LLFF or blender datasets.
......@@ -100,8 +99,11 @@ class SingleSceneDatasetMapProviderBase(DatasetMapProviderBase):
testing frame.
"""
# pyre-fixme[13]: Attribute `base_dir` is never initialized.
base_dir: str
# pyre-fixme[13]: Attribute `object_name` is never initialized.
object_name: str
# pyre-fixme[13]: Attribute `path_manager_factory` is never initialized.
path_manager_factory: PathManagerFactory
path_manager_factory_class_type: str = "PathManagerFactory"
n_known_frames_for_test: Optional[int] = None
......
......@@ -348,6 +348,7 @@ def adjust_camera_to_image_scale_(
camera: PerspectiveCameras,
original_size_wh: torch.Tensor,
new_size_wh: torch.LongTensor,
# pyre-fixme[7]: Expected `PerspectiveCameras` but got implicit return value of `None`.
) -> PerspectiveCameras:
focal_length_px, principal_point_px = _convert_ndc_to_pixels(
camera.focal_length[0],
......@@ -367,7 +368,7 @@ def adjust_camera_to_image_scale_(
image_size_wh_output,
)
camera.focal_length = focal_length_scaled[None]
camera.principal_point = principal_point_scaled[None] # pyre-ignore
camera.principal_point = principal_point_scaled[None]
# NOTE this cache is per-worker; they are implemented as processes.
......
......@@ -65,7 +65,7 @@ logger = logging.getLogger(__name__)
@registry.register
class GenericModel(ImplicitronModelBase): # pyre-ignore: 13
class GenericModel(ImplicitronModelBase):
"""
GenericModel is a wrapper for the neural implicit
rendering and reconstruction pipeline which consists
......@@ -226,34 +226,42 @@ class GenericModel(ImplicitronModelBase): # pyre-ignore: 13
# ---- global encoder settings
global_encoder_class_type: Optional[str] = None
# pyre-fixme[13]: Attribute `global_encoder` is never initialized.
global_encoder: Optional[GlobalEncoderBase]
# ---- raysampler
raysampler_class_type: str = "AdaptiveRaySampler"
# pyre-fixme[13]: Attribute `raysampler` is never initialized.
raysampler: RaySamplerBase
# ---- renderer configs
renderer_class_type: str = "MultiPassEmissionAbsorptionRenderer"
# pyre-fixme[13]: Attribute `renderer` is never initialized.
renderer: BaseRenderer
# ---- image feature extractor settings
# (This is only created if view_pooler is enabled)
# pyre-fixme[13]: Attribute `image_feature_extractor` is never initialized.
image_feature_extractor: Optional[FeatureExtractorBase]
image_feature_extractor_class_type: Optional[str] = None
# ---- view pooler settings
view_pooler_enabled: bool = False
# pyre-fixme[13]: Attribute `view_pooler` is never initialized.
view_pooler: Optional[ViewPooler]
# ---- implicit function settings
implicit_function_class_type: str = "NeuralRadianceFieldImplicitFunction"
# This is just a model, never constructed.
# The actual implicit functions live in self._implicit_functions
# pyre-fixme[13]: Attribute `implicit_function` is never initialized.
implicit_function: ImplicitFunctionBase
# ----- metrics
# pyre-fixme[13]: Attribute `view_metrics` is never initialized.
view_metrics: ViewMetricsBase
view_metrics_class_type: str = "ViewMetrics"
# pyre-fixme[13]: Attribute `regularization_metrics` is never initialized.
regularization_metrics: RegularizationMetricsBase
regularization_metrics_class_type: str = "RegularizationMetrics"
......
......@@ -59,12 +59,13 @@ class GlobalEncoderBase(ReplaceableBase):
# TODO: probabilistic embeddings?
@registry.register
class SequenceAutodecoder(GlobalEncoderBase, torch.nn.Module): # pyre-ignore: 13
class SequenceAutodecoder(GlobalEncoderBase, torch.nn.Module):
"""
A global encoder implementation which provides an autodecoder encoding
of the frame's sequence identifier.
"""
# pyre-fixme[13]: Attribute `autodecoder` is never initialized.
autodecoder: Autodecoder
def __post_init__(self):
......
......@@ -244,7 +244,6 @@ class MLPWithInputSkips(Configurable, torch.nn.Module):
@registry.register
# pyre-fixme[13]: Attribute `network` is never initialized.
class MLPDecoder(DecoderFunctionBase):
"""
Decoding function which uses `MLPWithIputSkips` to convert the embedding to output.
......@@ -272,6 +271,7 @@ class MLPDecoder(DecoderFunctionBase):
input_dim: int = 3
param_groups: Dict[str, str] = field(default_factory=lambda: {})
# pyre-fixme[13]: Attribute `network` is never initialized.
network: MLPWithInputSkips
def __post_init__(self):
......
......@@ -318,10 +318,11 @@ class SRNRaymarchHyperNet(Configurable, torch.nn.Module):
@registry.register
# pyre-fixme[13]: Uninitialized attribute
class SRNImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
latent_dim: int = 0
# pyre-fixme[13]: Attribute `raymarch_function` is never initialized.
raymarch_function: SRNRaymarchFunction
# pyre-fixme[13]: Attribute `pixel_generator` is never initialized.
pixel_generator: SRNPixelGenerator
def __post_init__(self):
......@@ -366,7 +367,6 @@ class SRNImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
@registry.register
# pyre-fixme[13]: Uninitialized attribute
class SRNHyperNetImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
"""
This implicit function uses a hypernetwork to generate the
......@@ -377,7 +377,9 @@ class SRNHyperNetImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
latent_dim_hypernet: int = 0
latent_dim: int = 0
# pyre-fixme[13]: Attribute `hypernet` is never initialized.
hypernet: SRNRaymarchHyperNet
# pyre-fixme[13]: Attribute `pixel_generator` is never initialized.
pixel_generator: SRNPixelGenerator
def __post_init__(self):
......
......@@ -805,7 +805,6 @@ class VMFactorizedVoxelGrid(VoxelGridBase):
)
# pyre-fixme[13]: Attribute `voxel_grid` is never initialized.
class VoxelGridModule(Configurable, torch.nn.Module):
"""
A wrapper torch.nn.Module for the VoxelGrid classes, which
......@@ -845,6 +844,7 @@ class VoxelGridModule(Configurable, torch.nn.Module):
"""
voxel_grid_class_type: str = "FullResolutionVoxelGrid"
# pyre-fixme[13]: Attribute `voxel_grid` is never initialized.
voxel_grid: VoxelGridBase
extents: Tuple[float, float, float] = (2.0, 2.0, 2.0)
......
......@@ -39,7 +39,6 @@ enable_get_default_args(HarmonicEmbedding)
@registry.register
# pyre-ignore[13]
class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
"""
This implicit function consists of two streams, one for the density calculation and one
......@@ -145,9 +144,11 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
"""
# ---- voxel grid for density
# pyre-fixme[13]: Attribute `voxel_grid_density` is never initialized.
voxel_grid_density: VoxelGridModule
# ---- voxel grid for color
# pyre-fixme[13]: Attribute `voxel_grid_color` is never initialized.
voxel_grid_color: VoxelGridModule
# ---- harmonic embeddings density
......@@ -163,10 +164,12 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
# ---- decoder function for density
decoder_density_class_type: str = "MLPDecoder"
# pyre-fixme[13]: Attribute `decoder_density` is never initialized.
decoder_density: DecoderFunctionBase
# ---- decoder function for color
decoder_color_class_type: str = "MLPDecoder"
# pyre-fixme[13]: Attribute `decoder_color` is never initialized.
decoder_color: DecoderFunctionBase
# ---- cuda streams
......
......@@ -69,7 +69,7 @@ IMPLICIT_FUNCTION_ARGS_TO_REMOVE: List[str] = [
@registry.register
class OverfitModel(ImplicitronModelBase): # pyre-ignore: 13
class OverfitModel(ImplicitronModelBase):
"""
OverfitModel is a wrapper for the neural implicit
rendering and reconstruction pipeline which consists
......@@ -198,27 +198,34 @@ class OverfitModel(ImplicitronModelBase): # pyre-ignore: 13
# ---- global encoder settings
global_encoder_class_type: Optional[str] = None
# pyre-fixme[13]: Attribute `global_encoder` is never initialized.
global_encoder: Optional[GlobalEncoderBase]
# ---- raysampler
raysampler_class_type: str = "AdaptiveRaySampler"
# pyre-fixme[13]: Attribute `raysampler` is never initialized.
raysampler: RaySamplerBase
# ---- renderer configs
renderer_class_type: str = "MultiPassEmissionAbsorptionRenderer"
# pyre-fixme[13]: Attribute `renderer` is never initialized.
renderer: BaseRenderer
# ---- implicit function settings
share_implicit_function_across_passes: bool = False
implicit_function_class_type: str = "NeuralRadianceFieldImplicitFunction"
# pyre-fixme[13]: Attribute `implicit_function` is never initialized.
implicit_function: ImplicitFunctionBase
coarse_implicit_function_class_type: Optional[str] = None
# pyre-fixme[13]: Attribute `coarse_implicit_function` is never initialized.
coarse_implicit_function: Optional[ImplicitFunctionBase]
# ----- metrics
# pyre-fixme[13]: Attribute `view_metrics` is never initialized.
view_metrics: ViewMetricsBase
view_metrics_class_type: str = "ViewMetrics"
# pyre-fixme[13]: Attribute `regularization_metrics` is never initialized.
regularization_metrics: RegularizationMetricsBase
regularization_metrics_class_type: str = "RegularizationMetrics"
......
......@@ -18,9 +18,7 @@ from .raymarcher import RaymarcherBase
@registry.register
class MultiPassEmissionAbsorptionRenderer( # pyre-ignore: 13
BaseRenderer, torch.nn.Module
):
class MultiPassEmissionAbsorptionRenderer(BaseRenderer, torch.nn.Module):
"""
Implements the multi-pass rendering function, in particular,
with emission-absorption ray marching used in NeRF [1]. First, it evaluates
......@@ -86,6 +84,7 @@ class MultiPassEmissionAbsorptionRenderer( # pyre-ignore: 13
"""
raymarcher_class_type: str = "EmissionAbsorptionRaymarcher"
# pyre-fixme[13]: Attribute `raymarcher` is never initialized.
raymarcher: RaymarcherBase
n_pts_per_ray_fine_training: int = 64
......
......@@ -16,8 +16,6 @@ from pytorch3d.renderer.implicit.sample_pdf import sample_pdf
@expand_args_fields
# pyre-fixme[13]: Attribute `n_pts_per_ray` is never initialized.
# pyre-fixme[13]: Attribute `random_sampling` is never initialized.
class RayPointRefiner(Configurable, torch.nn.Module):
"""
Implements the importance sampling of points along rays.
......@@ -45,7 +43,9 @@ class RayPointRefiner(Configurable, torch.nn.Module):
for Anti-Aliasing Neural Radiance Fields." ICCV 2021.
"""
# pyre-fixme[13]: Attribute `n_pts_per_ray` is never initialized.
n_pts_per_ray: int
# pyre-fixme[13]: Attribute `random_sampling` is never initialized.
random_sampling: bool
add_input_samples: bool = True
blurpool_weights: bool = False
......
......@@ -24,9 +24,10 @@ from .rgb_net import RayNormalColoringNetwork
@registry.register
class SignedDistanceFunctionRenderer(BaseRenderer, torch.nn.Module): # pyre-ignore[13]
class SignedDistanceFunctionRenderer(BaseRenderer, torch.nn.Module):
render_features_dimensions: int = 3
object_bounding_sphere: float = 1.0
# pyre-fixme[13]: Attribute `ray_tracer` is never initialized.
ray_tracer: RayTracing
ray_normal_coloring_network_args: DictConfig = get_default_args_field(
RayNormalColoringNetwork
......
......@@ -16,7 +16,6 @@ from .feature_aggregator import FeatureAggregatorBase
from .view_sampler import ViewSampler
# pyre-ignore: 13
class ViewPooler(Configurable, torch.nn.Module):
"""
Implements sampling of image-based features at the 2d projections of a set
......@@ -35,8 +34,10 @@ class ViewPooler(Configurable, torch.nn.Module):
from a set of source images. FeatureAggregator executes step (4) above.
"""
# pyre-fixme[13]: Attribute `view_sampler` is never initialized.
view_sampler: ViewSampler
feature_aggregator_class_type: str = "AngleWeightedReductionFeatureAggregator"
# pyre-fixme[13]: Attribute `feature_aggregator` is never initialized.
feature_aggregator: FeatureAggregatorBase
def __post_init__(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment