Hi
When I do linear evaluation:
Traceback (most recent call last):
File "linear_evaluation.py", line 149, in
trainer.fit(module, train_loader, valid_loader)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 741, in fit
self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 685, in _call_and_handle_interrupt
return trainer_fn(*args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 777, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1199, in _run
self._dispatch()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1279, in _dispatch
self.training_type_plugin.start_training(self)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 202, in start_training
self._results = trainer.run_stage()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1289, in run_stage
return self._run_train()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1311, in _run_train
self._run_sanity_check(self.lightning_module)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1375, in _run_sanity_check
self._evaluation_loop.run()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/base.py", line 145, in run
self.advance(*args, *kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 110, in advance
dl_outputs = self.epoch_loop.run(dataloader, dataloader_idx, dl_max_batches, self.num_dataloaders)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/base.py", line 145, in run
self.advance(args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 122, in advance
output = self._evaluation_step(batch, batch_idx, dataloader_idx)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 217, in _evaluation_step
output = self.trainer.accelerator.validation_step(step_kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/accelerators/accelerator.py", line 239, in validation_step
return self.training_type_plugin.validation_step(step_kwargs.values())
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 219, in validation_step
return self.model.validation_step(args, kwargs)
File "/data1/simon/projects/musicrepresentations/clmr/modules/linear_evaluation.py", line 64, in validation_step
self.log("Valid/accuracy", self.accuracy(preds, y))
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, *kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/metric.py", line 205, in forward
self.update(args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/metric.py", line 263, in wrapped_func
return update(*args, **kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/classification/accuracy.py", line 228, in update
mode = _mode(preds, target, self.threshold, self.top_k, self.num_classes, self.multiclass)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/functional/classification/accuracy.py", line 59, in _mode
preds, target, threshold=threshold, top_k=top_k, num_classes=num_classes, multiclass=multiclass
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/utilities/checks.py", line 251, in _check_classification_inputs
_basic_input_validation(preds, target, threshold, multiclass)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/utilities/checks.py", line 33, in _basic_input_validation
raise ValueError("The target has to be an integer tensor.")
ValueError: The target has to be an integer tensor.
Hi When I do linear evaluation: Traceback (most recent call last): File "linear_evaluation.py", line 149, in
trainer.fit(module, train_loader, valid_loader)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 741, in fit
self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 685, in _call_and_handle_interrupt
return trainer_fn(*args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 777, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1199, in _run
self._dispatch()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1279, in _dispatch
self.training_type_plugin.start_training(self)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 202, in start_training
self._results = trainer.run_stage()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1289, in run_stage
return self._run_train()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1311, in _run_train
self._run_sanity_check(self.lightning_module)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 1375, in _run_sanity_check
self._evaluation_loop.run()
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/base.py", line 145, in run
self.advance(*args, *kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 110, in advance
dl_outputs = self.epoch_loop.run(dataloader, dataloader_idx, dl_max_batches, self.num_dataloaders)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/base.py", line 145, in run
self.advance(args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 122, in advance
output = self._evaluation_step(batch, batch_idx, dataloader_idx)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 217, in _evaluation_step
output = self.trainer.accelerator.validation_step(step_kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/accelerators/accelerator.py", line 239, in validation_step
return self.training_type_plugin.validation_step(step_kwargs.values())
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 219, in validation_step
return self.model.validation_step(args, kwargs)
File "/data1/simon/projects/musicrepresentations/clmr/modules/linear_evaluation.py", line 64, in validation_step
self.log("Valid/accuracy", self.accuracy(preds, y))
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, *kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/metric.py", line 205, in forward
self.update(args, kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/metric.py", line 263, in wrapped_func
return update(*args, **kwargs)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/classification/accuracy.py", line 228, in update
mode = _mode(preds, target, self.threshold, self.top_k, self.num_classes, self.multiclass)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/functional/classification/accuracy.py", line 59, in _mode
preds, target, threshold=threshold, top_k=top_k, num_classes=num_classes, multiclass=multiclass
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/utilities/checks.py", line 251, in _check_classification_inputs
_basic_input_validation(preds, target, threshold, multiclass)
File "/data1/anaconda3/envs/CLMR/lib/python3.6/site-packages/torchmetrics/utilities/checks.py", line 33, in _basic_input_validation
raise ValueError("The
target
has to be an integer tensor.") ValueError: Thetarget
has to be an integer tensor.