Initial commit

Former-commit-id: 5ca8e1d63727e7bcb8cab16542c763c47e48184a
This commit is contained in:
hiyouga
2023-05-28 18:09:04 +08:00
commit 17024ebc1a
29 changed files with 2399 additions and 0 deletions

23
src/export_model.py Normal file
View File

@@ -0,0 +1,23 @@
# coding=utf-8
# Exports the fine-tuned LLaMA model.
# Usage: python export_model.py --checkpoint_dir path_to_checkpoint --output_dir path_to_save_model
from transformers import HfArgumentParser, TrainingArguments
from utils import ModelArguments, load_pretrained
def main():
parser = HfArgumentParser((ModelArguments, TrainingArguments))
model_args, training_args = parser.parse_args_into_dataclasses()
model, tokenizer = load_pretrained(model_args)
model.save_pretrained(training_args.output_dir, max_shard_size="1GB")
tokenizer.save_pretrained(training_args.output_dir)
print("model and tokenizer have been saved at:", training_args.output_dir)
if __name__ == "__main__":
main()