patrickvonplaten commited on
Commit
369daec
1 Parent(s): 983d012
__pycache__/app.cpython-310.pyc ADDED
Binary file (2.63 kB). View file
__pycache__/convert.cpython-310.pyc ADDED
Binary file (8.15 kB). View file
convert.py CHANGED
@@ -167,8 +167,12 @@ def convert_generic(model_id: str, folder: str, filenames: Set[str]) -> List["Co
167
  def convert(api: "HfApi", model_id: str, force: bool = False) -> Optional["CommitInfo"]:
168
  pr_title = "Adding `safetensors` variant of this model"
169
  info = api.model_info(model_id)
170
- filenames = set(s.rfilename for s in info.siblings if len(s.rfilename.split("/")) > 1)
171
 
 
 
 
 
 
172
  with TemporaryDirectory() as d:
173
  folder = os.path.join(d, repo_folder_name(repo_id=model_id, repo_type="models"))
174
  os.makedirs(folder)
167
  def convert(api: "HfApi", model_id: str, force: bool = False) -> Optional["CommitInfo"]:
168
  pr_title = "Adding `safetensors` variant of this model"
169
  info = api.model_info(model_id)
 
170
 
171
+ def is_valid_filename(filename):
172
+ return len(filename.split("/")) > 1 or filename in ["pytorch_model.bin", "diffusion_pytorch_model.bin"]
173
+ filenames = set(s.rfilename for s in info.siblings if is_valid_filename(s.rfilename))
174
+
175
+ print(filenames)
176
  with TemporaryDirectory() as d:
177
  folder = os.path.join(d, repo_folder_name(repo_id=model_id, repo_type="models"))
178
  os.makedirs(folder)