From 02d4b2058dd145e10427ce5edb931149f1e43833 Mon Sep 17 00:00:00 2001 From: DerrickYLJ <99985904+DerrickYLJ@users.noreply.github.com> Date: Fri, 21 Jul 2023 00:17:21 -0400 Subject: [PATCH] update new models weights (#837) * update new models weights * update public model --------- Co-authored-by: Zhihao Jia --- inference/utils/download_llama_weights.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/inference/utils/download_llama_weights.py b/inference/utils/download_llama_weights.py index 1cd6928080..0cf4453aa0 100644 --- a/inference/utils/download_llama_weights.py +++ b/inference/utils/download_llama_weights.py @@ -8,6 +8,9 @@ # You can pass the --use-full-precision flag to use the full-precision weight. By default, we use half precision. parser = argparse.ArgumentParser() parser.add_argument("--use-full-precision", action="store_true", help="Use full precision") +parser.add_argument("--use_13B", action="store_true", help="Use full precision") +parser.add_argument("--use_30B", action="store_true", help="Use full precision") +parser.add_argument("--use_65B", action="store_true", help="Use full precision") args = parser.parse_args() if not args.use_full_precision: import torch @@ -45,6 +48,22 @@ def convert_hf_model(model, dst_folder): dst_folder="../weights/llama_7B_weights" if args.use_full_precision else "../weights/llama_7B_weights_half" convert_hf_model(model, dst_folder) +# Download and convert model weights only for hf +if args.use_13B: + model = AutoModelForCausalLM.from_pretrained("decapoda-research/llama-13b-hf") + dst_folder="../weights/llama_13B_weights_half" + convert_hf_model(model, dst_folder) + +if args.use_30B: + model = AutoModelForCausalLM.from_pretrained("decapoda-research/llama-30b-hf") + dst_folder="../weights/llama_30B_weights_half" + convert_hf_model(model, dst_folder) + +if args.use_65B: + model = AutoModelForCausalLM.from_pretrained("decapoda-research/llama-65b-hf") + dst_folder="../weights/llama_65B_weights_half" + convert_hf_model(model, dst_folder) + # Download and convert small model weights model = AutoModelForCausalLM.from_pretrained("JackFram/llama-160m") dst_folder="../weights/llama_160M_weights" if args.use_full_precision else "../weights/llama_160M_weights_half"