Fix metric calculation in examples and setup tests to run on multi-gpu for no_trainer scripts (#17331)
* Fix length in no_trainer examples * Add setup and teardown * Use new accelerator config generator to automatically make tests able to run based on environment
This commit is contained in:
@@ -683,7 +683,7 @@ def main():
|
||||
predictions_gathered, labels_gathered = accelerator.gather((predictions, labels))
|
||||
# If we are in a multiprocess environment, the last batch has duplicates
|
||||
if accelerator.num_processes > 1:
|
||||
if step == len(eval_dataloader):
|
||||
if step == len(eval_dataloader) - 1:
|
||||
predictions_gathered = predictions_gathered[: len(eval_dataloader.dataset) - samples_seen]
|
||||
labels_gathered = labels_gathered[: len(eval_dataloader.dataset) - samples_seen]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user