Skip to content

Commit

Permalink
update new models weights (#837)
Browse files Browse the repository at this point in the history
* update new models weights

* update public model

---------

Co-authored-by: Zhihao Jia <zhihao@cmu.edu>
  • Loading branch information
DerrickYLJ and jiazhihao authored Jul 21, 2023
1 parent f76a88d commit 02d4b20
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions inference/utils/download_llama_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 02d4b20

Please sign in to comment.