Fix: check hasattr for sampler.set_epoch on WeightedRandomSampler
Browse files- train.py +1 -1
- upload_to_hf.py +1 -1
train.py
CHANGED
|
@@ -701,7 +701,7 @@ def train(
|
|
| 701 |
accum = max(1, grad_accum)
|
| 702 |
|
| 703 |
for epoch in range(start_epoch, epochs + 1):
|
| 704 |
-
if sampler is not None:
|
| 705 |
sampler.set_epoch(epoch)
|
| 706 |
epoch_loss = 0.0
|
| 707 |
for batch_idx, batch in enumerate(dataloader):
|
|
|
|
| 701 |
accum = max(1, grad_accum)
|
| 702 |
|
| 703 |
for epoch in range(start_epoch, epochs + 1):
|
| 704 |
+
if is_ddp and sampler is not None and hasattr(sampler, "set_epoch"):
|
| 705 |
sampler.set_epoch(epoch)
|
| 706 |
epoch_loss = 0.0
|
| 707 |
for batch_idx, batch in enumerate(dataloader):
|
upload_to_hf.py
CHANGED
|
@@ -64,7 +64,7 @@ def upload_repository(repo_name: str = "ViuAI_TTS_200M", private: bool = False):
|
|
| 64 |
".git/*",
|
| 65 |
"*.log",
|
| 66 |
],
|
| 67 |
-
commit_message="
|
| 68 |
)
|
| 69 |
|
| 70 |
print("\n" + "=" * 65)
|
|
|
|
| 64 |
".git/*",
|
| 65 |
"*.log",
|
| 66 |
],
|
| 67 |
+
commit_message="Fix: check hasattr for sampler.set_epoch on WeightedRandomSampler",
|
| 68 |
)
|
| 69 |
|
| 70 |
print("\n" + "=" * 65)
|