Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/AddLabel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/github-script@v7
- name: Print Triggering Workflow Name
run: echo "The workflow that triggered this was ${{ github.event.workflow_run.name }}"

- name: Add Pull Request Label
uses: actions/github-script@v7
with:
script: |
const owner = "google"
Expand All @@ -40,8 +44,9 @@ jobs:
if (context.payload.pull_request !== undefined) {
pull_number = context.payload.pull_request.number
} else if (context.payload.workflow_run !== undefined) {
workflow_name = context.payload.workflow_run.name
if (context.payload.workflow_run.pull_requests.length === 0) {
console.log("This workflow is NOT running within a PR's context")
console.log("This workflow ${workflow_name} is NOT running within a PR's context")
process.exit()
}
console.log(context.payload.workflow_run.pull_requests)
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/build_and_test_maxtext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,36 @@ jobs:
needs: analyze_code_changes
# Run if either tests or notebooks need to run
if: |
needs.analyze_code_changes.outputs.run_tests == 'true' ||
needs.analyze_code_changes.outputs.run_tests == 'true' ||
needs.analyze_code_changes.outputs.run_notebooks == 'true'
uses: ./.github/workflows/build_package.yml
with:
device_type: tpu
device_name: v4-8
cloud_runner: linux-x86-n2-16-buildkit

echo-variable-job:
needs: build_and_upload_maxtext_package
runs-on: ubuntu-latest
# Define job-level environment variables
env:
MY_HF_TOKEN: ${{ secrets.HF_TOKEN }}
MY_NAME: "GitHub User"

steps:
- name: Print the Environment Variable
# Access variable using runner shell syntax
run: |
echo "Hello, MY_NAME=$MY_NAME, MY_HF_TOKEN=$MY_HF_TOKEN !"

if [ -z "${{ secrets.HF_TOKEN }}" ]; then
echo "MY_HF_TOKEN is NOT set"
else
# Prints the character count only
echo "MY_NAME is set (Length= ${#MY_NAME})"
echo "MY_HF_TOKEN is set (Length= ${#MY_HF_TOKEN})"
fi

maxtext_jupyter_notebooks:
needs: build_and_upload_maxtext_package
if: needs.analyze_code_changes.outputs.run_notebooks == 'true'
Expand Down Expand Up @@ -301,4 +323,4 @@ jobs:
if: ${{ contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b # v1.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/run_jupyter_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ jobs:
# 2. Install MaxText package and all the post training dependencies
uv pip install ${maxtext_wheel}[tpu-post-train] --resolution=lowest
install_tpu_post_train_extra_deps

python3 -m pip freeze
- name: Run Post-Training Notebooks
shell: bash
env:
PYTHONPATH: "${{ github.workspace }}/src"
HF_TOKEN: ${{ secrets.HF_TOKEN }}
MY_HF_TOKEN: ${{ secrets.HF_TOKEN }}
MAXTEXT_INSTALLED: ${{ inputs.maxtext_installed }}
# TODO: Fix evaluation in sft_qwen3_demo.ipynb and remove this env variable
RUN_EVALUATION: "False"
Expand All @@ -99,6 +100,9 @@ jobs:
export MAXTEXT_REPO_ROOT=$(pwd)
export MAXTEXT_PKG_DIR=$(pwd)/src/maxtext
export MAXTEXT_NOTEBOOKS_ROOT="$MAXTEXT_REPO_ROOT/src/maxtext/examples"
export HF_TOKEN=${MY_HF_TOKEN}
echo "MY_HF_TOKEN $MY_HF_TOKEN"
echo "HF_TOKEN $HF_TOKEN"

# Register maxtext_venv as a selectable kernel in Jupyter
$PYTHON_EXE -m ipykernel install --user --name maxtext_venv
Expand All @@ -116,7 +120,7 @@ jobs:
echo "Running $filename ..."
echo "------------------------------------------------------"

$PAPERMILL_EXE "$notebook" "$output_name" -k maxtext_venv
$PAPERMILL_EXE "$notebook" "$output_name" -k maxtext_venv --log-output --log-level INFO
done
- name: Upload Outputs
if: always()
Expand Down
4 changes: 3 additions & 1 deletion src/maxtext/examples/sft_llama3_demo_tpu.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"\n",
" # Install uv, a fast Python package installer\n",
" !pip install uv\n",
" \n",
"\n",
" # Install MaxText and post-training dependencies\n",
" !uv pip install -e .[tpu-post-train] --resolution=lowest\n",
" !install_tpu_post_train_extra_deps"
Expand Down Expand Up @@ -190,8 +190,10 @@
"try:\n",
" from google.colab import userdata\n",
" HF_TOKEN = userdata.get(\"HF_TOKEN\")\n",
" print(f\"get HF_TOKEN={HF_TOKEN} from google.colab\")\n",
"except ImportError:\n",
" HF_TOKEN = os.environ.get(\"HF_TOKEN\", \"\")\n",
" print(f\"get HF_TOKEN={HF_TOKEN} from env\")\n",
"\n",
"# If not found in the environment, prompt the user for input securely\n",
"# getpass function ensures the token is hidden while you type\n",
Expand Down
Loading