CarperAI / CarperAI/trlx

Error loading T5 model checkpoint for inference after training with ILQL

Open
#500 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
4.8k
Forks
487
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Describe the bug

I am trying to inference the T5 base model after training it with ILQL but I am facing some key error. Wondering if its the correct way.
from trlx.models.modeling_ilql import AutoModelForSeq2SeqLMWithILQLHeads,AutoModelForCausalLMWithILQLHeads
t5_checkpoints is the model trained with SFT and then I am trying to load the state with model.load_state_dict

def load_model(path):
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-base")
model = AutoModelForSeq2SeqLMWithILQLHeads.from_pretrained("./t5_checkpoints/")
model.load_state_dict(torch.load("./ilql_summarize_t5/checkpoint_5000/pytorch_model/mp_rank_00_model_states.pt"))

And getting this error:
RuntimeError: Error(s) in loading state_dict for
AutoModelForSeq2SeqLMWithILQLHeads:
Missing key(s) in state_dict: "base_model.shared.weight",
"base_model.encoder.embed_tokens.weight",
"base_model.encoder.block.0.layer.0.SelfAttention.q.weight",
...........,
"ilql_heads.target_q_heads.1.2.weight", "ilql_heads.target_q_heads.1.2.bias".
Unexpected key(s) in state_dict: "module", "buffer_names", "optimizer",
"param_shapes", "frozen_param_shapes", "shared_params",
"frozen_param_fragments", "lr_scheduler", "data_sampler", "random_ltd",
"sparse_tensor_module_names", "skipped_steps", "global_steps", "global_samples",
"dp_world_size", "mp_world_size", "ds_config", "ds_version".

### Which trlX version are you using?

_No response_

### Additional system and package information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.