bugfix(hicache): Move exists check before key suffixing (#9749)
This commit is contained in:
@@ -175,11 +175,12 @@ class HiCacheFile(HiCacheStorage):
|
|||||||
target_location: Optional[Any] = None,
|
target_location: Optional[Any] = None,
|
||||||
target_sizes: Optional[Any] = None,
|
target_sizes: Optional[Any] = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
key = self._get_suffixed_key(key)
|
|
||||||
tensor_path = os.path.join(self.file_path, f"{key}.bin")
|
|
||||||
if self.exists(key):
|
if self.exists(key):
|
||||||
logger.debug(f"Key {key} already exists. Skipped.")
|
logger.debug(f"Key {key} already exists. Skipped.")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
key = self._get_suffixed_key(key)
|
||||||
|
tensor_path = os.path.join(self.file_path, f"{key}.bin")
|
||||||
try:
|
try:
|
||||||
value.contiguous().view(dtype=torch.uint8).numpy().tofile(tensor_path)
|
value.contiguous().view(dtype=torch.uint8).numpy().tofile(tensor_path)
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user