feat: Create and push LCB container#335
Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
There was a problem hiding this comment.
Code Review
This pull request introduces scripts (push_image.sh, pull_image.sh, and _image_env.sh) and updates documentation to facilitate building, pushing, and pulling a self-contained LiveCodeBench evaluator image, including support for cross-architecture builds. It also optimizes the dataset generation script (generate.py) to stream rows individually to prevent out-of-memory (OOM) errors. The review feedback suggests security enhancements in push_image.sh to avoid writing the sensitive HF_TOKEN to disk by leveraging Docker BuildKit's native environment variable secret resolution. Additionally, it recommends memory optimizations in generate.py by dropping heavy columns when test cases are not saved and deleting the row reference to release memory more effectively.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| secret_file="$(mktemp)" | ||
| trap 'rm -f "$secret_file"' EXIT | ||
| printf '%s' "$HF_TOKEN" >"$secret_file" | ||
|
|
||
| echo ">> Building ${LCB_LOCAL_TAG} ..." | ||
| docker build \ | ||
| -f "${SCRIPT_DIR}/lcb_serve.dockerfile" \ | ||
| --secret "id=HF_TOKEN,src=${secret_file}" \ | ||
| -t "$LCB_LOCAL_TAG" \ | ||
| "$SCRIPT_DIR" |
There was a problem hiding this comment.
Similarly to the cross-architecture build path, we can avoid writing the sensitive HF_TOKEN to a temporary file on disk for native builds by exporting HF_TOKEN and using --secret id=HF_TOKEN directly.
| secret_file="$(mktemp)" | |
| trap 'rm -f "$secret_file"' EXIT | |
| printf '%s' "$HF_TOKEN" >"$secret_file" | |
| echo ">> Building ${LCB_LOCAL_TAG} ..." | |
| docker build \ | |
| -f "${SCRIPT_DIR}/lcb_serve.dockerfile" \ | |
| --secret "id=HF_TOKEN,src=${secret_file}" \ | |
| -t "$LCB_LOCAL_TAG" \ | |
| "$SCRIPT_DIR" | |
| echo ">> Building ${LCB_LOCAL_TAG} ..." | |
| export HF_TOKEN | |
| docker build \ | |
| -f "${SCRIPT_DIR}/lcb_serve.dockerfile" \ | |
| --secret id=HF_TOKEN \ | |
| -t "$LCB_LOCAL_TAG" \ | |
| "$SCRIPT_DIR" |
| logger.info(f"Saved test cases to {test_cases_dir}") | ||
| # Release the decompressed test cases before the next iteration so the peak | ||
| # stays bounded by a single problem. | ||
| del public_cases, private_cases, test_case_data |
There was a problem hiding this comment.
To fully release all references to the heavy columns before the next iteration, we should also delete the row dictionary. Since row contains the raw, large compressed strings for public_test_cases and private_test_cases, keeping it bound until the next iteration means those raw strings remain in memory longer than necessary.
| del public_cases, private_cases, test_case_data | |
| del public_cases, private_cases, test_case_data, row |
4412569 to
0d2f16c
Compare
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
0d2f16c to
40b59b7
Compare
nvzhihanj
left a comment
There was a problem hiding this comment.
Review Council — Multi-AI Code Review
Reviewed by: Codex (--yolo) + Claude · Depth: standard
Found 4 issues — 1 posted inline, 3 low-severity advisories in the summary comment below.
Review Council — SummaryReviewed by: Codex ( Found 4 issues — 1 posted inline (medium), 3 low-severity advisories below.
On the existing |
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
What does this PR do?
Adds script to build and create LCB container which can be used by the accuracy implementations to get LCB score. The implementation uses the
src/inference_endpoint/evaluation/livecodebench/lcb_serve.dockerfileto build the container and push to the specified repository.Type of change
Related issues
Testing
Checklist