Skip to content

Commit b703458

Browse files
committed
update new codes
2 parents 353e7bd + bea41c2 commit b703458

File tree

4,960 files changed

+3051349
-4978
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,960 files changed

+3051349
-4978
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
rev: v0.14.4
1010
hooks:
1111
- id: ruff-check
12-
args: [--fix, --exit-non-zero-on-fix, --no-cache]
12+
args: [--fix, --exit-non-zero-on-fix, --no-cache, --exclude=samples]
1313

1414
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
1515
rev: v1.5.1

graph_net/analysis_util.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,19 @@ def detect_sample_status(log_text: str) -> str:
3535

3636
# Scan for status and mismatch markers
3737
for line in lines:
38-
if "[Result][status] eager:success" in line:
38+
if "[Datatype][eager]" in line:
3939
eager_success = True
4040
elif "[Datatype][compiled]" in line:
4141
compile_success = True
42+
elif "[Shape]" in line and "match:True" in line:
43+
shape_match = True
4244
elif "[DataType]" in line and "match:True" in line:
4345
type_match = True
4446
elif "all_close" in line:
47+
# When there are all_close checking result, the eager and compiled running should be success.
4548
shape_match = True
49+
eager_success = True
50+
compile_success = True
4651
else:
4752
# Do nothing
4853
pass
@@ -82,6 +87,7 @@ def parse_single_sample_log_to_data(log_text: str) -> dict:
8287
lines = log_text
8388

8489
data = {
90+
"model_path": None,
8591
"configuration": {},
8692
"correctness": {},
8793
"performance": {
@@ -95,6 +101,7 @@ def parse_single_sample_log_to_data(log_text: str) -> dict:
95101

96102
# Define regex patterns for each type of log line
97103
patterns = {
104+
"processing": re.compile(r"\[Processing\] (.+)"),
98105
"config": re.compile(r"\[Config\] (\S+): (.+)"),
99106
"performance": re.compile(r"\[Performance\]\[(\w+)\]: (.+)"),
100107
"datatype": re.compile(r"\[Datatype\]\[(\w+)\]: (.+)"),
@@ -103,6 +110,11 @@ def parse_single_sample_log_to_data(log_text: str) -> dict:
103110
}
104111

105112
for line in lines:
113+
processing_match = patterns["processing"].search(line)
114+
if processing_match:
115+
data["model_path"] = line.split()[-1]
116+
continue
117+
106118
config_match = patterns["config"].search(line)
107119
if config_match:
108120
key, value = config_match.groups()
@@ -167,32 +179,25 @@ def parse_logs_to_data(log_file: str) -> list:
167179
print(f"No content in {log_file}")
168180
return []
169181

170-
model_path = None
171-
samples, current_lines, processing_lines = [], [], []
172-
173-
def process_a_sample(model_path):
182+
def process_a_sample(current_lines, samples):
174183
data = parse_single_sample_log_to_data(current_lines)
175-
if data.get("model_path", None) is None and model_path:
176-
data["model_path"] = model_path
177184
samples.append(data)
178185

186+
samples, current_lines = [], []
179187
for line in lines:
180188
if "[Processing]" in line:
181-
model_path = line.split()[-1]
182-
else:
183189
if current_lines:
184-
current_lines.append(line)
185-
continue
186-
187-
if current_lines:
188-
process_a_sample(model_path)
189-
190-
processing_lines.append(line)
191-
current_lines = [line]
190+
# parse the logs of the previous sample
191+
process_a_sample(current_lines, samples)
192+
# clear current_lines of current sample and append the processing line
193+
current_lines = [line]
194+
else:
195+
# append line of current sample
196+
current_lines.append(line) if current_lines else None
192197

193-
# Process final sample
194198
if current_lines:
195-
process_a_sample(model_path)
199+
# parse the final sample
200+
process_a_sample(current_lines, samples)
196201

197202
print(f"Parsed {len(samples)} samples from {log_file}")
198203
return samples
@@ -472,11 +477,11 @@ def get_incorrect_models(
472477
sample.get("model_path")
473478
) if current_correctness != "correct" else None
474479
else:
475-
iscorrect, err = check_sample_correctness(sample, tolerance)
476-
failed_models.add(sample.get("model_path")) if not iscorrect else None
480+
is_correct, fail_type = check_sample_correctness(sample, tolerance)
481+
failed_models.add(sample.get("model_path")) if not is_correct else None
477482
else:
478483
for idx, sample in enumerate(samples):
479-
iscorrect, err = check_sample_correctness(sample, tolerance)
480-
failed_models.add(sample.get("model_path")) if not iscorrect else None
484+
is_correct, fail_type = check_sample_correctness(sample, tolerance)
485+
failed_models.add(sample.get("model_path")) if not is_correct else None
481486

482487
return failed_models
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
samples/transformers-auto-model/dbmdz_electra-large-discriminator-finetuned-conll03-english

0 commit comments

Comments
 (0)