Upload src/pino/train.py with huggingface_hub
Browse files- src/pino/train.py +3 -1
src/pino/train.py
CHANGED
|
@@ -116,7 +116,9 @@ def multitask_loss(
|
|
| 116 |
trajectory, while subjective and alignment tasks remain unchanged.
|
| 117 |
"""
|
| 118 |
# Pyramid objective: binary multi-label classification (B, 3, 138).
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
|
| 121 |
season_loss = nn.functional.cross_entropy(pred_sub["seasonality"], target_sub["seasonality"].argmax(dim=-1))
|
| 122 |
gender_loss = nn.functional.mse_loss(pred_sub["gender_profile"].squeeze(-1), target_sub["gender_profile"])
|
|
|
|
| 116 |
trajectory, while subjective and alignment tasks remain unchanged.
|
| 117 |
"""
|
| 118 |
# Pyramid objective: binary multi-label classification (B, 3, 138).
|
| 119 |
+
# Clamp targets into [0,1]: some all-tags labels carry a float32 rounding
|
| 120 |
+
# artifact (1.00000012) that trips the CUDA BCE device-side assert on GPU.
|
| 121 |
+
obj_loss = nn.functional.binary_cross_entropy(pred_obj, target_obj.clamp(0.0, 1.0), reduction="mean")
|
| 122 |
|
| 123 |
season_loss = nn.functional.cross_entropy(pred_sub["seasonality"], target_sub["seasonality"].argmax(dim=-1))
|
| 124 |
gender_loss = nn.functional.mse_loss(pred_sub["gender_profile"].squeeze(-1), target_sub["gender_profile"])
|