1. 17 May, 2023 1 commit
    • Roman Shapovalov's avatar
      Refactor: FrameDataBuilder is more extensible. · b0462598
      Roman Shapovalov authored
      Summary:
      This is mostly a refactoring diff to reduce friction in extending the frame data.
      
      Slight functional changes: dataset getitem now accepts (seq_name, frame_number_as_singleton_tensor) as a non-advertised feature. Otherwise this code crashes:
      ```
      item = dataset[0]
      dataset[item.sequence_name, item.frame_number]
      ```
      
      Reviewed By: bottler
      
      Differential Revision: D45780175
      
      fbshipit-source-id: 75b8e8d3dabed954a804310abdbd8ab44a8dea29
      b0462598
  2. 24 Mar, 2023 1 commit
    • Emilien Garreau's avatar
      Add the OverfitModel · 813e941d
      Emilien Garreau authored
      Summary:
      Introduces the OverfitModel for NeRF-style training with overfitting to one scene.
      It is a specific case of GenericModel. It has been disentangle to ease usage.
      
      ## General modification
      
      1. Modularize a minimum GenericModel to introduce OverfitModel
      2. Introduce OverfitModel and ensure through unit testing that it behaves like GenericModel.
      
      ## Modularization
      
      The following methods have been extracted from GenericModel to allow modularity with ManyViewModel:
      - get_objective is now a call to weighted_sum_losses
      - log_loss_weights
      - prepare_inputs
      
      The generic methods have been moved to an utils.py file.
      
      Simplify the code to introduce OverfitModel.
      
      Private methods like chunk_generator are now public and can now be used by ManyViewModel.
      
      Reviewed By: shapovalov
      
      Differential Revision: D43771992
      
      fbshipit-source-id: 6102aeb21c7fdd56aa2ff9cd1dd23fd9fbf26315
      813e941d
  3. 22 Sep, 2022 1 commit
    • Jeremy Reizenstein's avatar
      foreach optimizers · 209c160a
      Jeremy Reizenstein authored
      Summary: Allow using the new `foreach` option on optimizers.
      
      Reviewed By: shapovalov
      
      Differential Revision: D39694843
      
      fbshipit-source-id: 97109c245b669bc6edff0f246893f95b7ae71f90
      209c160a
  4. 08 Sep, 2022 1 commit
    • Jeremy Reizenstein's avatar
      visualize_reconstruction fixes · 6e25fe8c
      Jeremy Reizenstein authored
      Summary: Various fixes to get visualize_reconstruction running, and an interactive test for it.
      
      Reviewed By: kjchalup
      
      Differential Revision: D39286691
      
      fbshipit-source-id: 88735034cc01736b24735bcb024577e6ab7ed336
      6e25fe8c
  5. 30 Aug, 2022 1 commit
    • David Novotny's avatar
      CO3Dv2 trainer configs · 1163eaab
      David Novotny authored
      Summary:
      Adds yaml configs to train selected methods on CO3Dv2.
      
      Few more updates:
      1) moved some fields to base classes so that we can check is_multisequence in experiment.py
      2) skip loading all train cameras for multisequence datasets, without this, co3d-fewview is untrainable
      3) fix bug in json index dataset provider v2
      
      Reviewed By: kjchalup
      
      Differential Revision: D38952755
      
      fbshipit-source-id: 3edac6fc8e20775aa70400bd73a0e6d52b091e0c
      1163eaab
  6. 09 Aug, 2022 1 commit
    • Krzysztof Chalupka's avatar
      Mods and bugfixes for LLFF and Blender repros · c83ec355
      Krzysztof Chalupka authored
      Summary:
      LLFF (and most/all non-synth datasets) will have no background/foreground distinction. Add support for data with no fg mask.
      
      Also, we had a bug in stats loading, like this:
        * Load stats
        * One of the stats has a history of length 0
        * That's fine, e.g. maybe it's fg_error but the dataset has no notion of fg/bg. So leave it as len 0
        * Check whether all the stats have the same history length as an arbitrarily chosen "reference-stat"
        * Ooops the reference-stat happened to be the stat with length 0
        * assert (legit_stat_len == reference_stat_len (=0)) ---> failed assert
      
      Also some minor fixes (from Jeremy's other diff) to support LLFF
      
      Reviewed By: davnov134
      
      Differential Revision: D38475272
      
      fbshipit-source-id: 5b35ac86d1d5239759f537621f41a3aa4eb3bd68
      c83ec355
  7. 02 Aug, 2022 2 commits
    • David Novotny's avatar
      Move load_stats to TrainingLoop · c3f8dad5
      David Novotny authored
      Summary:
      Stats are logically connected to the training loop, not to the model. Hence, moving to the training loop.
      
      Also removing resume_epoch from OptimizerFactory in favor of a single place - ModelFactory. This removes the need for config consistency checks etc.
      
      Reviewed By: kjchalup
      
      Differential Revision: D38313475
      
      fbshipit-source-id: a1d188a63e28459df381ff98ad8acdcdb14887b7
      c3f8dad5
    • Krzysztof Chalupka's avatar
      Fix test evaluation for Blender data · 760305e0
      Krzysztof Chalupka authored
      Summary: Blender data doesn't have depths or crops.
      
      Reviewed By: shapovalov
      
      Differential Revision: D38345583
      
      fbshipit-source-id: a19300daf666bbfd799d0038aeefa14641c559d7
      760305e0
  8. 30 Jul, 2022 1 commit
    • Krzysztof Chalupka's avatar
      Replace pluggable components to create a proper Configurable hierarchy. · 1b0584f7
      Krzysztof Chalupka authored
      Summary:
      This large diff rewrites a significant portion of Implicitron's config hierarchy. The new hierarchy, and some of the default implementation classes, are as follows:
      ```
      Experiment
          data_source: ImplicitronDataSource
              dataset_map_provider
              data_loader_map_provider
          model_factory: ImplicitronModelFactory
              model: GenericModel
          optimizer_factory: ImplicitronOptimizerFactory
          training_loop: ImplicitronTrainingLoop
              evaluator: ImplicitronEvaluator
      ```
      
      1) Experiment (used to be ExperimentConfig) is now a top-level Configurable and contains as members mainly (mostly new) high-level factory Configurables.
      2) Experiment's job is to run factories, do some accelerate setup and then pass the results to the main training loop.
      3) ImplicitronOptimizerFactory and ImplicitronModelFactory are new high-level factories that create the optimizer, scheduler, model, and stats objects.
      4) TrainingLoop is a new configurable that runs the main training loop and the inner train-validate step.
      5) Evaluator is a new configurable that TrainingLoop uses to run validation/test steps.
      6) GenericModel is not the only model choice anymore. Instead, ImplicitronModelBase (by default instantiated with GenericModel) is a member of Experiment and can be easily replaced by a custom implementation by the user.
      
      All the new Configurables are children of ReplaceableBase, and can be easily replaced with custom implementations.
      
      In addition, I added support for the exponential LR schedule, updated the config files and the test, as well as added a config file that reproduces NERF results and a test to run the repro experiment.
      
      Reviewed By: bottler
      
      Differential Revision: D37723227
      
      fbshipit-source-id: b36bee880d6aa53efdd2abfaae4489d8ab1e8a27
      1b0584f7
  9. 12 Jul, 2022 2 commits
    • Jeremy Reizenstein's avatar
      fix trainer test · d3b7f5f4
      Jeremy Reizenstein authored
      Summary: After recent accelerate change D37543870 (https://github.com/facebookresearch/pytorch3d/commit/aa8b03f31dc2a178f8d7da457df28f19b5917009), update interactive trainer test.
      
      Reviewed By: shapovalov
      
      Differential Revision: D37785932
      
      fbshipit-source-id: 9211374323b6cfd80f6c5ff3a4fc1c0ca04b54ba
      d3b7f5f4
    • Nikhila Ravi's avatar
      Updates to support Accelerate and multigpu training (#37) · aa8b03f3
      Nikhila Ravi authored
      Summary:
      ## Changes:
      - Added Accelerate Library and refactored experiment.py to use it
      - Needed to move `init_optimizer` and `ExperimentConfig` to a separate file to be compatible with submitit/hydra
      - Needed to make some modifications to data loaders etc to work well with the accelerate ddp wrappers
      - Loading/saving checkpoints incorporates an unwrapping step so remove the ddp wrapped model
      
      ## Tests
      
      Tested with both `torchrun` and `submitit/hydra` on two gpus locally. Here are the commands:
      
      **Torchrun**
      
      Modules loaded:
      ```sh
      1) anaconda3/2021.05   2) cuda/11.3   3) NCCL/2.9.8-3-cuda.11.3   4) gcc/5.2.0. (but unload gcc when using submit)
      ```
      
      ```sh
      torchrun --nnodes=1 --nproc_per_node=2 experiment.py --config-path ./configs --config-name repro_singleseq_nerf_test
      ```
      
      **Submitit/Hydra Local test**
      
      ```sh
      ~/pytorch3d/projects/implicitron_trainer$ HYDRA_FULL_ERROR=1 python3.9 experiment.py --config-name repro_singleseq_nerf_test --multirun --config-path ./configs  hydra/launcher=submitit_local hydra.launcher.gpus_per_node=2 hydra.launcher.tasks_per_node=2 hydra.launcher.nodes=1
      ```
      
      **Submitit/Hydra distributed test**
      
      ```sh
      ~/implicitron/pytorch3d$ python3.9 experiment.py --config-name repro_singleseq_nerf_test --multirun --config-path ./configs  hydra/launcher=submitit_slurm hydra.launcher.gpus_per_node=8 hydra.launcher.tasks_per_node=8 hydra.launcher.nodes=1 hydra.launcher.partition=learnlab hydra.launcher.timeout_min=4320
      ```
      
      ## TODOS:
      - Fix distributed evaluation: currently this doesn't work as the input format to the evaluation function is not suitable for gathering across gpus (needs to be nested list/tuple/dicts of objects that satisfy `is_torch_tensor`) and currently `frame_data`  contains `Cameras` type.
      - Refactor the `accelerator` object to be accessible by all functions instead of needing to pass it around everywhere? Maybe have a `Trainer` class and add it as a method?
      - Update readme with installation instructions for accelerate and also commands for running jobs with torchrun and submitit/hydra
      
      X-link: https://github.com/fairinternal/pytorch3d/pull/37
      
      Reviewed By: davnov134, kjchalup
      
      Differential Revision: D37543870
      
      Pulled By: bottler
      
      fbshipit-source-id: be9eb4e91244d4fe3740d87dafec622ae1e0cf76
      aa8b03f3
  10. 06 Jul, 2022 1 commit
    • Jeremy Reizenstein's avatar
      more padding options in Dataloader · 771cf8a3
      Jeremy Reizenstein authored
      Summary: Add facilities for dataloading non-sequential scenes.
      
      Reviewed By: shapovalov
      
      Differential Revision: D37291277
      
      fbshipit-source-id: 0a33e3727b44c4f0cba3a2abe9b12f40d2a20447
      771cf8a3
  11. 10 Jun, 2022 3 commits
    • Jeremy Reizenstein's avatar
      test configs are loadable · 023a2369
      Jeremy Reizenstein authored
      Summary: Add test that the yaml files deserialize.
      
      Reviewed By: davnov134
      
      Differential Revision: D36830673
      
      fbshipit-source-id: b785d8db97b676686036760bfa2dd3fa638bda57
      023a2369
    • Jeremy Reizenstein's avatar
      pluggable JsonIndexDataset · 62752832
      Jeremy Reizenstein authored
      Summary: Make dataset type and args configurable on JsonIndexDatasetMapProvider.
      
      Reviewed By: davnov134
      
      Differential Revision: D36666705
      
      fbshipit-source-id: 4d0a3781d9a956504f51f1c7134c04edf1eb2846
      62752832
    • Jeremy Reizenstein's avatar
      PathManagerFactory · 1d432513
      Jeremy Reizenstein authored
      Summary: Allow access to manifold internally by default.
      
      Reviewed By: davnov134
      
      Differential Revision: D36760481
      
      fbshipit-source-id: 2a16bd40e81ef526085ac1b3f4606b63c1841428
      1d432513
  12. 26 May, 2022 1 commit
    • Jeremy Reizenstein's avatar
      test runner for experiment.py · c31bf85a
      Jeremy Reizenstein authored
      Summary: Add simple interactive testrunner for experiment.py
      
      Reviewed By: shapovalov
      
      Differential Revision: D35316221
      
      fbshipit-source-id: d424bcba632eef89eefb56e18e536edb58ec6f85
      c31bf85a