Fix ignore warning

#105
by callanwu - opened
Files changed (1) hide show
  1. modeling_chatglm.py +1 -1
modeling_chatglm.py CHANGED
@@ -1107,7 +1107,7 @@ class ChatGLMForConditionalGeneration(ChatGLMPreTrainedModel):
1107
  )
1108
  elif generation_config.max_new_tokens is not None:
1109
  generation_config.max_length = generation_config.max_new_tokens + input_ids_seq_length
1110
- if not has_default_max_length:
1111
  logger.warn(
1112
  f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(="
1113
  f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. "
 
1107
  )
1108
  elif generation_config.max_new_tokens is not None:
1109
  generation_config.max_length = generation_config.max_new_tokens + input_ids_seq_length
1110
+ if not has_default_max_length and generation_config.max_length is not None:
1111
  logger.warn(
1112
  f"Both `max_new_tokens` (={generation_config.max_new_tokens}) and `max_length`(="
1113
  f"{generation_config.max_length}) seem to have been set. `max_new_tokens` will take precedence. "