Since you are returning 3 values in train_model, you would also have to assign them:
model_ft, hist, losses = train_model(model_ft, dataloaders_dict, criterion, optimizer_ft, num_epochs=num_epochs, is_inception=(model_name=="inception"))

PS: you can add code snippets by wrapping them in three backticks ```