You shouldn’t be able to directly convert a string to a floating point number:
float('a')
> ValueError: could not convert string to float: 'a'

so I’m not sure what exactly is stored in self.data[index][1].
Based on the error messages it seems it might be a list or a str.
Generally, you would have to make sure the targets are created as valid tensors (e.g. as a class index).
Depending how you are loading the dataset, you might need to create the class indices from the number of folders or any other mapping.