Unverified Commit 38cd5fb1 authored by hzh0425's avatar hzh0425 Committed by GitHub
Browse files

bugfix(hicache): Move exists check before key suffixing (#9749)

parent 001f5194
...@@ -175,11 +175,12 @@ class HiCacheFile(HiCacheStorage): ...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment