Skip to content

Commit 6311c49

Browse files
SurbhiJainUSCGoogle-ML-Automation
authored andcommitted
Add linter script internally and fix lint issues
PiperOrigin-RevId: 953429485
1 parent 998e68f commit 6311c49

43 files changed

Lines changed: 147 additions & 223 deletions

Some content is hidden

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

src/maxtext/checkpoint_conversion/utils/param_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
**Value: corresponding Hugging Face parameters, with following forms:**
3030
First, the base element mapped to can be either:
3131
- `atomic_hf_key`: A single string representing one Hugging Face parameter.
32-
- `composite_hf_key`: A tuple of strings representing multiple Hugging Face parameters that combine
32+
- `composite_hf_key`: A tuple of strings representing multiple Hugging Face parameters that combine
3333
into a single MaxText parameter (e.g., Qwen's qkv and z).
3434
3535
These base elements (strings or tuples) are then structured as:

src/maxtext/examples/sft_qwen3_demo.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"\n",
2222
"This notebook performs SFT training and evaluation workflow on [OpenAI's GSM8K dataset](https://huggingface.co/datasets/openai/gsm8k).\n",
2323
"The primary goal is to demonstrate the end-to-end process of:\n",
24-
"1. Pre-SFT Evaluation: Calcuating baseline accuracy for the model before training.\n",
24+
"1. Pre-SFT Evaluation: Calculating baseline accuracy for the model before training.\n",
2525
"2. SFT Training: Fine-tune the model using MaxText & Tunix SFT trainer.\n",
2626
"3. Post-SFT Evaluation: Re-running the evaluation loop after training to measure the performance gain achieved by SFT.\n",
2727
"\n",
@@ -363,7 +363,7 @@
363363
" f\"Processing {NUM_TEST_SAMPLES} examples with a batch size of {BATCH_SIZE}. This will result in {TOTAL_BATCHES} total batches for the test run.\"\n",
364364
" )\n",
365365
"else:\n",
366-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
366+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
367367
]
368368
},
369369
{
@@ -419,7 +419,7 @@
419419
" ),\n",
420420
" )\n",
421421
"else:\n",
422-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
422+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
423423
]
424424
},
425425
{
@@ -443,7 +443,7 @@
443443
" print(\"Running Pre-SFT Evaluation...\")\n",
444444
" score = evaluate_model(test_dataset, vllm_rollout, debug=False)\n",
445445
"else:\n",
446-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
446+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
447447
]
448448
},
449449
{
@@ -464,7 +464,7 @@
464464
" f\"Percentage of test samples where the model's output adheres to the expected structure: {score['correct_format']}%\"\n",
465465
" )\n",
466466
"else:\n",
467-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
467+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
468468
]
469469
},
470470
{
@@ -515,7 +515,7 @@
515515
" vllm_rollout.update_params(state)\n",
516516
" score = evaluate_model(test_dataset, vllm_rollout, debug=False)\n",
517517
"else:\n",
518-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
518+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
519519
]
520520
},
521521
{
@@ -538,7 +538,7 @@
538538
" f\"Percentage of test samples where the model's output adheres to the expected structure: {score['correct_format']}%\"\n",
539539
" )\n",
540540
"else:\n",
541-
" print(\"Evaluation on test dataset is skipped. Plese set `RUN_EVALUATION=True` to run evaluation.\")"
541+
" print(\"Evaluation on test dataset is skipped. Please set `RUN_EVALUATION=True` to run evaluation.\")"
542542
]
543543
}
544544
],

src/maxtext/experimental/agent/ckpt_conversion_agent/baselines/context/hf_shape.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
2-
Copyright 2025 Google LLC
2+
Copyright 2025 Google LLC
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
1515
"""
1616

1717
"""Example code for agent, only gemma2 mappings"""

src/maxtext/experimental/agent/ckpt_conversion_agent/baselines/context/param_mapping.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
2-
Copyright 2025 Google LLC
2+
Copyright 2025 Google LLC
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
1515
"""
1616

1717
"""Example code for agent, only gemma2 mappings"""

src/maxtext/experimental/agent/ckpt_conversion_agent/dsl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
"""
16-
A DSL agent class, to propose potential new DSL rules/ops based on the previous analysis call.
16+
A DSL agent class, to propose potential new DSL rules/ops based on the previous analysis call.
1717
"""
1818
import argparse
1919
import os

src/maxtext/experimental/agent/ckpt_conversion_agent/transformation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
"""
16-
A transformation agent to generate the
16+
A transformation agent to generate the
1717
layerwise and bidirectional transformation hook functions between HF & Maxtext
1818
"""
1919
import argparse

src/maxtext/inference/decode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
_config_lib, engine_api, _token_utils, _tokenizer_api, _token_params_ns = jetstream()
3434
# Placeholder: internal
3535

36+
3637
# Number of text sequences to process in a single batch.
3738
_NUM_STREAMS = 1
3839

src/maxtext/inference/mlperf/evaluate-accuracy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
""" Evaluation script based on MLPerf requirements"""
14+
"""Evaluation script based on MLPerf requirements"""
1515

1616
import argparse
1717
import json

src/maxtext/inference/mlperf/matmul/timing_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
""" Timing utility functions """
14+
"""Timing utility functions"""
1515

1616
import datetime
1717
import tempfile

src/maxtext/inference/mlperf/offline_inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
""" Offline inference for mlperf """
14+
"""Offline inference for mlperf"""
1515

1616
from collections import defaultdict
1717
from typing import Any, Callable

0 commit comments

Comments
 (0)