From 0a5503672835c3ac2d19492ee934cd94ec86d29c Mon Sep 17 00:00:00 2001 From: Ananth Subramaniam Date: Wed, 26 Nov 2025 14:17:56 -0800 Subject: [PATCH] remove redundant import script Signed-off-by: Ananth Subramaniam --- scripts/import_hf_ckpt.py | 56 --------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 scripts/import_hf_ckpt.py diff --git a/scripts/import_hf_ckpt.py b/scripts/import_hf_ckpt.py deleted file mode 100644 index a4d600711..000000000 --- a/scripts/import_hf_ckpt.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Script to import HuggingFace models into Megatron Bridge checkpoint format using the AutoBridge. - -Usage: - python import_hf_ckpt.py --model-id MODEL_ID --output-path OUTPUT_PATH [--trust-remote-code] -""" - -import argparse -import sys - -import torch - -from megatron.bridge.models.conversion.auto_bridge import AutoBridge - - -def main(): - """Main function to import HuggingFace model to Megatron checkpoint.""" - parser = argparse.ArgumentParser(description="Import HuggingFace model to Megatron checkpoint") - parser.add_argument("--model-id", required=True, help="HuggingFace model ID or path") - parser.add_argument("--output-path", required=True, help="Output directory for Megatron checkpoint") - parser.add_argument("--trust-remote-code", action="store_true", help="Trust remote code") - - args = parser.parse_args() - - if not AutoBridge.can_handle(args.model_id, trust_remote_code=args.trust_remote_code): - print(f"ERROR: Model {args.model_id} is not supported by Megatron-Bridge") - sys.exit(1) - - try: - AutoBridge.import_ckpt(args.model_id, args.output_path, trust_remote_code=args.trust_remote_code) - print(f"Import completed successfully! Checkpoint saved to: {args.output_path}") - except Exception as e: - print(f"Import failed: {e}") - sys.exit(1) - - if torch.distributed.is_initialized(): - torch.distributed.destroy_process_group() - - -if __name__ == "__main__": - main()