使用Huggingface提供的脚本文件,对原始的LLaMA-13B
转换为Huggingface的格式,具体的脚本文件在此处。下面是运行的命令(假设下载的原始文件位于./
下,希望转换后的路径为./converted
):
python convert_llama_weights_to_hf.py --input_dir ./ --model_size 13B --output_dir ./converted
convert_llama_weights_to_hf.py
# Copyright 2022 EleutherAI and The HuggingFace Inc. team. 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 "A