Skip to content

Commit

Permalink
[Relax] Fix inline source module cause path too long error (#17354)
Browse files Browse the repository at this point in the history
When the source is provided as inline string literal, creating `Path`
object causes path too long error.
  • Loading branch information
vinx13 authored Sep 10, 2024
1 parent ec42883 commit cc533b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/tvm/relax/frontend/nn/extern.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ def _detect_source_code(source_code) -> str:
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()
Expand Down

0 comments on commit cc533b9

Please sign in to comment.