@@ -201,24 +201,24 @@ def variant_compatible_siblings(filenames, variant=None) -> Union[List[os.PathLi
201201 # .bin, .safetensors, ...
202202 weight_suffixs = [w .split ("." )[- 1 ] for w in weight_names ]
203203 # -00001-of-00002
204- transformers_index_format = "\d{5}-of-\d{5}"
204+ transformers_index_format = r "\d{5}-of-\d{5}"
205205
206206 if variant is not None :
207207 # `diffusion_pytorch_model.fp16.bin` as well as `model.fp16-00001-of-00002.safetenstors`
208208 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 )} )$"
210210 )
211211 # `text_encoder/pytorch_model.bin.index.fp16.json`
212212 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$"
214214 )
215215
216216 # `diffusion_pytorch_model.bin` as well as `model-00001-of-00002.safetenstors`
217217 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 )} )$"
219219 )
220220 # `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" )
222222
223223 if variant is not None :
224224 variant_weights = {f for f in filenames if variant_file_re .match (f .split ("/" )[- 1 ]) is not None }
0 commit comments