Skip to content

Fix model id and upload to hub#162

Merged
Yunnglin merged 7 commits intomainfrom
fix_model_id_0416
Apr 17, 2026
Merged

Fix model id and upload to hub#162
Yunnglin merged 7 commits intomainfrom
fix_model_id_0416

Conversation

@Yunnglin
Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.

Experiment results

Paste your experiment result here(if needed).

Copilot AI review requested due to automatic review settings April 16, 2026 12:27
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the Megatron server startup script by pre-creating log files and tailing them for real-time monitoring. It also updates the set_template method to include a default model_id and adds support for Qwen3.6 in the template mapping. Feedback was provided to ensure the tail command terminates if the server process crashes and to allow model_id overrides by using setdefault.

I am having trouble creating individual review comments. Click here to see my feedback.

cookbook/client/server/megatron/run.sh (394)

medium

The tail -f command blocks the script indefinitely. If the server process crashes or exits, tail will continue to run, which can be misleading to the user. Using the --pid flag ensures that tail terminates automatically when the monitored server process ends.

tail --pid=$SERVER_PID -f "$LOG_FILE"

src/twinkle/model/megatron/megatron.py (1330)

medium

Hard-coding model_id in kwargs prevents users from explicitly providing a custom model or tokenizer ID when calling set_template. Using setdefault ensures that self.tokenizer_id is used as the default while still allowing for manual overrides if necessary.

        kwargs.setdefault('model_id', self.tokenizer_id)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix model/template identification issues when running Qwen3.6 models in the Twinkle server stack (template selection and template construction), and improves the Megatron cookbook run script’s log handling.

Changes:

  • Add Qwen3.6 → Qwen3_5Template mapping for server-side template selection.
  • Ensure Megatron set_template() passes model_id (via tokenizer_id) when constructing Template instances.
  • Pre-create the server log file and follow logs after starting the server in the Megatron cookbook run.sh.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/twinkle/server/utils/template_utils.py Extends template auto-selection to include Qwen3.6 model names.
src/twinkle/model/megatron/megatron.py Injects model_id for template construction to prevent Template init failures / wrong model id usage.
cookbook/client/server/megatron/run.sh Avoids tail -f failing on missing log file; adds blocking log-follow behavior.

Comment thread cookbook/client/server/megatron/run.sh
@Yunnglin Yunnglin changed the title Fix model id 0416 Fix model id and upload to hub Apr 17, 2026
@Yunnglin
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements an asynchronous upload mechanism for the ModelScope Hub by introducing a task-based system with client-side polling. Key changes include updating the server to return a request_id and run uploads in background threads, adding a status polling endpoint, and updating the client generator and library to handle the new polling logic. Additionally, the PR includes new example scripts, updates to the Dockerfile, and manual additions to the LazyDataset class. Feedback focuses on maintaining the integrity of auto-generated files, improving error handling when task IDs are missing or results are malformed, and ensuring robust dictionary access in validators.

Comment thread src/twinkle_client/dataset/lazy_dataset.py
Comment thread client_tools/client_generator.py
Comment thread src/twinkle/server/model/twinkle_handlers.py
Comment thread src/twinkle_client/types/model.py
@Yunnglin Yunnglin merged commit 9e959a2 into main Apr 17, 2026
2 of 4 checks passed
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.

3 participants