@@ -325,15 +325,15 @@ def get_cached_module_file(
325325 # We always copy local files (we could hash the file to see if there was a change, and give them the name of
326326 # that hash, to only copy when there is a modification but it seems overkill for now).
327327 # The only reason we do the copy is to avoid putting too many folders in sys.path.
328- shutil .copy (resolved_module_file , submodule_path / module_file )
328+ shutil .copyfile (resolved_module_file , submodule_path / module_file )
329329 for module_needed in modules_needed :
330330 if len (module_needed .split ("." )) == 2 :
331331 module_needed = "/" .join (module_needed .split ("." ))
332332 module_folder = module_needed .split ("/" )[0 ]
333333 if not os .path .exists (submodule_path / module_folder ):
334334 os .makedirs (submodule_path / module_folder )
335335 module_needed = f"{ module_needed } .py"
336- shutil .copy (os .path .join (pretrained_model_name_or_path , module_needed ), submodule_path / module_needed )
336+ shutil .copyfile (os .path .join (pretrained_model_name_or_path , module_needed ), submodule_path / module_needed )
337337 else :
338338 # Get the commit hash
339339 # TODO: we will get this info in the etag soon, so retrieve it from there and not here.
@@ -350,7 +350,7 @@ def get_cached_module_file(
350350 module_folder = module_file .split ("/" )[0 ]
351351 if not os .path .exists (submodule_path / module_folder ):
352352 os .makedirs (submodule_path / module_folder )
353- shutil .copy (resolved_module_file , submodule_path / module_file )
353+ shutil .copyfile (resolved_module_file , submodule_path / module_file )
354354
355355 # Make sure we also have every file with relative
356356 for module_needed in modules_needed :
0 commit comments