Narsil HF staff commited on
Commit
1788c41
1 Parent(s): 0dee7c2

Update convert.py

Browse files
Files changed (1) hide show
  1. convert.py +6 -5
convert.py CHANGED
@@ -30,6 +30,8 @@ If you find any issues: please report here: https://huggingface.co/spaces/safete
30
 
31
  Feel free to ignore this PR.
32
  """
 
 
33
 
34
  ConversionResult = Tuple[List["CommitOperationAdd"], List[Tuple[str, "Exception"]]]
35
 
@@ -65,7 +67,7 @@ def convert_multi(model_id: str, folder: str, api: "HfApi") -> ConversionResult:
65
  new_pr = api.create_commit(
66
  repo_id=model_id,
67
  operations=[CommitOperationAdd(path_in_repo=index.split("/")[-1], path_or_fileobj=index)],
68
- commit_message=pr_title,
69
  commit_description=COMMIT_DESCRIPTION,
70
  create_pr=True,
71
  )
@@ -97,7 +99,7 @@ def convert_single(model_id: str, folder: str, api: "HfApi") -> ConversionResult
97
  new_pr = api.create_commit(
98
  repo_id=model_id,
99
  operations=[CommitOperationAdd(path_in_repo=sf_name, path_or_fileobj=sf_filename)],
100
- commit_message=pr_title,
101
  commit_description=COMMIT_DESCRIPTION,
102
  create_pr=True,
103
  )
@@ -183,7 +185,7 @@ def convert_generic(model_id: str, folder: str, filenames: Set[str], api: "HfApi
183
  new_pr = api.create_commit(
184
  repo_id=model_id,
185
  operations=[CommitOperationAdd(path_in_repo=sf_in_repo, path_or_fileobj=sf_filename)],
186
- commit_message=pr_title,
187
  commit_description=COMMIT_DESCRIPTION,
188
  create_pr=True,
189
  )
@@ -203,7 +205,6 @@ def convert_generic(model_id: str, folder: str, filenames: Set[str], api: "HfApi
203
 
204
 
205
  def convert(api: "HfApi", model_id: str, force: bool = False) -> Tuple["CommitInfo", List["Exception"]]:
206
- pr_title = "Adding `safetensors` variant of this model"
207
  info = api.model_info(model_id)
208
  filenames = set(s.rfilename for s in info.siblings)
209
 
@@ -213,7 +214,7 @@ def convert(api: "HfApi", model_id: str, force: bool = False) -> Tuple["CommitIn
213
  new_pr = None
214
  try:
215
  operations = None
216
- pr = previous_pr(api, model_id, pr_title)
217
 
218
  library_name = getattr(info, "library_name", None)
219
  if any(filename.endswith(".safetensors") for filename in filenames) and not force:
 
30
 
31
  Feel free to ignore this PR.
32
  """
33
+ PR_TITLE = "Adding `safetensors` variant of this model"
34
+
35
 
36
  ConversionResult = Tuple[List["CommitOperationAdd"], List[Tuple[str, "Exception"]]]
37
 
 
67
  new_pr = api.create_commit(
68
  repo_id=model_id,
69
  operations=[CommitOperationAdd(path_in_repo=index.split("/")[-1], path_or_fileobj=index)],
70
+ commit_message=PR_TITLE,
71
  commit_description=COMMIT_DESCRIPTION,
72
  create_pr=True,
73
  )
 
99
  new_pr = api.create_commit(
100
  repo_id=model_id,
101
  operations=[CommitOperationAdd(path_in_repo=sf_name, path_or_fileobj=sf_filename)],
102
+ commit_message=PR_TITLE,
103
  commit_description=COMMIT_DESCRIPTION,
104
  create_pr=True,
105
  )
 
185
  new_pr = api.create_commit(
186
  repo_id=model_id,
187
  operations=[CommitOperationAdd(path_in_repo=sf_in_repo, path_or_fileobj=sf_filename)],
188
+ commit_message=PR_TITLE,
189
  commit_description=COMMIT_DESCRIPTION,
190
  create_pr=True,
191
  )
 
205
 
206
 
207
  def convert(api: "HfApi", model_id: str, force: bool = False) -> Tuple["CommitInfo", List["Exception"]]:
 
208
  info = api.model_info(model_id)
209
  filenames = set(s.rfilename for s in info.siblings)
210
 
 
214
  new_pr = None
215
  try:
216
  operations = None
217
+ pr = previous_pr(api, model_id, PR_TITLE)
218
 
219
  library_name = getattr(info, "library_name", None)
220
  if any(filename.endswith(".safetensors") for filename in filenames) and not force: