You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuntimeErrorTraceback (mostrecentcalllast)
CellIn[24], line1---->1trainer.train()
File [~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py:1938](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py#line=1937), in Trainer.train(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)1936hf_hub_utils.enable_progress_bars()
1937else:
->1938returninner_training_loop(
1939args=args,
1940resume_from_checkpoint=resume_from_checkpoint,
1941trial=trial,
1942ignore_keys_for_eval=ignore_keys_for_eval,
1943 )
File [~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py:2279](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py#line=2278), in Trainer._inner_training_loop(self, batch_size, args, resume_from_checkpoint, trial, ignore_keys_for_eval)2276self.control=self.callback_handler.on_step_begin(args, self.state, self.control)
2278withself.accelerator.accumulate(model):
->2279tr_loss_step=self.training_step(model, inputs)
2281if (
2282args.logging_nan_inf_filter2283andnotis_torch_xla_available()
2284and (torch.isnan(tr_loss_step) ortorch.isinf(tr_loss_step))
2285 ):
2286# if loss is nan or inf simply add the average of previous logged losses2287tr_loss+=tr_loss/ (1+self.state.global_step-self._globalstep_last_logged)
File [~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py:3318](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py#line=3317), in Trainer.training_step(self, model, inputs)3315returnloss_mb.reduce_mean().detach().to(self.args.device)
3317withself.compute_loss_context_manager():
->3318loss=self.compute_loss(model, inputs)
3320delinputs3321if (
3322self.args.torch_empty_cache_stepsisnotNone3323andself.state.global_step%self.args.torch_empty_cache_steps==03324 ):
File [~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py:3363](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/transformers/trainer.py#line=3362), in Trainer.compute_loss(self, model, inputs, return_outputs)3361else:
3362labels=None->3363outputs=model(**inputs)
3364# Save past state if it exists3365# TODO: this needs to be fixed and made cleaner later.3366ifself.args.past_index>=0:
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1736](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1735), in Module._wrapped_call_impl(self, *args, **kwargs)1734returnself._compiled_call_impl(*args, **kwargs) # type: ignore[misc]1735else:
->1736returnself._call_impl(*args, **kwargs)
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1747](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1746), in Module._call_impl(self, *args, **kwargs)1742# If we don't have any hooks, we want to skip the rest of the logic in1743# this function, and just call forward.1744ifnot (self._backward_hooksorself._backward_pre_hooksorself._forward_hooksorself._forward_pre_hooks1745or_global_backward_pre_hooksor_global_backward_hooks1746or_global_forward_hooksor_global_forward_pre_hooks):
->1747returnforward_call(*args, **kwargs)
1749result=None1750called_always_called_hooks=set()
File [~/miniconda3/lib/python3.10/site-packages/deepspeed/utils/nvtx.py:18](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/deepspeed/utils/nvtx.py#line=17), in instrument_w_nvtx.<locals>.wrapped_fn(*args, **kwargs)16ifenable_nvtx:
17get_accelerator().range_push(func.__qualname__)
--->18ret_val=func(*args, **kwargs)
19ifenable_nvtx:
20get_accelerator().range_pop()
File [~/miniconda3/lib/python3.10/site-packages/deepspeed/runtime/engine.py:1899](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/deepspeed/runtime/engine.py#line=1898), in DeepSpeedEngine.forward(self, *inputs, **kwargs)1896ifself.fp16_auto_cast():
1897inputs=self._cast_inputs_half(inputs)
->1899loss=self.module(*inputs, **kwargs)
1901ifself.zero_optimization_partition_weights():
1902# Disable automated discovery of external parameters1903formoduleinself.module.modules():
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1736](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1735), in Module._wrapped_call_impl(self, *args, **kwargs)1734returnself._compiled_call_impl(*args, **kwargs) # type: ignore[misc]1735else:
->1736returnself._call_impl(*args, **kwargs)
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1747](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1746), in Module._call_impl(self, *args, **kwargs)1742# If we don't have any hooks, we want to skip the rest of the logic in1743# this function, and just call forward.1744ifnot (self._backward_hooksorself._backward_pre_hooksorself._forward_hooksorself._forward_pre_hooks1745or_global_backward_pre_hooksor_global_backward_hooks1746or_global_forward_hooksor_global_forward_pre_hooks):
->1747returnforward_call(*args, **kwargs)
1749result=None1750called_always_called_hooks=set()
File [~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py:1085](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py#line=1084), in ChatGLMForSequenceClassification.forward(self, input_ids, position_ids, attention_mask, full_attention_mask, past_key_values, inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)1069defforward(
1070self,
1071input_ids: Optional[torch.LongTensor] =None,
(...)
1081return_dict: Optional[bool] =None,
1082 ) ->Union[Tuple[torch.Tensor, ...], SequenceClassifierOutputWithPast]:
1083return_dict=return_dictifreturn_dictisnotNoneelseself.config.use_return_dict->1085transformer_outputs=self.transformer(
1086input_ids=input_ids,
1087position_ids=position_ids,
1088attention_mask=attention_mask,
1089full_attention_mask=full_attention_mask,
1090past_key_values=past_key_values,
1091inputs_embeds=inputs_embeds,
1092use_cache=use_cache,
1093output_attentions=output_attentions,
1094output_hidden_states=output_hidden_states,
1095return_dict=return_dict,
1096 )
1098hidden_states=transformer_outputs[0]
1099pooled_hidden_states=hidden_states[:, -1]
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1736](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1735), in Module._wrapped_call_impl(self, *args, **kwargs)1734returnself._compiled_call_impl(*args, **kwargs) # type: ignore[misc]1735else:
->1736returnself._call_impl(*args, **kwargs)
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1747](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1746), in Module._call_impl(self, *args, **kwargs)1742# If we don't have any hooks, we want to skip the rest of the logic in1743# this function, and just call forward.1744ifnot (self._backward_hooksorself._backward_pre_hooksorself._forward_hooksorself._forward_pre_hooks1745or_global_backward_pre_hooksor_global_backward_hooks1746or_global_forward_hooksor_global_forward_pre_hooks):
->1747returnforward_call(*args, **kwargs)
1749result=None1750called_always_called_hooks=set()
File [~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py:877](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py#line=876), in ChatGLMModel.forward(self, input_ids, position_ids, attention_mask, full_attention_mask, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)874batch_size, seq_length=input_ids.shape876ifinputs_embedsisNone:
-->877inputs_embeds=self.embedding(input_ids)
879iffull_attention_maskisNone:
880if (attention_maskisnotNoneandnotattention_mask.all()) or (past_key_valuesandseq_length!=1):
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1736](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1735), in Module._wrapped_call_impl(self, *args, **kwargs)1734returnself._compiled_call_impl(*args, **kwargs) # type: ignore[misc]1735else:
->1736returnself._call_impl(*args, **kwargs)
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1747](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1746), in Module._call_impl(self, *args, **kwargs)1742# If we don't have any hooks, we want to skip the rest of the logic in1743# this function, and just call forward.1744ifnot (self._backward_hooksorself._backward_pre_hooksorself._forward_hooksorself._forward_pre_hooks1745or_global_backward_pre_hooksor_global_backward_hooks1746or_global_forward_hooksor_global_forward_pre_hooks):
->1747returnforward_call(*args, **kwargs)
1749result=None1750called_always_called_hooks=set()
File [~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py:813](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/.cache/huggingface/modules/transformers_modules/glm-4-voice-9b/modeling_chatglm.py#line=812), in Embedding.forward(self, input_ids)811defforward(self, input_ids):
812# Embeddings.-->813words_embeddings=self.word_embeddings(input_ids)
814embeddings=words_embeddings815# If the input flag for fp32 residual connection is set, convert for float.File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1736](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1735), in Module._wrapped_call_impl(self, *args, **kwargs)1734returnself._compiled_call_impl(*args, **kwargs) # type: ignore[misc]1735else:
->1736returnself._call_impl(*args, **kwargs)
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py:1747](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py#line=1746), in Module._call_impl(self, *args, **kwargs)1742# If we don't have any hooks, we want to skip the rest of the logic in1743# this function, and just call forward.1744ifnot (self._backward_hooksorself._backward_pre_hooksorself._forward_hooksorself._forward_pre_hooks1745or_global_backward_pre_hooksor_global_backward_hooks1746or_global_forward_hooksor_global_forward_pre_hooks):
->1747returnforward_call(*args, **kwargs)
1749result=None1750called_always_called_hooks=set()
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/sparse.py:190](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/modules/sparse.py#line=189), in Embedding.forward(self, input)189defforward(self, input: Tensor) ->Tensor:
-->190returnF.embedding(
191input,
192self.weight,
193self.padding_idx,
194self.max_norm,
195self.norm_type,
196self.scale_grad_by_freq,
197self.sparse,
198 )
File [~/miniconda3/lib/python3.10/site-packages/torch/nn/functional.py:2551](http://region-3.seetacloud.com:23008/jupyter/lab/tree/autodl-fs/~/miniconda3/lib/python3.10/site-packages/torch/nn/functional.py#line=2550), in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)2545# Note [embedding_renorm set_grad_enabled]2546# XXX: equivalent to2547# with torch.no_grad():2548# torch.embedding_renorm_2549# remove once script supports set_grad_enabled2550_no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
->2551returntorch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: 'weight'mustbe2-D
The text was updated successfully, but these errors were encountered:
代码如下:
错误信息如下:
The text was updated successfully, but these errors were encountered: