huggingface/transformers · error · ValueError

trainer_config_process() wasn't called yet to tell dtype

Error message

trainer_config_process() wasn't called yet to tell dtype

What it means

Error "trainer_config_process() wasn't called yet to tell dtype" thrown in huggingface/transformers.

Source

Thrown at src/transformers/integrations/deepspeed.py:95

        dep_version_check("accelerate")
        dep_version_check("deepspeed")
        super().__init__(config_file_or_dict)


class HfTrainerDeepSpeedConfig(HfDeepSpeedConfig):
    """
    The `HfTrainerDeepSpeedConfig` object is meant to be created during `TrainingArguments` object creation and has the
    same lifespan as the latter.
    """

    def __init__(self, config_file_or_dict):
        super().__init__(config_file_or_dict)
        self._dtype = None
        self.mismatches = []

    def dtype(self):
        if self._dtype is None:
            raise ValueError("trainer_config_process() wasn't called yet to tell dtype")
        return self._dtype

    def is_auto(self, ds_key_long):
        val = self.get_value(ds_key_long)
        if val is None:
            return False
        else:
            return val == "auto"

    def fill_match(self, ds_key_long, hf_val, hf_key=None, must_match=True):
        """
        A utility method that massages the config file and can optionally verify that the values match.

        1. Replace "auto" values with `TrainingArguments` value.

        2. If it wasn't "auto" and `must_match` is true, then check that DS config matches Trainer
        config values and if mismatched add the entry to `self.mismatched` - will assert during
        `trainer_config_finalize` for one or more mismatches.

View on GitHub (pinned to a597f97485)

Solutions

  1. Create the HfDeepSpeedConfig via `HfDeepSpeedConfig(ds_config)` (which calls trainer_config_process) before model init.

When it happens

Trigger: Raised in DeepSpeed integration when dtype is queried before trainer_config_process() finalized the config.

Common situations: Accessing the HfDeepSpeedConfig dtype before Trainer has processed the DeepSpeed config.


AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14). Data as JSON: /api/errors/21594be0f81eb09b. Report an issue: GitHub.