-
Notifications
You must be signed in to change notification settings - Fork 251
fix merging aiter config #1443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix merging aiter config #1443
Changes from all commits
4a2f038
75ec967
c654ff3
e6db44a
163b30e
5477f97
2121258
d5eff0c
240b6f7
f650b91
e1ba8a3
0513bad
2e2056a
41d2fea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -66,81 +66,6 @@ def mp_lock( | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # config_env start here | ||||||||||||||||||||||||||||||||||
| def update_config_files(file_path: str, merge_name: str): | ||||||||||||||||||||||||||||||||||
| path_list = file_path.split(os.pathsep) if file_path else [] | ||||||||||||||||||||||||||||||||||
| if len(path_list) <= 1: | ||||||||||||||||||||||||||||||||||
| return file_path | ||||||||||||||||||||||||||||||||||
| df_list = [] | ||||||||||||||||||||||||||||||||||
| ## merge config files | ||||||||||||||||||||||||||||||||||
| ##example: AITER_CONFIG_GEMM_A4W4="/path1:/path2" | ||||||||||||||||||||||||||||||||||
| import pandas as pd | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| df_list.append(pd.read_csv(path_list[0])) | ||||||||||||||||||||||||||||||||||
| for i, path in enumerate(path_list[1:]): | ||||||||||||||||||||||||||||||||||
| if os.path.exists(path): | ||||||||||||||||||||||||||||||||||
| df = pd.read_csv(path) | ||||||||||||||||||||||||||||||||||
| ## check columns | ||||||||||||||||||||||||||||||||||
| assert ( | ||||||||||||||||||||||||||||||||||
| df.columns.tolist() == df_list[0].columns.tolist() | ||||||||||||||||||||||||||||||||||
| ), f"Column mismatch between {path_list[0]} and {path}, {df_list[0].columns.tolist()}, {df.columns.tolist()}" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| df_list.append(df) | ||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| logger.info(f"path {i+1}: {path} (not exist)") | ||||||||||||||||||||||||||||||||||
| merge_df = pd.concat(df_list, ignore_index=True) if df_list else pd.DataFrame() | ||||||||||||||||||||||||||||||||||
| ## get keys from untuned file to drop_duplicates | ||||||||||||||||||||||||||||||||||
| untuned_name = ( | ||||||||||||||||||||||||||||||||||
| re.sub(r"(?:_)?tuned$", r"\1untuned", merge_name) | ||||||||||||||||||||||||||||||||||
| if re.search(r"(?:_)?tuned$", merge_name) | ||||||||||||||||||||||||||||||||||
| else merge_name.replace("tuned", "untuned") | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| untuned_path = f"{AITER_ROOT_DIR}/aiter/configs/{untuned_name}.csv" | ||||||||||||||||||||||||||||||||||
| if os.path.exists(untuned_path): | ||||||||||||||||||||||||||||||||||
| untunedf = pd.read_csv(untuned_path) | ||||||||||||||||||||||||||||||||||
| keys = untunedf.columns.to_list() | ||||||||||||||||||||||||||||||||||
| keys.append("cu_num") | ||||||||||||||||||||||||||||||||||
| merge_df = ( | ||||||||||||||||||||||||||||||||||
| merge_df.sort_values("us") | ||||||||||||||||||||||||||||||||||
| .drop_duplicates(subset=keys, keep="first") | ||||||||||||||||||||||||||||||||||
| .reset_index(drop=True) | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| logger.warning( | ||||||||||||||||||||||||||||||||||
| f"Untuned config file not found: {untuned_path}. Using all columns for deduplication." | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| new_file_path = f"/tmp/{merge_name}.csv" | ||||||||||||||||||||||||||||||||||
| merge_df.to_csv(new_file_path, index=False) | ||||||||||||||||||||||||||||||||||
| return new_file_path | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| def get_config_file(env_name, default_file, tuned_file_name): | ||||||||||||||||||||||||||||||||||
| config_env_file = os.getenv(env_name) | ||||||||||||||||||||||||||||||||||
| # default_file = f"{AITER_ROOT_DIR}/aiter/configs/{tuned_file_name}.csv" | ||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if not config_env_file: | ||||||||||||||||||||||||||||||||||
| model_config_dir = Path(f"{AITER_ROOT_DIR}/aiter/configs/model_configs/") | ||||||||||||||||||||||||||||||||||
| op_tuned_file_list = [ | ||||||||||||||||||||||||||||||||||
| p | ||||||||||||||||||||||||||||||||||
| for p in model_config_dir.glob(f"*{tuned_file_name}*") | ||||||||||||||||||||||||||||||||||
| if (p.is_file() and "untuned" not in str(p)) | ||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if not op_tuned_file_list: | ||||||||||||||||||||||||||||||||||
| config_file = default_file | ||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| tuned_files = ":".join(str(p) for p in op_tuned_file_list) | ||||||||||||||||||||||||||||||||||
| tuned_files = default_file + ":" + tuned_files | ||||||||||||||||||||||||||||||||||
| logger.info( | ||||||||||||||||||||||||||||||||||
| f"merge tuned file under model_configs/ and configs/ {tuned_files}" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| config_file = update_config_files(tuned_files, tuned_file_name) | ||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| config_file = update_config_files(config_env_file, tuned_file_name) | ||||||||||||||||||||||||||||||||||
| # print(f"get config file from environment ", config_file) | ||||||||||||||||||||||||||||||||||
| return config_file | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A4W4 = os.getenv( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A4W4", | ||||||||||||||||||||||||||||||||||
| f"{AITER_ROOT_DIR}/aiter/configs/a4w4_blockscale_tuned_gemm.csv", | ||||||||||||||||||||||||||||||||||
|
|
@@ -185,56 +110,170 @@ def get_config_file(env_name, default_file, tuned_file_name): | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_BF16 = os.getenv( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_BF16", | ||||||||||||||||||||||||||||||||||
| f"{AITER_ROOT_DIR}/aiter/configs/tuned_gemm.csv", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A4W4_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A4W4", AITER_CONFIG_GEMM_A4W4, "a4w4_blockscale_tuned_gemm" | ||||||||||||||||||||||||||||||||||
| f"{AITER_ROOT_DIR}/aiter/configs/bf16_tuned_gemm.csv", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8", AITER_CONFIG_GEMM_A8W8, "a8w8_tuned_gemm" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE, | ||||||||||||||||||||||||||||||||||
| "a8w8_bpreshuffle_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE, | ||||||||||||||||||||||||||||||||||
| "a8w8_bpreshuffle_cktile_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BLOCKSCALE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE, | ||||||||||||||||||||||||||||||||||
| "a8w8_blockscale_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_FMOE_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_FMOE", AITER_CONFIG_FMOE, "tuned_fmoe" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE, | ||||||||||||||||||||||||||||||||||
| "a8w8_blockscale_bpreshuffle_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| class AITER_CONFIG(object): | ||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A4W4_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A4W4", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A4W4, | ||||||||||||||||||||||||||||||||||
| "a4w4_blockscale_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_A8W8_BATCHED_GEMM_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_A8W8_BATCHED_GEMM", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_A8W8_BATCHED_GEMM, | ||||||||||||||||||||||||||||||||||
| "a8w8_tuned_batched_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A8W8_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8", AITER_CONFIG_GEMM_A8W8, "a8w8_tuned_gemm" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| AITER_CONFIG_BF16_BATCHED_GEMM_FILE = get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_BF16_BATCHED_GEMM", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_BF16_BATCHED_GEMM, | ||||||||||||||||||||||||||||||||||
| "bf16_tuned_batched_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE, | ||||||||||||||||||||||||||||||||||
| "a8w8_bpreshuffle_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BLOCKSCALE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE, | ||||||||||||||||||||||||||||||||||
| "a8w8_blockscale_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_FMOE_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_FMOE", AITER_CONFIG_FMOE, "tuned_fmoe" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE, | ||||||||||||||||||||||||||||||||||
| "a8w8_blockscale_bpreshuffle_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_A8W8_BATCHED_GEMM_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_A8W8_BATCHED_GEMM", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_A8W8_BATCHED_GEMM, | ||||||||||||||||||||||||||||||||||
| "a8w8_tuned_batched_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_BF16_BATCHED_GEMM_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_BF16_BATCHED_GEMM", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_BF16_BATCHED_GEMM, | ||||||||||||||||||||||||||||||||||
| "bf16_tuned_batched_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_BF16_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_BF16", AITER_CONFIG_GEMM_BF16, "bf16_tuned_gemm" | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||
| def AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE_FILE(self): | ||||||||||||||||||||||||||||||||||
| return self.get_config_file( | ||||||||||||||||||||||||||||||||||
| "AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE", | ||||||||||||||||||||||||||||||||||
| AITER_CONFIG_GEMM_A8W8_BPRESHUFFLE_CKTILE, | ||||||||||||||||||||||||||||||||||
| "a8w8_bpreshuffle_cktile_tuned_gemm", | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| def update_config_files(self, file_path: str, merge_name: str): | ||||||||||||||||||||||||||||||||||
| path_list = file_path.split(os.pathsep) if file_path else [] | ||||||||||||||||||||||||||||||||||
| if len(path_list) <= 1: | ||||||||||||||||||||||||||||||||||
| return file_path | ||||||||||||||||||||||||||||||||||
| df_list = [] | ||||||||||||||||||||||||||||||||||
| ## merge config files | ||||||||||||||||||||||||||||||||||
| ##example: AITER_CONFIG_GEMM_A4W4="/path1:/path2" | ||||||||||||||||||||||||||||||||||
| import pandas as pd | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| df_list.append(pd.read_csv(path_list[0])) | ||||||||||||||||||||||||||||||||||
| for i, path in enumerate(path_list[1:]): | ||||||||||||||||||||||||||||||||||
| if os.path.exists(path): | ||||||||||||||||||||||||||||||||||
| df = pd.read_csv(path) | ||||||||||||||||||||||||||||||||||
| ## check columns | ||||||||||||||||||||||||||||||||||
| assert ( | ||||||||||||||||||||||||||||||||||
| df.columns.tolist() == df_list[0].columns.tolist() | ||||||||||||||||||||||||||||||||||
| ), f"Column mismatch between {path_list[0]} and {path}, {df_list[0].columns.tolist()}, {df.columns.tolist()}" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| df_list.append(df) | ||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||
| logger.info(f"path {i+1}: {path} (not exist)") | ||||||||||||||||||||||||||||||||||
| merge_df = pd.concat(df_list, ignore_index=True) if df_list else pd.DataFrame() | ||||||||||||||||||||||||||||||||||
| ## get keys from untuned file to drop_duplicates | ||||||||||||||||||||||||||||||||||
| untuned_name = ( | ||||||||||||||||||||||||||||||||||
| re.sub(r"(?:_)?tuned$", r"\1untuned", merge_name) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| re.sub(r"(?:_)?tuned$", r"\1untuned", merge_name) | |
| re.sub(r"(_)?tuned$", r"\1untuned", merge_name) |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sort_values("us") call assumes that all config files have a "us" column. If any of the merged dataframes don't have this column (e.g., if a user provides a custom config file), this will raise a KeyError. Consider adding error handling or checking for column existence before sorting:
if "us" in merge_df.columns:
merge_df = merge_df.sort_values("us").drop_duplicates(subset=keys, keep="first").reset_index(drop=True)
else:
merge_df = merge_df.drop_duplicates(subset=keys, keep="first").reset_index(drop=True)| merge_df = ( | |
| merge_df.sort_values("us") | |
| .drop_duplicates(subset=keys, keep="first") | |
| .reset_index(drop=True) | |
| ) | |
| if "us" in merge_df.columns: | |
| merge_df = ( | |
| merge_df.sort_values("us") | |
| .drop_duplicates(subset=keys, keep="first") | |
| .reset_index(drop=True) | |
| ) | |
| else: | |
| merge_df = ( | |
| merge_df.drop_duplicates(subset=keys, keep="first") | |
| .reset_index(drop=True) | |
| ) |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get_config_file method reads environment variables via os.getenv() on every property access, but the result is cached. This creates an inconsistency where environment variable changes won't be reflected after the first access. If an environment variable is set or modified after the first call, the cached result will be returned, ignoring the new value. This contradicts the dynamic nature of environment variables.
| @functools.lru_cache(maxsize=20) |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lru_cache on get_config_file doesn't account for changes to environment variables or config files after the first call. The cache key is based on (env_name, default_file, tuned_file_name), but if the environment variable value changes at runtime or if config files are modified, the cache will still return stale results. The PR description mentions "regenerate when the file changed" but there's no file change detection mechanism implemented. Consider either:
- Removing the cache if runtime changes are expected
- Adding file modification time checks to the cache key
- Implementing a cache invalidation mechanism
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The glob pattern f"*{tuned_file_name}*" could match unintended files. For example, if tuned_file_name is "a8w8_tuned_gemm", it would match files like "a8w8_tuned_gemm_backup.csv" or "old_a8w8_tuned_gemm.csv". Consider using a more specific pattern or exact filename matching to avoid accidentally including unrelated files in the merge.
| for p in model_config_dir.glob(f"*{tuned_file_name}*") | |
| for p in model_config_dir.glob(f"{tuned_file_name}.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first file in
path_list[0]is read without checking if it exists. If the first path doesn't exist, this will raise aFileNotFoundError. Consider adding an existence check before reading: