Skip to content

Error when initializing DistributedTrainer #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
manuelbrack opened this issue Mar 24, 2025 · 0 comments
Open

Error when initializing DistributedTrainer #302

manuelbrack opened this issue Mar 24, 2025 · 0 comments

Comments

@manuelbrack
Copy link

Doc string of DistributedTrainer does not align with init behavior.

According to the docstring the config_or_config_file can be either a Config object or a path to a config.

config_or_config_file: Either a Config object or a path to a YAML file containing the config.

class DistributedTrainer:
def __init__(
self,
config_or_config_file: Union[Config, str],
config_class: Type[Config] = Config,
model_config_class: Optional[Type] = None,
model_class: Type[NanotronModel] = None,
):
"""
Nanotron's distributed trainer.
Args:
config_or_config_file: Either a `Config` object or a path to a YAML file containing the config.
config_class: The `Config` class to use.
model_config_class: The `ModelConfig` class to use (for example `LlamaConfig`). Defaults to `None` which will use the model config class defined in the config.
model_class: The `NanotronModel` class to use (for example `LlamaForTraining`). Defaults to `None` which will use the model class defined in the config.
"""

However, the current initialization using get_config_from_file only allows for a file path and not a config object.

self.config = get_config_from_file(
config_or_config_file, config_class=config_class, model_config_class=model_config_class
)

The easiest fix would probably be to run a check if config_or_config_file is already a Config object and set self.config = config_or_config_file in that case instead of calling get_config_from_file .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant