Skip to content

[Tools] Model translator#273

Merged
yaoyaoding merged 5 commits intohidet-org:mainfrom
Aalanli:model-translator
Jun 6, 2023
Merged

[Tools] Model translator#273
yaoyaoding merged 5 commits intohidet-org:mainfrom
Aalanli:model-translator

Conversation

@Aalanli
Copy link
Copy Markdown
Contributor

@Aalanli Aalanli commented Jun 5, 2023

See README and examples

Copy link
Copy Markdown
Member

@yaoyaoding yaoyaoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Aalanli,

Thanks for the great tool! I left some minor comments.

@@ -0,0 +1,31 @@
# %%
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have the color support at

class COLORS:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
MAGENTA = '\033[95m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def green(v, fmt='{}'):
return COLORS.OKGREEN + fmt.format(v) + COLORS.ENDC
def cyan(v, fmt='{}'):
return COLORS.OKCYAN + fmt.format(v) + COLORS.ENDC
def blue(v, fmt='{}'):
return COLORS.OKBLUE + fmt.format(v) + COLORS.ENDC
def red(v, fmt='{}'):
return COLORS.FAIL + fmt.format(v) + COLORS.ENDC
def magenta(v, fmt='{}'):
return COLORS.MAGENTA + fmt.format(v) + COLORS.ENDC
def bold(v, fmt='{}'):
return COLORS.BOLD + fmt.format(v) + COLORS.ENDC
def color(v, fmt='{}', fg='default', bg='default'):
fg_code = {
"black": 30,
"red": 31,
"green": 32,
"yellow": 33,
"blue": 34,
"magenta": 35,
"cyan": 36,
"white": 37,
"default": 39,
}
bg_code = {
"black": 40,
"red": 41,
"green": 42,
"yellow": 43,
"blue": 44,
"magenta": 45,
"cyan": 46,
"white": 47,
"default": 49,
}
return '\033[{};{}m{}\033[0m'.format(fg_code[fg], bg_code[bg], fmt.format(v))

We can consider reusing it.

@@ -0,0 +1,91 @@
# Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to move the tests classes.py and functions.py to tests/utils/model_translator/ folder.

@yaoyaoding yaoyaoding changed the title Model translator [Tools] Model translator Jun 6, 2023
Add whitelist to avoid user input
@yaoyaoding yaoyaoding merged commit 57ffb53 into hidet-org:main Jun 6, 2023
@Aalanli Aalanli deleted the model-translator branch September 27, 2023 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants