Skip to content

Commit a626dc8

Browse files
xuhancnpytorchmergebot
authored andcommitted
[AOTI] windows package load dev (#158671)
changes: 1. add extract file fail handler for Windows develop. 2. normalize more file paths. Pull Request resolved: #158671 Approved by: https://github.com/angelayi, https://github.com/desertfire
1 parent fd47401 commit a626dc8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

torch/csrc/inductor/aoti_package/model_package_loader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@ std::string normalize_path_separator(const std::string& orig_path) {
5353
On Windows, when we input: "C:\Users\Test\file.txt", the output should be:
5454
"C:/Users/Test/file.txt". And then, we can process the output like on Linux.
5555
*/
56-
#ifdef _WIN32
5756
std::string normalized_path = orig_path;
57+
#ifdef _WIN32
5858
std::replace(normalized_path.begin(), normalized_path.end(), '\\', '/');
59-
return normalized_path;
60-
#else
61-
return orig_path;
6259
#endif
60+
return normalized_path;
6361
}
6462

6563
bool file_exists(const std::string& path) {
@@ -548,7 +546,7 @@ AOTIModelPackageLoader::AOTIModelPackageLoader(
548546
<< found_filenames[1];
549547
}
550548

551-
temp_dir_ = create_temp_dir();
549+
temp_dir_ = normalize_path_separator(create_temp_dir());
552550

553551
std::string so_filename;
554552
std::string cpp_filename;
@@ -581,6 +579,8 @@ AOTIModelPackageLoader::AOTIModelPackageLoader(
581579
.append(filename);
582580
}
583581

582+
output_path_str = normalize_path_separator(output_path_str);
583+
584584
LOG(INFO) << "Extract file: " << filename_str << " to "
585585
<< output_path_str;
586586

0 commit comments

Comments
 (0)