Skip to content

Commit

Permalink
Add coloring to fx graph print out (#128476)
Browse files Browse the repository at this point in the history
Summary:
Note: Won't land immediately, at least I'll need to add a color option to the field. But curious if any tests fail.

Old:
<img width="1294" alt="image" src="https://github.com/pytorch/pytorch/assets/6355099/c3a750ed-5e54-4621-b2e4-be5481be15b6">

New:
<img width="1303" alt="image" src="https://github.com/pytorch/pytorch/assets/6355099/3a1f1adc-6f3a-413e-8b87-ee53da9bf4ed">

X-link: pytorch/pytorch#128476
Approved by: https://github.com/ezyang

Reviewed By: clee2000

Differential Revision: D58628122

Pulled By: Chillee

fbshipit-source-id: f506d0aeeb92b00f5a96b58bb87b1d1bce2c123a
  • Loading branch information
Chillee authored and facebook-github-bot committed Jun 16, 2024
1 parent 19ac876 commit 0e9c559
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2767,3 +2767,9 @@ def warn_once(msg, stacklevel=1):
return
warn_once_cache.add(msg)
warnings.warn(msg, stacklevel=stacklevel + 1)


def strip_color_from_string(text):
# This regular expression matches ANSI escape codes
ansi_escape = re.compile(r"\x1B[@-_][0-?]*[ -/]*[@-~]")
return ansi_escape.sub("", text)

0 comments on commit 0e9c559

Please sign in to comment.