@@ -201,24 +201,24 @@ def variant_compatible_siblings(filenames, variant=None) -> Union[List[os.PathLi
201
201
# .bin, .safetensors, ...
202
202
weight_suffixs = [w .split ("." )[- 1 ] for w in weight_names ]
203
203
# -00001-of-00002
204
- transformers_index_format = "\d{5}-of-\d{5}"
204
+ transformers_index_format = r "\d{5}-of-\d{5}"
205
205
206
206
if variant is not None :
207
207
# `diffusion_pytorch_model.fp16.bin` as well as `model.fp16-00001-of-00002.safetenstors`
208
208
variant_file_re = re .compile (
209
- f "({ '|' .join (weight_prefixes )} )\.({ variant } |{ variant } -{ transformers_index_format } )\.({ '|' .join (weight_suffixs )} )$"
209
+ rf "({ '|' .join (weight_prefixes )} )\.({ variant } |{ variant } -{ transformers_index_format } )\.({ '|' .join (weight_suffixs )} )$"
210
210
)
211
211
# `text_encoder/pytorch_model.bin.index.fp16.json`
212
212
variant_index_re = re .compile (
213
- f "({ '|' .join (weight_prefixes )} )\.({ '|' .join (weight_suffixs )} )\.index\.{ variant } \.json$"
213
+ rf "({ '|' .join (weight_prefixes )} )\.({ '|' .join (weight_suffixs )} )\.index\.{ variant } \.json$"
214
214
)
215
215
216
216
# `diffusion_pytorch_model.bin` as well as `model-00001-of-00002.safetenstors`
217
217
non_variant_file_re = re .compile (
218
- f "({ '|' .join (weight_prefixes )} )(-{ transformers_index_format } )?\.({ '|' .join (weight_suffixs )} )$"
218
+ rf "({ '|' .join (weight_prefixes )} )(-{ transformers_index_format } )?\.({ '|' .join (weight_suffixs )} )$"
219
219
)
220
220
# `text_encoder/pytorch_model.bin.index.json`
221
- non_variant_index_re = re .compile (f "({ '|' .join (weight_prefixes )} )\.({ '|' .join (weight_suffixs )} )\.index\.json" )
221
+ non_variant_index_re = re .compile (rf "({ '|' .join (weight_prefixes )} )\.({ '|' .join (weight_suffixs )} )\.index\.json" )
222
222
223
223
if variant is not None :
224
224
variant_weights = {f for f in filenames if variant_file_re .match (f .split ("/" )[- 1 ]) is not None }
0 commit comments