Hello,
I am trying to finetune with train_sip.py and the public dataset CheXpert.
At the moment, I simply launched the training by specifying one of the pretrained model available online and the dataset name and directory. Is there any other configuration step that should be made?
At the moment, i am getting the error "target has to be an integer tensor" during _basic_input_validation (see log below).
When going back to the function validation_epoch_end ("sip_finetune.py", line 213), i noticed that "targets" is defined as a Tensor - dtype = float32 , while "logits" values are in the range [-1,1]. I was expecting them to be between 0 and 1... is that right?
What could I do to fix this?
Thank you in advance!
Silvia
LOG:
_Validation sanity check: 50%|█████ | 1/2 [00:00<00:00, 1.40it/s]path: Atelectasis, len: 64
Traceback (most recent call last):
File "/Facebook_NYU/CovidPrognosis-master/cp_examples/sip_finetune/train_sip.py", line 205, in
cli_main(args)
[...]
File "/Facebook_NYU/CovidPrognosis-master/cp_examples/sip_finetune/sip_finetune.py", line 231, in validation_epoch_end
self.val_acc[i](logits, targets)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/torchmetrics/metric.py", line 152, in forward
self.update(*args, **kwargs)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/torchmetrics/metric.py", line 199, in wrapped_func
return update(*args, **kwargs)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 138, in update
correct, total = _accuracy_update(
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/pytorch_lightning/metrics/functional/accuracy.py", line 25, in _accuracy_update
preds, target, mode = _input_format_classification(preds, target, threshold=threshold, top_k=top_k)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/pytorch_lightning/metrics/classification/helpers.py", line 433, in _input_format_classification
case = _check_classification_inputs(
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/pytorch_lightning/metrics/classification/helpers.py", line 296, in _check_classification_inputs
_basic_input_validation(preds, target, threshold, is_multiclass)
File "/home/anaconda3/envs/facebook/lib/python3.9/site-packages/pytorch_lightning/metrics/classification/helpers.py", line 62, in _basic_input_validation
raise ValueError("The target
has to be an integer tensor.")
ValueError: The target
has to be an integer tensor._