UniVLA icon indicating copy to clipboard operation
UniVLA copied to clipboard

Loss instability when resuming pretraining from converted HF weights

Open minghaoguo20 opened this issue 1 year ago • 11 comments

Thanks for your brilliant work.

I am currently trying to run Stage 2 - Pretraining of the Generalist Policy on the Bridge V2 dataset. Since the weights of univla-7b-bridge-pt in UniVLA’s Prismatic format were not released (only the Hugging Face format was made available), I implemented a script convert_hf_to_univla_weights.py (referring to vla-scripts/extern/convert_openvla_weights_to_hf.py) to convert the released HF weights back into UniVLA Prismatic format.

Using the converted weights, I resumed training with settings --resume_step 0 --resume_epoch 0.

Theoretically, since the weights are already pretrained, I would expect the training loss to start from a well-converged state.

However, I observed that the loss is quite unstable. For first 400 steps, most of the loss values lie in the 0.5–2.0 range, some steps even exceed 3.

I would like to confirm: 1. Is this kind of loss behavior normal in your experience? 2. When you resumed from the official UniVLA Prismatic weights with resume_step / resume_epoch specified, what range of loss values did you typically observe?

Any clarification would be greatly appreciated.

Image Image

minghaoguo20 avatar Aug 20 '25 17:08 minghaoguo20

Thanks for reporting this. The losses you're seeing are indeed much higher than expected. To help us investigate, could you please confirm if you're using the OXE-version of the BridgeV2 data? One other possibility is that there might be an issue in the weights conversion script. Let's rule that out—could you double-check that process on your end?

I'd like to show the loss curve of our pre-training on BridgeV2 data here for your reference:

Image

retsuh-bqw avatar Aug 21 '25 04:08 retsuh-bqw

Thanks for reporting this. The losses you're seeing are indeed much higher than expected. To help us investigate, could you please confirm if you're using the OXE-version of the BridgeV2 data? One other possibility is that there might be an issue in the weights conversion script. Let's rule that out—could you double-check that process on your end?

I'd like to show the loss curve of our pre-training on BridgeV2 data here for your reference:

Image

Thanks for prompt replying. I downloaded the dataset from https://rail-berkeley.github.io/bridgedata/. Is this the correct website for downloading the dataset?

And I used the following config:

# prismatic/conf/vla.py
@dataclass
class Exp_DinoSigLIP_224px_Bridge(Exp_SigLIP_224px_Bridge):
    vla_id: str = "prism-dinosiglip-224px+mx-bridge"
    base_vlm: Union[str, Path] = "prism-dinosiglip-224px+7b"

    data_mix: str = "bridge_dataset" # Modified this line
