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
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 predictions = trainer.predict(tokenized_datasets["validation"])
2 print(predictions.predictions.shape, predictions.label_ids.shape)
File ~/anaconda3/envs/py10hugface/lib/python3.10/site-packages/transformers/trainer.py:4053, in Trainer.predict(self, test_dataset, ignore_keys, metric_key_prefix)
4050 start_time = time.time()
4052 eval_loop = self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
-> 4053 output = eval_loop(
4054 test_dataloader, description="Prediction", ignore_keys=ignore_keys, metric_key_prefix=metric_key_prefix
4055 )
4056 total_batch_size = self.args.eval_batch_size * self.args.world_size
4057 if f"{metric_key_prefix}_jit_compilation_time" in output.metrics:
File ~/anaconda3/envs/py10hugface/lib/python3.10/site-packages/transformers/trainer.py:4235, in Trainer.evaluation_loop(self, dataloader, description, prediction_loss_only, ignore_keys, metric_key_prefix)
4232 delattr(self, "_past")
4234 # Gather all remaining tensors and put them back on the CPU
-> 4235 all_losses = all_losses.get_arrays()
4236 all_preds = all_preds.get_arrays()
4237 all_labels = all_labels.get_arrays()
File ~/anaconda3/envs/py10hugface/lib/python3.10/site-packages/transformers/trainer_pt_utils.py:346, in EvalLoopContainer.get_arrays(self)
344 def get_arrays(self):
345 """Returns the numpified and moved to CPU stored objects."""
--> 346 self.to_cpu_and_numpy()
347 return self.arrays
File ~/anaconda3/envs/py10hugface/lib/python3.10/site-packages/transformers/trainer_pt_utils.py:333, in EvalLoopContainer.to_cpu_and_numpy(self)
330 if self.tensors is None:
331 return
--> 333 new_arrays = nested_numpify(self.tensors)
334 if self.arrays is None:
335 self.arrays = new_arrays
File ~/anaconda3/envs/py10hugface/lib/python3.10/site-packages/transformers/trainer_pt_utils.py:180, in nested_numpify(tensors)
175 if t.dtype == torch.bfloat16:
176 # As of Numpy 1.21.4, NumPy does not support bfloat16 (see
177 # https://github.com/numpy/numpy/blob/a47ecdea856986cd60eabbd53265c2ca5916ad5d/doc/source/user/basics.types.rst ).
178 # Until Numpy adds bfloat16, we must convert float32.
179 t = t.to(torch.float32)
--> 180 return t.numpy()
RuntimeError: Numpy is not available
Expected behavior
To see the same output as in the class i.e., (408, 2) (408,)
The text was updated successfully, but these errors were encountered:
System Info
MacOs Sequoia 15.0.1, Python 3.10
Running
pip list
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
From here, https://huggingface.co/learn/nlp-course/chapter3/3#evaluation, I ran this code,
and I got this error,
Expected behavior
To see the same output as in the class i.e.,
(408, 2) (408,)
The text was updated successfully, but these errors were encountered: