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
Hi @VuBacktracking Thank you so much for this implementation. It works well. Now, i like to include the hidden_states in the ClassificationOutput named tuple. When i do this, during evaluation, its getting in to tensor shape issues. Can you please tell me how to add hidden_states also in ClassificationOutput named tuple.
I am getting below issue, when i am adding hidden_states in ClassificationOutput tuple in MambaTextClassification class
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-129-3435b262f1ae>in<cellline: 1>()
---->1trainer.train()
/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyintrain(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,
/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyin_inner_training_loop(self, batch_size, args, resume_from_checkpoint, trial, ignore_keys_for_eval)
2354self.control=self.callback_handler.on_step_end(args, self.state, self.control)
2355->2356self._maybe_log_save_evaluate(tr_loss, grad_norm, model, trial, epoch, ignore_keys_for_eval)
2357else:
2358self.control=self.callback_handler.on_substep_end(args, self.state, self.control)
/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyin_maybe_log_save_evaluate(self, tr_loss, grad_norm, model, trial, epoch, ignore_keys_for_eval)
2802metrics=None2803ifself.control.should_evaluate:
->2804metrics=self._evaluate(trial, ignore_keys_for_eval)
28052806ifself.control.should_save:
/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyin_evaluate(self, trial, ignore_keys_for_eval, skip_scheduler)
27592760def_evaluate(self, trial, ignore_keys_for_eval, skip_scheduler=False):
->2761metrics=self.evaluate(ignore_keys=ignore_keys_for_eval)
2762self._report_to_hp_search(trial, self.state.global_step, metrics)
2763/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyinevaluate(self, eval_dataset, ignore_keys, metric_key_prefix)
36643665eval_loop=self.prediction_loopifself.args.use_legacy_prediction_loopelseself.evaluation_loop->3666output=eval_loop(
3667eval_dataloader,
3668description="Evaluation",
/usr/local/lib/python3.10/dist-packages/transformers/trainer.pyinevaluation_loop(self, dataloader, description, prediction_loss_only, ignore_keys, metric_key_prefix)
3954 )
3955else:
->3956metrics=self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=all_labels))
3957elifmetricsisNone:
3958metrics= {}
<ipython-input-124-be10a8cea409>incompute_metrics(eval_pred)
5predictions, labels=eval_pred6---->7predictions=np.argmax(predictions, axis=1)
89returneval_metrics.compute(predictions=predictions, references=labels)
/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.pyinargmax(a, axis, out, keepdims)
1227 """
1228 kwds = {'keepdims': keepdims} if keepdims is not np._NoValue else {}
-> 1229 return _wrapfunc(a, 'argmax', axis=axis, out=out, **kwds)
1230
1231
/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
54 bound = getattr(obj, method, None)
55 if bound is None:
---> 56 return _wrapit(obj, method, *args, **kwds)
57
58 try:
/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py in _wrapit(obj, method, *args, **kwds)
43 except AttributeError:
44 wrap = None
---> 45 result = getattr(asarray(obj), method)(*args, **kwds)
46 if wrap:
47 if not isinstance(result, mu.ndarray):
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (2, 5645) + inhomogeneous part.
`
The text was updated successfully, but these errors were encountered:
Hi @VuBacktracking Thank you so much for this implementation. It works well. Now, i like to include the
hidden_states
in theClassificationOutput
named tuple. When i do this, during evaluation, its getting in to tensor shape issues. Can you please tell me how to addhidden_states
also inClassificationOutput
named tuple.I am getting below issue, when i am adding
hidden_states
inClassificationOutput
tuple inMambaTextClassification
classThe text was updated successfully, but these errors were encountered: