Skip to content

Commit 55480e3

Browse files
committed
* create dir first before writing to files
1 parent 40ee1b6 commit 55480e3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

trinity/buffer/ray_wrapper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def __init__(self, storage_config: StorageConfig, config: BufferConfig) -> None:
142142
raise ValueError(
143143
f"File path must end with '.json' or '.jsonl', got {storage_config.path}"
144144
)
145+
path_dir = os.path.dirname(storage_config.path)
146+
os.makedirs(path_dir, exist_ok=True)
145147
self.file = open(storage_config.path, "a", encoding="utf-8")
146148
self.encoder = _Encoder(ensure_ascii=False)
147149

0 commit comments

Comments
 (0)