8000 [fix] Patch lora bin to dump json config by francoishernandez · Pull Request #28 · eole-nlp/eole · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[fix] Patch lora bin to dump json config #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion eole/bin/model/lora_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from eole.models.model_saver import load_checkpoint
from eole.models import get_model_class
from eole.inputters.inputter import dict_to_vocabs, vocabs_to_dict
from eole.config import recursive_model_fields_set
from safetensors import safe_open
from safetensors.torch import save_file
import glob
Expand Down Expand Up @@ -101,8 +102,9 @@ def run(cls, args):
with open(os.path.join(args.output, "vocab.json"), "w", encoding="utf-8") as f:
json.dump(vocab_dict, f, indent=2, ensure_ascii=False)
# save config
config_dict = recursive_model_fields_set(new_config)
with open(os.path.join(args.output, "config.json"), "w", encoding="utf-8") as f:
json.dump(new_config, f, indent=2, ensure_ascii=False)
json.dump(config_dict, f, indent=2, ensure_ascii=False)
shards = glob.glob(os.path.join(args.base_model, "model.*.safetensors"))
f = []
for i, shard in enumerate(shards):
Expand Down
Loading
0