crp94 / Personalised-aesthetic-assessment-using-residual-adapters

Jupyter notebooks used as supporting material for an msc thesis about personalised aesthetic assessment using residual adapters.
GNU General Public License v3.0
19 stars 2 forks source link

np.vstack #4

Closed SongYii closed 4 years ago

SongYii commented 4 years ago

Hello, thank you for your work, when I run the file I have encountered the following problems: Adapters.py Problem1: try: running_loss += loss.data[0] except: print('unexpected error, could not calculate loss or do a sum.')

During training, it outputs 'unexpected error, could not calculate loss or do a sum.' So I changed running_loss + = loss.data [0] to running_loss + = loss.item ()

Problem2: ratingsi=[(list(np.float([j for j in i]))) for i in ratings] predictionsi=[(list(np.float([j for j in i]))) for i in predictions] ratings_i=np.vstack(ratings) predictions_i=np.vstack(predictions)

ratings_i has been assigned twice, I do n’t know what should be correct here,and the following problems occur during runtime TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. I tried modifying ratings_i = np.vstack (ratings) to ratings_i = np.vstack (ratings.cpu ()) but it didn't seem to solve the problem. Can you help, thank you very much.