OpenDelta
OpenDelta copied to clipboard
save issue
save issue
expected behavior
Configuration saved in test_delta_model/config.json
Model weights saved in test_delta_model/pytorch_model.bin
Model weights push to hub
situation description:
thanks for impressive work, however though I followed the document, I still can not save the entire model after training.
https://opendelta.readthedocs.io/en/latest/notes/saveload.html#saveload
reproduce the situation:
packages:
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
Python 3.8.0
opendelta 0.2.4
torch 1.12.0+cu113
transformers 4.21.1
code:
inheriate from:
https://github.com/thunlp/OpenDelta/blob/main/examples/examples_seq2seq/run_seq2seq.py
original code:
repo_name = create_hub_repo_name(root="DeltaHub",
dataset=data_args.task_name,
delta_type = delta_args.delta_type,
model_name_or_path= model_args.model_name_or_path)
results['repo_name'] = repo_name
if training_args.push_to_hub: # TODO add description here
delta_model.save_finetuned(push_to_hub=True, save_directory=repo_name, use_auth_token=True)
# trainer.push_to_hub(**kwargs)
else:
delta_model.save_finetuned(push_to_hub=False, save_directory=repo_name, use_auth_token=True)
replace with :
delta_model.save_finetuned("test_delta_model")
it would display the following:
Traceback (most recent call last):
File "/sharefs/healthshare/fujie/jiajunzhu/repo/full_supervisetry/OpenDelta/examples/examples_seq2seq/wino.py", line 474, in <module>
result = main()
File "/sharefs/healthshare/fujie/jiajunzhu/repo/full_supervisetry/OpenDelta/examples/examples_seq2seq/wino.py", line 467, in main
delta_model.save_finetuned("jjztest_delta_model")
File "/home/fujie/miniconda3/envs/opendel/lib/python3.8/site-packages/opendelta/utils/saving_loading_utils.py", line 149, in save_finetuned
final_center_args = self.create_delta_center_args(center_args=center_args,
File "/home/fujie/miniconda3/envs/opendel/lib/python3.8/site-packages/opendelta/utils/saving_loading_utils.py", line 367, in create_delta_center_args
mdict['name'] = self.create_default_name(**mdict)
File "/home/fujie/miniconda3/envs/opendel/lib/python3.8/site-packages/opendelta/utils/saving_loading_utils.py", line 389, in create_default_name
reponame += kwargs["model_path_public"].split("/")[-1]+"_" if kwargs['model_path_public'] is not None else kwargs['backbone_model']
KeyError: 'model_path_public'
and if i modifed code as
delta_model.save_finetuned("test_delta_model", push_to_hub = True)
it would display
Traceback (most recent call last):
File "/sharefs/healthshare/fujie/jiajunzhu/repo/full_supervisetry/OpenDelta/examples/examples_seq2seq/wino.py", line 474, in <module>
result = main()
File "/sharefs/healthshare/fujie/jiajunzhu/repo/full_supervisetry/OpenDelta/examples/examples_seq2seq/wino.py", line 467, in main
delta_model.save_finetuned("test_delta_model", push_to_hub = True)
TypeError: save_finetuned() got an unexpected keyword argument 'push_to_hub'