EthanZyh commited on
Commit
876731d
·
1 Parent(s): 3f855fc

support args, add comments

Browse files
config_helper.py CHANGED
@@ -164,7 +164,7 @@ def import_all_modules_from_package(package_path: str, reload: bool = False, ski
164
  reload (bool): Flag to determine whether to reload modules if they're already imported.
165
  skip_underscore (bool): If True, skips importing modules that start with an underscore.
166
  """
167
- return # TODO: we do not use this
168
  log.debug(f"{'Reloading' if reload else 'Importing'} all modules from package {package_path}")
169
  package = importlib.import_module(package_path)
170
  package_directory = package.__path__
 
164
  reload (bool): Flag to determine whether to reload modules if they're already imported.
165
  skip_underscore (bool): If True, skips importing modules that start with an underscore.
166
  """
167
+ return # we do not use this function
168
  log.debug(f"{'Reloading' if reload else 'Importing'} all modules from package {package_path}")
169
  package = importlib.import_module(package_path)
170
  package_directory = package.__path__
df_config_config.py CHANGED
@@ -22,7 +22,7 @@ from .df_config_registry import register_configs
22
  from .config import Config as ori_Config
23
  from .config_helper import import_all_modules_from_package
24
 
25
- # I added importing here
26
  from .cosmos1diffusiontext2world import LazyDict
27
  from .cosmos1diffusionvideo2world import LazyDict
28
 
 
22
  from .config import Config as ori_Config
23
  from .config_helper import import_all_modules_from_package
24
 
25
+ # import config here, not use importlib
26
  from .cosmos1diffusiontext2world import LazyDict
27
  from .cosmos1diffusionvideo2world import LazyDict
28
 
inference_utils.py CHANGED
@@ -275,7 +275,7 @@ def load_model_by_config(
275
  model_class=DiffusionT2WModel,
276
  ):
277
  # TODO: We need to modify this for huggingface because the config file path is different
278
- # config_module = get_config_module(config_file)
279
  # config = importlib.import_module(config_module).make_config()
280
  if model_class in (DiffusionT2WModel, DiffusionV2WModel):
281
  config = make_config()
 
275
  model_class=DiffusionT2WModel,
276
  ):
277
  # TODO: We need to modify this for huggingface because the config file path is different
278
+ # config_module = get_config_module(config_file) # cosmos1/models/diffusion/config/config.py
279
  # config = importlib.import_module(config_module).make_config()
280
  if model_class in (DiffusionT2WModel, DiffusionV2WModel):
281
  config = make_config()
text2world_hf.py CHANGED
@@ -130,5 +130,8 @@ class DiffusionText2World(PreTrainedModel):
130
  def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
131
  # TODO: this only builds the class, but not download the checkpoints.
132
  config = kwargs["config"]
 
 
 
133
  model = cls(config)
134
  return model
 
130
  def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
131
  # TODO: this only builds the class, but not download the checkpoints.
132
  config = kwargs["config"]
133
+ other_args = kwargs.copy()
134
+ other_args.pop("config")
135
+ config.update(other_args)
136
  model = cls(config)
137
  return model