# prismatic/vla/datasets/rlds/oxe/transforms.py
OXE_STANDARDIZATION_TRANSFORMS = {
    ....
    "bridge_dataset": bridge_orig_dataset_transform,
    ....
}
# prismatic/vla/datasets/rlds/oxe/configs.py
OXE_DATASET_CONFIGS = {
    ...
    "bridge_dataset": {  # Original version of Bridge V2 from project website
        "image_obs_keys": {"primary": "image_0", "secondary": "image_1", "wrist": None},
        "depth_obs_keys": {"primary": None, "secondary": None, "wrist": None},
        "state_obs_keys": ["EEF_state", None, "gripper_state"],
        "state_encoding": StateEncoding.POS_EULER,
        "action_encoding": ActionEncoding.EEF_POS,
    },
    ...

For the convert script, I'm verifying it by converting it back to hf model again and compare the model your team provided and the model after two conversion. I will try to update this result ASAP.

minghaoguo20 avatar Aug 21 '25 06:08 minghaoguo20

Hi, I just verified the conversion process and found that that model converted twice (from hf model to univla model to hf model) are the same with the model your team released. So, I suppose the model conversion code are correct.

INFO:__main__:Successfully loaded 982 parameters from safetensors files
INFO:__main__:Starting model parameter comparison...
INFO:__main__:Model 1 has 982 parameters
INFO:__main__:Model 2 has 982 parameters
INFO:__main__:Common parameters: 982
INFO:__main__:Comparing 982 common parameters...
INFO:__main__:Progress: 100/982 parameters compared
INFO:__main__:Progress: 200/982 parameters compared
INFO:__main__:Progress: 300/982 parameters compared
INFO:__main__:Progress: 400/982 parameters compared
INFO:__main__:Progress: 500/982 parameters compared
INFO:__main__:Progress: 600/982 parameters compared
INFO:__main__:Progress: 700/982 parameters compared
INFO:__main__:Progress: 800/982 parameters compared
INFO:__main__:Progress: 900/982 parameters compared
INFO:__main__:Parameter comparison completed!

============================================================
MODEL COMPARISON SUMMARY
============================================================
Total parameters: 982
Identical parameters: 982
Different parameters: 0
Tolerance used: 1e-05

✅ MODELS ARE IDENTICAL!

============================================================
  1. If the dataset I'm using is correct?
  2. Could you plz help check if you can reproduce the result you showed above?

Thanks in advance.

minghaoguo20 avatar Aug 21 '25 08:08 minghaoguo20

Hi, I just tried the bridge dataset downloaded from https://github.com/moojink/rlds_dataset_mod. The loss is also far from normal.

Could you please help check if there is anything wrong? Thanks.

eval mode:

Image

train mode:

Image

minghaoguo20 avatar Aug 22 '25 16:08 minghaoguo20

Thanks for reporting this. The losses you're seeing are indeed much higher than expected. To help us investigate, could you please confirm if you're using the OXE-version of the BridgeV2 data? One other possibility is that there might be an issue in the weights conversion script. Let's rule that out—could you double-check that process on your end?

I'd like to show the loss curve of our pre-training on BridgeV2 data here for your reference:

Image

By the way, do you mind share the checkpoint with univla format that can reproduce the loss showed in this figure? This matters a lot for me. Thanks a looooo! 🙏

minghaoguo20 avatar Aug 23 '25 08:08 minghaoguo20

The loss curve in eval mode seems normal, where the loss fluctuates within 0.6-0.8. For the training mode, it seems that you are using a very small batch size, where we used a total batch size of 256 for training.

retsuh-bqw avatar Aug 23 '25 08:08 retsuh-bqw

The loss curve in eval mode seems normal, where the loss fluctuates within 0.6-0.8. For the training mode, it seems that you are using a very small batch size, where we used a total batch size of 256 for training.

Makes sense. I'm using only one node with 8 GPUs, so the batch size I'm using is far less than 256.

Do you have any advice on training on one node? (I noticed that the code limited the grad_accumulation_steps to 1) And do you mind share the training loss for post trianing on libero, calvin, simpler, etc. for further reference?

Thanks in advance!

minghaoguo20 avatar Aug 23 '25 09:08 minghaoguo20

I will close the issue for now. Still looking for further suggestions. Thanks!

minghaoguo20 avatar Aug 23 '25 11:08 minghaoguo20

Hi, could you please share the training W&B logs, for example, the Action Token Accuracy, loss, and lr? We want to review them as a reference. Thanks in advance!

minghaoguo20 avatar Sep 23 '25 10:09 minghaoguo20

Hello, could you please share the validation loss curves from your training? I noticed that the VLM struggles to predict latent actions accurately—in my training, the action prediction accuracy on the validation set is quite low. @retsuh-bqw @minghaoguo20

Nemo-1024 avatar Nov 18 '25 05:11 Nemo-1024

We didn't log any validation losses during training. The latent action accuracy may vary from datasets (e.g. over 90% on LIBERO and around 70% for Bridgev2) . Can you be more specific on your case?

retsuh-bqw avatar Nov 19 '25 02:11 retsuh-bqw