Files
doc-exports/docs/modelarts/umn/modelarts_05_3217.html
Lai, Weijian 6aa966a79a ModelArts UMN 24.3.0 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-11-02 09:04:52 +00:00

966 B

What Is the File Path If a File in the model Directory Is Referenced in a Custom Python Package?

To obtain the actual path to a file in a container, use Python.

os.getcwd() # Obtain the current work directory (absolute path) of the file.
os.path.realpath(__ file __) # Obtain the absolute path of the file.

You can also use other methods of obtaining a file path through the search engine and use the obtained path to read and write the file.