RL icon indicating copy to clipboard operation
RL copied to clipboard

feat: Add safe_serialization option to the dcp checkpoint conversion script

Open giordanobsf opened this issue 1 year ago • 7 comments

What does this PR do ?

Currently, the script converts dcp checkpoints to .bin for the HF checkpoint. This PR allows users to also convert checkpoints to .safetensors.

Issues

Closes #491

Usage

  • You can potentially add a usage example below
uv run python examples/converters/convert_dcp_to_hf.py \
    --config results/grpo/step_170/config.yaml \
    --dcp-ckpt-path results/grpo/step_170/policy/weights/ \
    --hf-ckpt-path results/grpo/hf \
    --safe-serialization true

Before your PR is "Ready for review"

Pre checks:

  • [x] Make sure you read and followed Contributor guidelines
  • [ ] Did you write any new necessary tests?
  • [x] Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • [x] Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

giordanobsf avatar Jun 28 '25 16:06 giordanobsf

@ffrujeri @joyang-nv is this still relevant with Automodel ?

euronymous-aithal avatar Sep 17 '25 00:09 euronymous-aithal

@ffrujeri @joyang-nv is this still relevant with Automodel ?

With the Automodel integrations, the users will be able to save directly a checkpoint in .safetensors format. But if a previous checkpoint was created on the .dcp format and the user wants to convert to safetensors and then start training from there, I think this conversion script could be useful? Did I understand this PR correctly?

ffrujeri avatar Sep 17 '25 00:09 ffrujeri

@ffrujeri i think so. @joyang-nv what is your feedback. how do we plan to transition folks from earlier DTensor path to Automodel path ?

euronymous-aithal avatar Sep 17 '25 04:09 euronymous-aithal

gentle bump here @joyang-nv

ashors1 avatar Oct 22 '25 18:10 ashors1

Deeply sorry for so late reply.

joyang-nv avatar Oct 30 '25 13:10 joyang-nv

Here is my feedbacks. @giordanobsf , deeply sorry from me on so late reply on this PR. Can you rebase your PR and could help to test:

  1. Convert checkpoint from v1 policy worker?
  2. Convert checkpoint from v2 policy worker? I knew with v2 HF converter might have issue. It will be great if your PR could work in both paths.

joyang-nv avatar Oct 30 '25 13:10 joyang-nv

Reviving this thread. @ffrujeri / @terrykong - What's the recommendation in March 2026? I need this capability as well.

dhineshkumar-r avatar Mar 18 '26 19:03 dhineshkumar-r