Source code for nemo_automodel.components.datasets.diffusion
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Diffusion model datasets and dataloaders."""
import importlib
_LAZY_ATTRS = {
"MetaFilesDataset": (".meta_files_dataset", "MetaFilesDataset"),
"TextToImageDataset": (".text_to_image_dataset", "TextToImageDataset"),
"MultiTierBucketCalculator": (".multi_tier_bucketing", "MultiTierBucketCalculator"),
"SequentialBucketSampler": (".sampler", "SequentialBucketSampler"),
"collate_fn_flux": (".collate_fns", "collate_fn_flux"),
"build_flux_multiresolution_dataloader": (".collate_fns", "build_flux_multiresolution_dataloader"),
"build_mock_dataloader": (".mock_dataloader", "build_mock_dataloader"),
"build_dataloader": (".meta_files_dataset", "build_dataloader"),
}
__all__ = sorted(_LAZY_ATTRS.keys())
[docs]
def __getattr__(name: str):
if name in _LAZY_ATTRS:
module_path, attr_name = _LAZY_ATTRS[name]
module = importlib.import_module(module_path, __name__)
attr = getattr(module, attr_name)
globals()[name] = attr
return attr
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
[docs]
def __dir__():
return sorted(__all__)