Skip to content

Commit cd5db07

Browse files
shapovalovfacebook-github-bot
authored andcommitted
Adding SQL dataset classes to ImplicitronDataSource imports
Summary: Making it easier for the clients to use these datasets. Reviewed By: bottler Differential Revision: D46727179 fbshipit-source-id: cf619aee4c4c0222a74b30ea590cf37f08f014cc
1 parent 3d886c3 commit cd5db07

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

projects/implicitron_trainer/tests/experiment.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,19 @@ data_source_ImplicitronDataSource_args:
129129
dataset_length_train: 0
130130
dataset_length_val: 0
131131
dataset_length_test: 0
132+
data_loader_map_provider_TrainEvalDataLoaderMapProvider_args:
133+
batch_size: 1
134+
num_workers: 0
135+
dataset_length_train: 0
136+
dataset_length_val: 0
137+
dataset_length_test: 0
138+
train_conditioning_type: SAME
139+
val_conditioning_type: SAME
140+
test_conditioning_type: KNOWN
141+
images_per_seq_options: []
142+
sample_consecutive_frames: false
143+
consecutive_frames_max_gap: 0
144+
consecutive_frames_max_gap_seconds: 0.1
132145
model_factory_ImplicitronModelFactory_args:
133146
resume: true
134147
model_class_type: GenericModel

projects/implicitron_trainer/tests/test_experiment.py

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def test_yaml_contents(self):
136136
ds_arg = cfg.data_source_ImplicitronDataSource_args
137137
ds_arg.dataset_map_provider_JsonIndexDatasetMapProvider_args.dataset_root = ""
138138
ds_arg.dataset_map_provider_JsonIndexDatasetMapProviderV2_args.dataset_root = ""
139+
if "dataset_map_provider_SqlIndexDatasetMapProvider_args" in ds_arg:
140+
del ds_arg.dataset_map_provider_SqlIndexDatasetMapProvider_args
139141
cfg.training_loop_ImplicitronTrainingLoop_args.visdom_port = 8097
140142
yaml = OmegaConf.to_yaml(cfg, sort_keys=False)
141143
if DEBUG:

pytorch3d/implicitron/dataset/data_source.py

+10
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ def pre_expand(cls) -> None:
7272
from .rendered_mesh_dataset_map_provider import ( # noqa: F401
7373
RenderedMeshDatasetMapProvider,
7474
)
75+
from .train_eval_data_loader_provider import ( # noqa: F401
76+
TrainEvalDataLoaderMapProvider,
77+
)
78+
79+
try:
80+
from .sql_dataset_provider import ( # noqa: F401 # pyre-ignore
81+
SqlIndexDatasetMapProvider,
82+
)
83+
except ModuleNotFoundError:
84+
pass # environment without SQL dataset
7585
finally:
7686
pass
7787

tests/implicitron/data/data_source.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,16 @@ data_loader_map_provider_SimpleDataLoaderMapProvider_args:
116116
dataset_length_train: 0
117117
dataset_length_val: 0
118118
dataset_length_test: 0
119+
data_loader_map_provider_TrainEvalDataLoaderMapProvider_args:
120+
batch_size: 1
121+
num_workers: 0
122+
dataset_length_train: 0
123+
dataset_length_val: 0
124+
dataset_length_test: 0
125+
train_conditioning_type: SAME
126+
val_conditioning_type: SAME
127+
test_conditioning_type: KNOWN
128+
images_per_seq_options: []
129+
sample_consecutive_frames: false
130+
consecutive_frames_max_gap: 0
131+
consecutive_frames_max_gap_seconds: 0.1

tests/implicitron/test_data_source.py

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def test_one(self):
6868
# making the test invariant to env variables
6969
cfg.dataset_map_provider_JsonIndexDatasetMapProvider_args.dataset_root = ""
7070
cfg.dataset_map_provider_JsonIndexDatasetMapProviderV2_args.dataset_root = ""
71+
# making the test invariant to the presence of SQL dataset
72+
if "dataset_map_provider_SqlIndexDatasetMapProvider_args" in cfg:
73+
del cfg.dataset_map_provider_SqlIndexDatasetMapProvider_args
7174
yaml = OmegaConf.to_yaml(cfg, sort_keys=False)
7275
if DEBUG:
7376
(DATA_DIR / "data_source.yaml").write_text(yaml)

0 commit comments

Comments
 (0)