{"record":{"id":"83172f13b1c0d4d6","repo":"hankcs/HanLP","slug":"if-no-decoder-input-ids-or-decoder-inputs-embed","errorCode":null,"errorMessage":"If no `decoder_input_ids` or `decoder_inputs_embeds` are passed, `input_ids` cannot be `None`. Please pass either `input_ids` or `decoder_input_ids` or `decoder_inputs_embeds`.","messagePattern":"If no `decoder_input_ids` or `decoder_inputs_embeds` are passed, `input_ids` cannot be `None`\\. Please pass either `input_ids` or `decoder_input_ids` or `decoder_inputs_embeds`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"hanlp/components/amr/amrbart/model_interface/modeling_bart.py","lineNumber":1204,"sourceCode":"        decoder_attention_mask: Optional[torch.LongTensor] = None,\n        head_mask: Optional[torch.Tensor] = None,\n        decoder_head_mask: Optional[torch.Tensor] = None,\n        cross_attn_head_mask: Optional[torch.Tensor] = None,\n        encoder_outputs: Optional[List[torch.FloatTensor]] = None,\n        past_key_values: Optional[List[torch.FloatTensor]] = None,\n        inputs_embeds: Optional[torch.FloatTensor] = None,\n        decoder_inputs_embeds: Optional[torch.FloatTensor] = None,\n        use_cache: Optional[bool] = None,\n        output_attentions: Optional[bool] = None,\n        output_hidden_states: Optional[bool] = None,\n        return_dict: Optional[bool] = None,\n    ) -> Union[Tuple, Seq2SeqModelOutput]:\n\n        # different to other models, Bart automatically creates decoder_input_ids from\n        # input_ids if no decoder_input_ids are provided\n        if decoder_input_ids is None and decoder_inputs_embeds is None:\n            if input_ids is None:\n                raise ValueError(\n                    \"If no `decoder_input_ids` or `decoder_inputs_embeds` are \"\n                    \"passed, `input_ids` cannot be `None`. Please pass either \"\n                    \"`input_ids` or `decoder_input_ids` or `decoder_inputs_embeds`.\"\n                )\n\n            decoder_input_ids = shift_tokens_right(\n                input_ids, self.config.pad_token_id, self.config.decoder_start_token_id\n            )\n\n        output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions\n        output_hidden_states = (\n            output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states\n        )\n        use_cache = use_cache if use_cache is not None else self.config.use_cache\n        return_dict = return_dict if return_dict is not None else self.config.use_return_dict\n\n        if encoder_outputs is None:\n            encoder_outputs = self.encoder(","sourceCodeStart":1186,"sourceCodeEnd":1222,"githubUrl":"https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/components/amr/amrbart/model_interface/modeling_bart.py#L1186-L1222","documentation":"SmatchEval for AMR evaluation downloads version-specific official utility scripts; only AMR corpus versions '1.0', '2.0' and '3.0' are supported. Any other amr_version string raises ValueError from get_amr_utils, which is called during __init__ and post_process.","triggerScenarios":"Constructing SmatchEval(amr_version='2.5') or any string other than 1.0/2.0/3.0, including forms like 'v2' or 'AMR2.0'.","commonSituations":"New AMR corpus releases not yet supported by this HanLP version; typo'd or unnormalized version strings in configs; passing the corpus name instead of its version.","solutions":["Use one of '1.0', '2.0', '3.0' exactly","Map your corpus to the closest supported version (e.g. AMR 2.0 utilities for AMR 2.5 data, if structurally compatible)","Upgrade HanLP to a version supporting your AMR version"],"exampleFix":"# before\neval = SmatchEval(amr_version='2.5')\n# after\neval = SmatchEval(amr_version='2.0')","handlingStrategy":"validation","validationCode":"assert amr_version in ('1.0', '2.0', '3.0'), f'unsupported AMR version {amr_version!r}'","typeGuard":"def supported_amr_version(v: str) -> bool:\n    return v in ('1.0', '2.0', '3.0')","tryCatchPattern":"try:\n    ev = SmatchEval(amr_version=amr_version)\nexcept ValueError:\n    amr_version = '2.0'\n    ev = SmatchEval(amr_version=amr_version)","preventionTips":["Normalize version strings before constructing SmatchEval","Pin the AMR corpus version in experiment configs","Upgrade HanLP when new AMR corpus versions are released"],"tags":["hanlp","amr","smatch","version-mismatch","evaluation"],"backgroundTag":"unsupported-version","analyzedSha":"ddb1299bddff079e447af52ec12549c50636bfa8","analyzedAt":"2026-08-27T03:36:54.287Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}