Skip to content
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

Fix/errors for some models including Mistral-7b and Flan-ul2 #388

Merged
merged 4 commits into from
Nov 27, 2023
Merged
Changes from 2 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
10 changes: 8 additions & 2 deletions bindings/python/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ def convert_multi(
sf_filename = rename(pt_filename)
sf_filename = os.path.join(folder, sf_filename)
convert_file(pt_filename, sf_filename, discard_names=discard_names)
local_filenames.append(sf_filename)

if 'snapshots' in sf_filename.split(os.sep):
new_sf_path = os.path.join(folder, os.path.basename(sf_filename))
shutil.move(sf_filename, new_sf_path)
local_filenames.append(new_sf_path)
else:
local_filenames.append(sf_filename)
lachlancahill marked this conversation as resolved.
Show resolved Hide resolved

index = os.path.join(folder, "model.safetensors.index.json")
with open(index, "w") as f:
Expand All @@ -156,7 +162,7 @@ def convert_multi(
local_filenames.append(index)

operations = [
CommitOperationAdd(path_in_repo=local.split("/")[-1], path_or_fileobj=local) for local in local_filenames
CommitOperationAdd(path_in_repo=os.path.basename(local), path_or_fileobj=local) for local in local_filenames
]
errors: List[Tuple[str, "Exception"]] = []

Expand Down
Loading