This API supports only the MindSpore framework.
with is used to call open_file to open a file in read-only mode and return the corresponding _ReadableFileWrapper instance. The instance provides the read() and close() methods.
read(self, offset=0, count=-1)
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
offset |
Optional |
Offset of the file to be read. count + offset ≤ file_size |
[0, file_size) |
count |
Optional |
Size of the file to be read. count + offset ≤ file_size |
|
close(self)
mindio_acp.open_file(path: str)
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
path |
Mandatory |
Loading path |
Valid file path |
>>> with mindio_acp.open_file('/mnt/dpc01/checkpoint/rank-0.pt') as f:
... read_data = f.read()