Skip to content

fix(inference): align vllm_decode with LoRA checkpoint restoration an…#3978

Draft
chiajunglien wants to merge 2 commits into
AI-Hypercomputer:jackyf/gemma3-lora-e2efrom
CIeNET-International:emma/lora-e2e
Draft

fix(inference): align vllm_decode with LoRA checkpoint restoration an…#3978
chiajunglien wants to merge 2 commits into
AI-Hypercomputer:jackyf/gemma3-lora-e2efrom
CIeNET-International:emma/lora-e2e

Conversation

@chiajunglien
Copy link
Copy Markdown

…d add test_gemma3_lora script

Description

Start with a short description of what the PR does and how this is a change from
the past.

The rest of the description includes relevant details and context, examples:

  • why is this change being made,
  • the problem being solved and any relevant context,
  • why this is a good solution,
  • some information about the specific implementation,
  • shortcomings of the solution and possible future improvements.

If the change fixes a bug or a Github issue, please include a link, e.g.,:
FIXES: b/123456
FIXES: #123456

You can also provide a comma-separated list. If you don't want to close a bug but
simply to reference it, use BUGS, e.g.:
BUGS: b/123456

Notice 1: Once all tests pass, the "pull ready" label will automatically be assigned.
This label is used for administrative purposes. Please do not add it manually.

Notice 2: For external contributions, our settings currently require an approval from a MaxText maintainer to trigger CI tests.

Tests

Please describe how you tested this change, and include any instructions and/or
commands to reproduce.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

if self.maxtext_config.lora.enable_lora:
model = lora_utils.apply_lora_to_model(model, self.mesh, self.maxtext_config)
if self.maxtext_config.lora.lora_restore_path:
mock_trainer = type("MockTrainer", (), {"model": model, "train_steps": 0})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we mock model here? we should restore with above model like we did in train_sft

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored restore_lora_from_path in lora_utils to support polymorphism.
It now accepts either a full Trainer instance or a standalone nnx.Module directly.

Comment on lines +77 to +78
dtype=bfloat16 \
weight_dtype=bfloat16
Copy link
Copy Markdown
Collaborator

@RexBearIU RexBearIU May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need those setting? please also verify.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

load_parameters_path=${BASE_OUTPUT_DIRECTORY}/sft/${run_id}/checkpoints/5/model_params \
lora.lora_restore_path=${BASE_OUTPUT_DIRECTORY}/lora/${run_id}/checkpoints/5/model_params \
base_output_directory=${BASE_OUTPUT_DIRECTORY}/to_huggingface/unscanned/${run_id} \
use_multimodal=false scan_layers=true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need to set use_multimodal? And please run pre-commit to the code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@chiajunglien chiajunglien force-pushed the emma/lora-e2e branch 6 times, most recently from 2c23253 to 97b76b9 Compare May 28, 2026 08:28
@chiajunglien chiajunglien changed the base branch from main to jackyf/gemma3-lora-e2e May 28, 2026 08:28
@RexBearIU RexBearIU force-pushed the jackyf/gemma3-lora-e2e branch from 10fde95 to 2a0ea9a Compare May 28, 2026 09:04
@RexBearIU RexBearIU force-pushed the jackyf/gemma3-lora-e2e branch 2 times, most recently from 7938d49 to bc62d64 Compare May 29, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants