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
I am encounting the error IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item<T>() in C++ to convert a 0-dim tensor to a number Output is truncated.
### Error messages and logs
All error is here:
'''
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[84], line 31
28 trainer = make_trainer(max_epochs=max_epochs, name='test', patience=patience)
30 try:
---> 31 trainer.fit(model, train_dataloader, val_dataloader)
32 except KeyError as e:
33 print(f"KeyError: {e}")
File c:\Users\foo\anaconda3\envs\p100_venv\lib\site-packages\pytorch_lightning\trainer\trainer.py:544, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
542 self.state.status = TrainerStatus.RUNNING
543 self.training = True
--> 544 call._call_and_handle_interrupt(
545 self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
546 )
File c:\Users\foo\anaconda3\envs\p100_venv\lib\site-packages\pytorch_lightning\trainer\call.py:44, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
42 if trainer.strategy.launcher is not None:
43 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 44 return trainer_fn(*args, **kwargs)
46 except _TunerExitException:
47 _call_teardown_hook(trainer)
File c:\Users\foo\anaconda3\envs\p100_venv\lib\site-packages\pytorch_lightning\trainer\trainer.py:580, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
573 assert self.state.fn is not None
...
1075 def __getitem__(self, idx: int) -> "CompositionalMetric":
1076 """Construct compositional metric using the get item operator."""
-> 1077 return CompositionalMetric(lambda x: x[idx], self, None)
IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Environment
Current environment
```
Windows11
VSCode==1.88.1
PyTorch==2.2.2
pytorch-lightning==2.1.2
```
More info
Please tell me what is involved this error if anyone knows solution.
The text was updated successfully, but these errors were encountered:
Bug description
I am encounting the error
IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item<T>() in C++ to convert a 0-dim tensor to a number Output is truncated.
What version are you seeing the problem on?
v2.1
How to reproduce the bug
Environment
Current environment
``` Windows11 VSCode==1.88.1 PyTorch==2.2.2 pytorch-lightning==2.1.2 ```More info
Please tell me what is involved this error if anyone knows solution.
The text was updated successfully, but these errors were encountered: