This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# safetensors -> torch_dist
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
megatron export \
|
||||
--model Qwen/Qwen3-30B-A3B-Instruct-2507 \
|
||||
--output_dir Qwen3-30B-A3B-Instruct-2507-mcore \
|
||||
--to_mcore true \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 2 \
|
||||
--pipeline_model_parallel_size 2 \
|
||||
--test_convert_precision true
|
||||
|
||||
# torch_dist -> safetensors
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
megatron export \
|
||||
--mcore_model Qwen3-30B-A3B-Instruct-2507-mcore \
|
||||
--output_dir Qwen3-30B-A3B-Instruct-2507-hf \
|
||||
--to_hf true \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 2 \
|
||||
--pipeline_model_parallel_size 2 \
|
||||
--test_convert_precision true
|
||||
@@ -0,0 +1,46 @@
|
||||
# torch_dist -> safetensors
|
||||
# If you need to perform merge-lora and test precision alignment after merge-lora,
|
||||
# simply set `--merge_lora true`
|
||||
|
||||
# You can also change `--model safetensors-path` to `--mcore_model torch-dist-path`.
|
||||
# These two methods are equivalent, and mcore-bridge will handle it automatically.
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
megatron export \
|
||||
--model Qwen/Qwen3-30B-A3B-Instruct-2507 \
|
||||
--mcore_adapter megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx \
|
||||
--output_dir megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx-lora \
|
||||
--merge_lora false \
|
||||
--to_hf true \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 2 \
|
||||
--pipeline_model_parallel_size 2 \
|
||||
--test_convert_precision true
|
||||
|
||||
# safetensors -> torch_dist
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
megatron export \
|
||||
--model Qwen/Qwen3-30B-A3B-Instruct-2507 \
|
||||
--adapters megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx-lora \
|
||||
--output_dir megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx-mcore \
|
||||
--merge_lora false \
|
||||
--to_mcore true \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 2 \
|
||||
--pipeline_model_parallel_size 2 \
|
||||
--test_convert_precision true
|
||||
|
||||
# Merge-LoRA:
|
||||
# torch_dist -> torch_dist
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
NPROC_PER_NODE=4 \
|
||||
megatron export \
|
||||
--model Qwen/Qwen3-30B-A3B-Instruct-2507 \
|
||||
--mcore_adapter megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx \
|
||||
--output_dir megatron_output/Qwen3-30B-A3B-Instruct-2507/vx-xxx/checkpoint-xxx-merged \
|
||||
--merge_lora true \
|
||||
--to_mcore true \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--expert_model_parallel_size 2 \
|
||||
--pipeline_model_parallel_size 2
|
||||
@@ -0,0 +1,9 @@
|
||||
NPROC_PER_NODE=2 \
|
||||
CUDA_VISIBLE_DEVICES=0,1 \
|
||||
megatron export \
|
||||
--adapters megatron_output/Qwen2.5-7B-Instruct/vx-xxx/checkpoint-xxx \
|
||||
--tensor_model_parallel_size 2 \
|
||||
--to_hf true \
|
||||
--merge_lora true \
|
||||
--torch_dtype bfloat16 \
|
||||
--output_dir megatron_output/Qwen2.5-7B-Instruct/vx-xxx/checkpoint-xxx-merged
|
||||
Reference in New Issue
Block a user