{"record":{"id":"1a1dd723b0cc3698","repo":"microsoft/qlib","slug":"unknown-base-model-name-s-1a1dd7","errorCode":null,"errorMessage":"unknown base model name `%s`","messagePattern":"unknown base model name `(.+?)`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/contrib/model/pytorch_gats.py","lineNumber":254,"sourceCode":"            raise ValueError(\"Empty data from dataset, please check your dataset config.\")\n\n        x_train, y_train = df_train[\"feature\"], df_train[\"label\"]\n        x_valid, y_valid = df_valid[\"feature\"], df_valid[\"label\"]\n\n        save_path = get_or_create_path(save_path)\n        stop_steps = 0\n        best_score = -np.inf\n        best_epoch = 0\n        evals_result[\"train\"] = []\n        evals_result[\"valid\"] = []\n\n        # load pretrained base_model\n        if self.base_model == \"LSTM\":\n            pretrained_model = LSTMModel()\n        elif self.base_model == \"GRU\":\n            pretrained_model = GRUModel()\n        else:\n            raise ValueError(\"unknown base model name `%s`\" % self.base_model)\n\n        if self.model_path is not None:\n            self.logger.info(\"Loading pretrained model...\")\n            pretrained_model.load_state_dict(torch.load(self.model_path, map_location=self.device))\n\n        model_dict = self.GAT_model.state_dict()\n        pretrained_dict = {\n            k: v for k, v in pretrained_model.state_dict().items() if k in model_dict  # pylint: disable=E1135\n        }\n        model_dict.update(pretrained_dict)\n        self.GAT_model.load_state_dict(model_dict)\n        self.logger.info(\"Loading pretrained model Done...\")\n\n        # train\n        self.logger.info(\"training...\")\n        self.fitted = True\n\n        for step in range(self.n_epochs):","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/model/pytorch_gats.py#L236-L272","documentation":"GATsModel.fit() instantiates a pretrained base RNN to warm-start the GAT network: only base_model == 'LSTM' and 'GRU' (exact case) are recognized; anything else raises ValueError before weights are loaded. Note the comparison is case-sensitive, so 'lstm' fails here even though other hyperparameters in qlib are matched case-insensitively.","triggerScenarios":"Calling fit() with base_model='lstm' (lowercase), 'Transformer', 'SRNN', or any string other than the exact 'LSTM'/'GRU'.","commonSituations":"Lowercasing hyperparameters in workflow YAMLs; porting configs between GATs variants; assuming case-insensitive matching as used for the optimizer parameter.","solutions":["Use the exact strings 'LSTM' or 'GRU' for base_model.","Fix lowercase 'lstm'/'gru' values in your workflow config.","Subclass GATsModel to add a custom base model class if you need one."],"exampleFix":"# before\nmodel = GATsModel(base_model='lstm')\n\n# after\nmodel = GATsModel(base_model='LSTM')","handlingStrategy":"validation","validationCode":"assert model.base_model in ('LSTM', 'GRU'), f\"base_model must be exactly 'LSTM' or 'GRU', got {model.base_model!r}\"","typeGuard":"def is_valid_base_model(name: str) -> bool:\n    return name in ('LSTM', 'GRU')","tryCatchPattern":"try:\n    model.fit(dataset)\nexcept ValueError as e:\n    if 'unknown base model name' in str(e):\n        model.base_model = model.base_model.upper()\n        if model.base_model in ('LSTM', 'GRU'):\n            model.fit(dataset)\n            return\n    raise","preventionTips":["Use exact-case 'LSTM'/'GRU' in configs; this check is case-sensitive.","Add schema validation with enum values for base_model.","Centralize allowed hyperparameter enums per model in one module."],"tags":["pytorch","qlib","config-validation","case-sensitivity","gats"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}