fix: only publish trace from tp 0 (#16411)
This commit is contained in:
@@ -132,12 +132,25 @@ def save_results_as_pydantic_models(
|
|||||||
profile_link_decode = None
|
profile_link_decode = None
|
||||||
|
|
||||||
if res.profile_link:
|
if res.profile_link:
|
||||||
|
# Collect all trace files, preferring TP-0 to match upload behavior
|
||||||
|
# (only TP-0 traces are published to avoid duplicates)
|
||||||
|
extend_files = []
|
||||||
|
decode_files = []
|
||||||
for file in os.listdir(res.profile_link):
|
for file in os.listdir(res.profile_link):
|
||||||
if file.endswith(".trace.json.gz") or file.endswith(".trace.json"):
|
if file.endswith(".trace.json.gz") or file.endswith(".trace.json"):
|
||||||
if "extend" in file.lower() or "prefill" in file.lower():
|
if "extend" in file.lower() or "prefill" in file.lower():
|
||||||
profile_link_extend = os.path.join(res.profile_link, file)
|
extend_files.append(file)
|
||||||
elif "decode" in file.lower():
|
elif "decode" in file.lower():
|
||||||
profile_link_decode = os.path.join(res.profile_link, file)
|
decode_files.append(file)
|
||||||
|
|
||||||
|
# Sort to prefer TP-0 files (TP-0 < TP-1 < TP-2... alphabetically)
|
||||||
|
extend_files.sort()
|
||||||
|
decode_files.sort()
|
||||||
|
|
||||||
|
if extend_files:
|
||||||
|
profile_link_extend = os.path.join(res.profile_link, extend_files[0])
|
||||||
|
if decode_files:
|
||||||
|
profile_link_decode = os.path.join(res.profile_link, decode_files[0])
|
||||||
|
|
||||||
benchmark_result = BenchmarkResult(
|
benchmark_result = BenchmarkResult(
|
||||||
model_path=model_path,
|
model_path=model_path,
|
||||||
|
|||||||
@@ -266,7 +266,10 @@ def update_branch_ref(repo_owner, repo_name, branch, commit_sha, token, max_retr
|
|||||||
|
|
||||||
|
|
||||||
def copy_trace_files(source_dir, target_base_path):
|
def copy_trace_files(source_dir, target_base_path):
|
||||||
"""Copy trace files and return list of files to upload"""
|
"""Copy trace files and return list of files to upload.
|
||||||
|
|
||||||
|
Only uploads traces from TP rank 0 to avoid duplicated data across tensor parallel ranks.
|
||||||
|
"""
|
||||||
files_to_upload = []
|
files_to_upload = []
|
||||||
|
|
||||||
if not os.path.exists(source_dir):
|
if not os.path.exists(source_dir):
|
||||||
@@ -277,6 +280,11 @@ def copy_trace_files(source_dir, target_base_path):
|
|||||||
for root, dirs, files in os.walk(source_dir):
|
for root, dirs, files in os.walk(source_dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith(".json.gz"):
|
if file.endswith(".json.gz"):
|
||||||
|
|
||||||
|
# Only upload TP rank 0 traces to avoid duplicates across tensor parallel ranks
|
||||||
|
if "TP-" in file and "TP-0" not in file:
|
||||||
|
continue
|
||||||
|
|
||||||
source_file = os.path.join(root, file)
|
source_file = os.path.join(root, file)
|
||||||
# Calculate relative path from source_dir
|
# Calculate relative path from source_dir
|
||||||
rel_path = os.path.relpath(source_file, source_dir)
|
rel_path = os.path.relpath(source_file, source_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user