filesystem_utils
最后更新
modelconverter.utils.filesystem_utilsmodelconverter 读取的本地和远程路径的解析。模型、配置和校准数据可以作为本地路径或存储桶存储的 URL 提供。这里的辅助函数会下载远程文件,将结果上传回去,并根据活动配置文件的目录和共享根目录(容器内的缓存目录,主机上的工作目录)解析相对本地路径。函数
download_from_remote
Python
1def download_from_remote(url: str, dest: PathType, max_files: int = -1) -> Path:max_files。参数url(str): 要下载的文件或目录的 URL。dest(PathType): 下载到的本地目录。max_files(int): 从目录下载的最大文件数。负数表示无限制。
Path: 下载的文件或目录的路径。
get_input_bases
Python
1def get_input_bases() -> list[Path]:get_protocol
Python
1def get_protocol(url: str) -> str:resolve_input_path
Python
1def resolve_input_path(string: str) -> Path | None:None。resolve_path
Python
1def resolve_path(string: str, dest: Path) -> Path:set_input_base
Python
1def set_input_base(base: Path | None):None 以重置为默认值。upload_to_remote
Python
1def upload_to_remote(local_path: PathType, url: str, put_file_plugin: str | None = None):