Skip to content

Commit

Permalink
For some models like Mistral and Flan-UL2, when downloaded from the h…
Browse files Browse the repository at this point in the history
…ub the binary files write to a snapshots/<uuid> subdirectory. Then when the files are committed, they cannot be found and the commit fails with an error.
  • Loading branch information
Lachlan Cahill committed Nov 18, 2023
1 parent 829bfa8 commit 71d7a87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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)

index = os.path.join(folder, "model.safetensors.index.json")
with open(index, "w") as f:
Expand Down

0 comments on commit 71d7a87

Please sign in to comment.