{"record":{"id":"d70aed2fe81a050d","repo":"hiyouga/LlamaFactory","slug":"unsupported-model-type-getattr-config-model-ty","errorCode":null,"errorMessage":"Unsupported model type: {getattr(config, 'model_type')}.","messagePattern":"Unsupported model type: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/qwen_omni_merge.py","lineNumber":117,"sourceCode":"\n    Args:\n        model_path (str): Directory path of the original model.\n        thinker_path (str): Path to the saved thinker weights.\n        save_path (str): Directory where the merged model and configurations will be saved.\n        extra_file (str): Name of the extra file to be copied (default: \"spk_dict.pt\").\n    \"\"\"\n    # 1. Load the saved thinker module and the original model\n    config = AutoConfig.from_pretrained(model_path)\n    if getattr(config, \"model_type\") == \"qwen2_5_omni\":\n        from transformers.models.qwen2_5_omni import Qwen2_5OmniThinkerForConditionalGeneration  # type: ignore\n\n        ThinkerClass = Qwen2_5OmniThinkerForConditionalGeneration\n    elif getattr(config, \"model_type\") == \"qwen3_omni_moe\":\n        from transformers.models.qwen3_omni_moe import Qwen3OmniMoeThinkerForConditionalGeneration  # type: ignore\n\n        ThinkerClass = Qwen3OmniMoeThinkerForConditionalGeneration\n    else:\n        raise ValueError(f\"Unsupported model type: {getattr(config, 'model_type')}.\")\n\n    thinker = ThinkerClass.from_pretrained(thinker_path, torch_dtype=\"auto\", device_map=\"cpu\")\n    base_model = AutoModelForTextToWaveform.from_pretrained(model_path, torch_dtype=\"auto\", device_map=\"cpu\")\n    base_model.thinker = thinker\n    processor = AutoProcessor.from_pretrained(thinker_path)\n    print(\"Successfully loaded model weights and processor.\")\n\n    # 2. Save the complete model along with its tokenizer and processor configuration\n    base_model.save_pretrained(save_path)\n    processor.save_pretrained(save_path)\n    print(f\"Merged model and processor saved to {save_path}.\")\n\n    # 3. Copy the extra file from the base model directory to the save_path\n    try:\n        source_file = cached_file(path_or_repo_id=model_path, filename=extra_file)\n        shutil.copy(source_file, os.path.join(save_path, extra_file))\n        print(f\"File '{extra_file}' copied from {model_path} to {save_path}.\")\n    except Exception:","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/scripts/qwen_omni_merge.py#L99-L135","documentation":"get_train_dataloader in the HyperParallel trainer (trainer.py:311) mirrors the upstream transformers behavior: if self.train_dataset is None it cannot build a dataloader and raises ValueError('Trainer: training requires a train_dataset.'). In LlamaFactory this means the YAML stage/dataset wiring produced no dataset before the trainer was constructed.","triggerScenarios":"Training YAML omits `dataset:` / `dataset_dir:` so DataArguments carries no datasets; or the stage (e.g. pt/sft) resolved to an empty dataset list and the trainer was instantiated with train_dataset=None.","commonSituations":"Reusing a chat/eval YAML for a HyperParallel train run and forgetting the dataset key; dataset name typo causing zero matching datasets; intentionally testing trainer construction without data.","solutions":["Add a valid `dataset: <name>` entry (present in data/dataset_info.json) to the training YAML","Check for typos in the dataset name and that dataset_dir points at the right dataset_info.json","If you meant preprocessing-only or no data, use a different workflow — the HP trainer cannot run without a train dataset"],"exampleFix":"# before (YAML)\n### dataset\n# dataset: (missing)\n\n# after (YAML)\ndataset: alpaca_gpt4_zh  # must exist in data/dataset_info.json","handlingStrategy":"validation","validationCode":"assert data_args.dataset, 'No dataset configured: add a `dataset:` entry that exists in data/dataset_info.json'\nassert train_dataset is not None, 'train_dataset resolved to None; check dataset names and dataset_dir'","typeGuard":"def has_train_dataset(data_args) -> bool:\n    return bool(getattr(data_args, 'dataset', None))","tryCatchPattern":"try:\n    trainer.train()\nexcept ValueError as e:\n    if 'requires a train_dataset' in str(e):\n        raise SystemExit('Add dataset: <name> (from data/dataset_info.json) to the YAML') from e\n    raise","preventionTips":["Fail fast in your wrapper: reject train YAMLs without a dataset key","Verify dataset names resolve during tokenization dry-run before distributed launch"],"tags":["dataset","config","hyper-parallel","training"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}