PathManagerFactory

Summary: Allow access to manifold internally by default.

Reviewed By: davnov134

Differential Revision: D36760481

fbshipit-source-id: 2a16bd40e81ef526085ac1b3f4606b63c1841428
This commit is contained in:
Jeremy Reizenstein
2022-06-10 12:22:46 -07:00
committed by Facebook GitHub Bot
parent 1fb268dea6
commit 1d43251391
7 changed files with 65 additions and 52 deletions

View File

@@ -303,7 +303,9 @@ data_source_args:
image_width: 800
image_height: 800
remove_empty_masks: true
path_manager: null
path_manager_factory_class_type: PathManagerFactory
path_manager_factory_PathManagerFactory_args:
silence_logs: true
data_loader_map_provider_SequenceDataLoaderMapProvider_args:
batch_size: 1
num_workers: 0

View File

@@ -4,18 +4,13 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import unittest
from pathlib import Path
import experiment
import torch
from iopath.common.file_io import PathManager
from omegaconf import OmegaConf
from pytorch3d.implicitron.dataset.json_index_dataset_map_provider import (
JsonIndexDatasetMapProvider,
)
def interactive_testing_requested() -> bool:
@@ -38,38 +33,9 @@ DEBUG: bool = False
# - deal with the temporary output files this test creates
def get_path_manager(silence_logs: bool = False) -> PathManager:
"""
Returns a path manager which can access manifold internally.
Args:
silence_logs: Whether to reduce log output from iopath library.
"""
if silence_logs:
logging.getLogger("iopath.fb.manifold").setLevel(logging.CRITICAL)
logging.getLogger("iopath.common.file_io").setLevel(logging.CRITICAL)
if os.environ.get("INSIDE_RE_WORKER", False):
raise ValueError("Cannot get to manifold from RE")
path_manager = PathManager()
if os.environ.get("FB_TEST", False):
from iopath.fb.manifold import ManifoldPathHandler
path_manager.register_handler(ManifoldPathHandler())
return path_manager
def set_path_manager(self):
self.path_manager = get_path_manager()
class TestExperiment(unittest.TestCase):
def setUp(self):
self.maxDiff = None
JsonIndexDatasetMapProvider.__post_init__ = set_path_manager
def test_from_defaults(self):
# Test making minimal changes to the dataclass defaults.