File size: 1,318 Bytes
a93e458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

megatron_model="/mnt/scratch-artemis/kshitij/LLAMA/latest_megatron_codebase/spgi_vox_mls_text_1b/megatron_model"
model_path="/mnt/scratch-artemis/kshitij/LLAMA/latest_megatron_codebase/spgi_vox_mls_text_1b/extended_non_uniform_model"
size="1"
repo="/mnt/scratch-artemis/kshitij/LLAMA/latest_megatron_codebase/multilinguality_megatron"

# Parse command-line arguments
for arg in "$@"
do
    case $arg in
        --help)
        echo "Usage: ./script.sh [OPTIONS]"
        echo "Options:"
        echo "  --megatron_model=PATH   Path to save converted model."
        echo "  --model_path=PATH       Path of HF directory of model to be converted."
        echo "  --size=NUMBER           Billion parameters of model."
        echo "  --repo=PATH             Path to repo."
        exit 0
        ;;
        --megatron_model=*)
        megatron_model="${arg#*=}"
        shift
        ;;
        --model_path=*)
        model_path="${arg#*=}"
        shift
        ;;
        --size=*)
        size="${arg#*=}"
        shift
        ;;
        --repo=*)
        repo="${arg#*=}"
        shift
        ;;
    esac
done

# Run the Python script
python $repo/weights_conversion/hf_to_megatron.py llama \
    --size=$size \
    --out=$megatron_model \
    --cache-dir=$model_path \
    --model-path=$model_path