Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions swift/megatron/model/gpt_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@ def save_weights(self, mg_models, output_dir: str, is_peft_format: bool = False)
model_dirs=[args.model_dir],
additional_saved_files=self.hf_model.model_meta.additional_saved_files)
logger.info_if(f'Successfully saved `safetensors` model weights in `{output_dir}`.', cond=is_last_rank())
dist.barrier() # Ensure all weights are saved completely


class MultimodalGPTBridge(GPTBridge):
Expand Down
1 change: 0 additions & 1 deletion swift/megatron/train/sft.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def run(self):
images_dir = os.path.join(args.save, 'images')
logger.info(f'images_dir: {images_dir}')
plot_images(images_dir, args.tensorboard_dir)
dist.barrier() # Ensure all weights are saved completely


def megatron_sft_main(args: Optional[Union[List[str], MegatronTrainArguments]] = None):
Expand Down
1 change: 1 addition & 0 deletions swift/megatron/trainers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def swift_datasets_provider(train_val_test_num_samples):
step_batch_size = args.micro_batch_size * data_parallel_size
# To avoid errors caused by the validation set being insufficient to complete a single step.
if val_dataset is not None and hasattr(val_dataset, '__len__') and len(val_dataset) < step_batch_size:
args.eval_iters = 0
val_dataset = None
return train_dataset, val_dataset, None

Expand Down
Loading