Skip to content

How can I start finetuing/training from checkpoint? #66

Description

@QXmX29

First I finetuned basic model omniASR_LLM_1B_v2 like this:

cd /path/to/omnilingual-asr
CUDA_VISIBLE_DEVICES=2,3,4 torchrun --nproc_per_node=3 \
-m workflows.recipes.wav2vec2.asr $OUTPUT_DIR \
--config-file $CONFIG_HOME/my-llm-finetune.yaml

After that I get checkpoints located in path/to/checkpoints, like step_800/model/pp_00/tp_00 contains sdp_00.pt, sdp_01.pt and sdp_02.pt.

Now I want to start a new round of finetuning based on a certain checkpoint, rather than the original model like omniASR_LLM_1B_v2. So I modifed the my-llm-finetune.yaml as below. I made 2 attempts, one adding model.path while the other adding pretrained_encoder.name/path/family/dtype.

model:
  name: "omniASR_LLM_1B_v2"
  path: /path/to/checkpoints/step_800/consolidated.pt
  family: wav2vec2_llama
  dtype: bfloat16  # float32 # bfloat16

pretrained_encoder:
  # name: "LLM_1B_v2_800step-260113_1807"
  # path: /path/to/checkpoints/step_800/consolidated.pt
  # family: wav2vec2_llama
  # dtype: bfloat16
  mmap: true

Complete config.yaml: config-onlymodifiedmodel.yaml

However, I got error information:

WARNING  fairseq2 - Both `model.name` and `model.path` are specified. `model.path` takes         
                             precedence.                                                                             
ERROR    fairseq2 - Recipe failed due to an unexpected error. See logged stack trace for details 
         and file a bug report to the corresponding author.                                      
         Traceback (most recent call last):                                                      
           File                                                                                  
         "/root/anaconda3/envs/omnilingual/lib/python3.10/site-packages/fairseq2/recipe/internal/
         model.py", line 212, in _load_custom_model                                              
             config = family.config_kls()                                                        
         TypeError: Wav2Vec2LlamaConfig.__init__() missing 2 required keyword-only arguments:    
         'wav2vec2_asr_config' and 'llama_config'                                                
                                                                                                 
         The above exception was the direct cause of the following exception:                    
                                                                                                                     
         Traceback (most recent call last):                                                      
           ...                                         
           File                                                                                  
         "/root/anaconda3/envs/omnilingual/lib/python3.10/site-packages/fairseq2/recipe/compositi
         on/model.py", line 32, in get_model                                                     
             return model_provider.get()                                                         
           File                                                                                  
         "/root/anaconda3/envs/omnilingual/lib/python3.10/site-packages/fairseq2/recipe/internal/
         model.py", line 63, in get                                                              
             model = self._bootstrapper.bootstrap()                                              
           File                                                                                  
         "/root/anaconda3/envs/omnilingual/lib/python3.10/site-packages/fairseq2/recipe/internal/
         model.py", line 111, in bootstrap                                                       
             return self._load_custom_model()                                                    
           File                                                                                  
         "/root/anaconda3/envs/omnilingual/lib/python3.10/site-packages/fairseq2/recipe/internal/
         model.py", line 214, in _load_custom_model                                              
             raise InternalError(                                                                
         fairseq2.error.InternalError: Default configuration of the                              
         <fairseq2.models.family.StandardModelFamily object at 0x7fb98bd02560> model family      
         cannot be constructed. 

More details: rank_0.log


Maybe it's worth noting that I had successfully merged them into a single file step_800/consolidated.pt, loaded this model and got ASRInferencePipeline using my code load_model_from.py, which proves it workable to load model from user's checkpoints:

# ...
tk = load_tokenizer("omniASR_tokenizer_written_v2")
pipeline = ASRInferencePipeline(model_card=None, model=model, tokenizer=tk)

My codes:

merge_sharded_ckpt.py

load_model_from.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions