Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkpoint conversion to HF fails #284

Open
flxst opened this issue Dec 16, 2024 · 1 comment · May be fixed by #285
Open

Checkpoint conversion to HF fails #284

flxst opened this issue Dec 16, 2024 · 1 comment · May be fixed by #285
Labels
bug Something isn't working

Comments

@flxst
Copy link
Member

flxst commented Dec 16, 2024

System Info

  • modalities version: main branch, 7cd60e2
  • system: linux
  • python version: 3.10.13

🐛 Describe the bug

The conversion of the checkpoint from the getting started example to HF fails.

Error Message:

AttributeError: 'HFModelAdapterConfig' object has no attribute 'config'

Steps to reproduce the error:

  1. Run the getting started example:

    cd tutorials/getting_started
    bash run_getting_started_example.sh 0 1
    
  2. Create a config file example_config_convert.yaml for checkpoint conversion:

    • copy example config
    cp example_config.yaml example_config_convert.yaml
    
    • change settings.cuda_env in example_config_convert.yaml to:
    cuda_env:
      local_rank: 0
      global_rank: 0
      world_size: 1
    
    • append the following top level component to example_config_convert.yaml:
    checkpointed_model:
      component_key: model
      variant_key: checkpointed
      config:
        checkpoint_loading:                                       
          component_key: checkpoint_loading
          variant_key: torch
          config:
            device: 0
            precision: BF16
        model:
          instance_key: model
          pass_type: BY_REFERENCE
        checkpoint_path: checkpoints/<path_to_checkpoint>.bin   # needs to be adjusted to checkpoint created in step 1.
    
  3. Run checkpoint conversion:

    CUDA_VISIBLE_DEVICES=0 modalities convert_pytorch_to_hf_checkpoint --config_file_path example_config_convert.yaml --output_hf_checkpoint_dir checkpoint.hf --prediction_key logits
    
@flxst flxst added the bug Something isn't working label Dec 16, 2024
@flxst flxst linked a pull request Dec 16, 2024 that will close this issue
6 tasks
@flxst
Copy link
Member Author

flxst commented Dec 16, 2024

Related: #286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant