MulaiMulai sekarang secara gratis

Loss weighting

Three versions of the two-output model for alphabet and character prediction that you built before have been trained: model_a, model_b, and model_c. For all three, the loss was defined as follows:

loss_alpha = criterion(outputs_alpha, labels_alpha)
loss_char = criterion(outputs_char, labels_char)
loss = ((1 - char_weight) * loss_alpha) + (char_weight * loss_char)

However, each of the three models was trained with a different char_weight: 0.1, 0.5, or 0.9.

Use the function you have defined in the previous exercise, evaluate_model(), to check the accuracy of each model. Which char_weight was used to train which model?

Latihan ini adalah bagian dari kursus

Intermediate Deep Learning with PyTorch

Lihat Kursus

Latihan interaktif praktis

Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.

Mulai berolahraga