Spaces:
Sleeping
Sleeping
SAM
commited on
correct contrastive loss with simple formula
Browse files
speech/cosyvoice/flow/flow_matching.py
CHANGED
|
@@ -284,11 +284,8 @@ class ConditionalCFM(BASECFM):
|
|
| 284 |
perm[i] = (i + 1) % b
|
| 285 |
|
| 286 |
# Get negative samples
|
| 287 |
-
|
| 288 |
|
| 289 |
-
# KEY: Use the SAME z that created x_t (not new noise)
|
| 290 |
-
# This asks: "what if x_t came from x1_neg instead?"
|
| 291 |
-
u_negative = x1_neg - (1 - self.sigma_min) * z
|
| 292 |
else:
|
| 293 |
u_negative = u_positive
|
| 294 |
|
|
|
|
| 284 |
perm[i] = (i + 1) % b
|
| 285 |
|
| 286 |
# Get negative samples
|
| 287 |
+
u_negative = u_positive[perm]
|
| 288 |
|
|
|
|
|
|
|
|
|
|
| 289 |
else:
|
| 290 |
u_negative = u_positive
|
| 291 |
|