Fix: Don't list hidden files as models
Copying files from macOS to Linux would produce files starting with . _ that were incorrectly identified as model files.
This commit is contained in:
@@ -45,7 +45,9 @@ if __name__ == "__main__":
|
|||||||
model_paths: list[Path] = []
|
model_paths: list[Path] = []
|
||||||
if Path(args.model).is_dir():
|
if Path(args.model).is_dir():
|
||||||
for path in Path(args.model).glob("**/*.safetensors"):
|
for path in Path(args.model).glob("**/*.safetensors"):
|
||||||
model_paths.append(path)
|
# . から始まるファイルは除外
|
||||||
|
if not path.name.startswith("."):
|
||||||
|
model_paths.append(path)
|
||||||
else:
|
else:
|
||||||
model_paths.append(Path(args.model))
|
model_paths.append(Path(args.model))
|
||||||
|
|
||||||
|
|||||||
@@ -1005,7 +1005,10 @@ def method_change(x: str):
|
|||||||
def create_merge_app(model_holder: TTSModelHolder) -> gr.Blocks:
|
def create_merge_app(model_holder: TTSModelHolder) -> gr.Blocks:
|
||||||
# ONNX モデルが混じらないよう、渡された TTSModelHolder のインスタンス変数を使って TTSModelHolder を作り直す
|
# ONNX モデルが混じらないよう、渡された TTSModelHolder のインスタンス変数を使って TTSModelHolder を作り直す
|
||||||
model_holder = TTSModelHolder(
|
model_holder = TTSModelHolder(
|
||||||
model_holder.root_dir, model_holder.device, model_holder.onnx_providers, ignore_onnx=True
|
model_holder.root_dir,
|
||||||
|
model_holder.device,
|
||||||
|
model_holder.onnx_providers,
|
||||||
|
ignore_onnx=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
model_names = model_holder.model_names
|
model_names = model_holder.model_names
|
||||||
|
|||||||
@@ -523,7 +523,8 @@ class TTSModelHolder:
|
|||||||
[
|
[
|
||||||
f
|
f
|
||||||
for f in model_dir.iterdir()
|
for f in model_dir.iterdir()
|
||||||
if f.suffix in suffixes
|
# 上記 suffixes にマッチするファイルのみを取得し、. から始まるファイルは除外
|
||||||
|
if f.suffix in suffixes and not f.name.startswith(".")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if len(model_files) == 0:
|
if len(model_files) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user