feat(mm): rename "blake3" to "blake3_multi"

Just make it clearer which is which.
This commit is contained in:
psychedelicious
2024-03-21 17:43:13 +11:00
parent 7726d312e1
commit 72b44f7ebc
4 changed files with 14 additions and 14 deletions

View File

@ -11,6 +11,9 @@ from tqdm import tqdm
from invokeai.app.util.misc import uuid_string
HASHING_ALGORITHMS = Literal[
"blake3_multi",
"blake3_single",
"random",
"md5",
"sha1",
"sha224",
@ -25,9 +28,6 @@ HASHING_ALGORITHMS = Literal[
"sha3_512",
"shake_128",
"shake_256",
"blake3",
"blake3_single",
"random",
]
MODEL_FILE_EXTENSIONS = (".ckpt", ".safetensors", ".bin", ".pt", ".pth")
@ -64,7 +64,7 @@ class ModelHash:
self, algorithm: HASHING_ALGORITHMS = "blake3_single", file_filter: Optional[Callable[[str], bool]] = None
) -> None:
self.algorithm: HASHING_ALGORITHMS = algorithm
if algorithm == "blake3":
if algorithm == "blake3_multi":
self._hash_file = self._blake3
elif algorithm == "blake3_single":
self._hash_file = self._blake3_single
@ -226,4 +226,4 @@ class ModelHash:
def _get_prefix(algorithm: HASHING_ALGORITHMS) -> str:
"""Return the prefix for the given algorithm, e.g. \"blake3:\" or \"md5:\"."""
# blake3_single is a single-threaded version of blake3, prefix should still be "blake3:"
return "blake3:" if algorithm == "blake3_single" else f"{algorithm}:"
return "blake3:" if algorithm == "blake3_single" or algorithm == "blake3_multi" else f"{algorithm}:"