This is an automated email from the ASF dual-hosted git repository.
wuwei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new cc533b9254 [Relax] Fix inline source module cause path too long error
(#17354)
cc533b9254 is described below
commit cc533b925452bcaaed9a1ca09da8bcb7e9e30622
Author: Wuwei Lin <[email protected]>
AuthorDate: Tue Sep 10 16:31:17 2024 -0700
[Relax] Fix inline source module cause path too long error (#17354)
When the source is provided as inline string literal, creating `Path`
object causes path too long error.
---
python/tvm/relax/frontend/nn/extern.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/python/tvm/relax/frontend/nn/extern.py
b/python/tvm/relax/frontend/nn/extern.py
index 332d07cbc3..198ef0f23c 100644
--- a/python/tvm/relax/frontend/nn/extern.py
+++ b/python/tvm/relax/frontend/nn/extern.py
@@ -228,7 +228,10 @@ class SourceModule(ExternModule): # pylint:
disable=too-few-public-methods
path = Path(source_code)
except: # pylint: disable=bare-except
return source_code
- if not path.is_file():
+ try:
+ if not path.is_file():
+ return source_code
+ except: # pylint: disable=bare-except
return source_code
with path.open("r", encoding="utf-8") as file:
return file.read()