Special tokens in the vocabulary?
Hi there,
When I load the model's tokenizer using:
tokenizer = AutoTokenizer.from_pretrained("RLHFlow/ArmoRM-Llama3-8B-v0.1", trust_remote_code=True)
I got this warning:
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Any chance you could provide a hint on why this would happen and how to solve it please?
I also got this "Token pattern not found in the list" error when I tried out the model under no_grad() condition. I'm not sure whether this is related to the above warning, but would you take a look as well? Many thanks!! See below for the code and error message:
with torch.no_grad():
outputs_a = model(input_ids=input_ids_a)
outputs_b = model(input_ids=input_ids_b)
ValueError Traceback (most recent call last)
File :3
File /usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py:1532, in Module._wrapped_call_impl(self, *args, **kwargs)
1530 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1531 else:
-> 1532 return self._call_impl(*args, **kwargs)
File /usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py:1541, in Module._call_impl(self, *args, **kwargs)
1536 # If we don't have any hooks, we want to skip the rest of the logic in
1537 # this function, and just call forward.
1538 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1539 or _global_backward_pre_hooks or _global_backward_hooks
1540 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1541 return forward_call(*args, **kwargs)
1543 try:
1544 result = None
File /usr/local/lib/python3.10/site-packages/peft/peft_model.py:1238, in PeftModelForSequenceClassification.forward(self, input_ids, attention_mask, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict, task_ids, **kwargs)
1236 if peft_config.peft_type == PeftType.POLY:
1237 kwargs["task_ids"] = task_ids
-> 1238 return self.base_model(
1239 input_ids=input_ids,
1240 attention_mask=attention_mask,
1241 inputs_embeds=inputs_embeds,
1242 labels=labels,
1243 output_attentions=output_attentions,
1244 output_hidden_states=output_hidden_states,
1245 return_dict=return_dict,
1246 **kwargs,
1247 )
1249 batch_size = _get_batch_size(input_ids, inputs_embeds)
1250 if attention_mask is not None:
1251 # concat prompt attention mask
File /usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py:1532, in Module._wrapped_call_impl(self, *args, **kwargs)
1530 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1531 else:
-> 1532 return self._call_impl(*args, **kwargs)
File /usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py:1541, in Module._call_impl(self, *args, **kwargs)
1536 # If we don't have any hooks, we want to skip the rest of the logic in
1537 # this function, and just call forward.
1538 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1539 or _global_backward_pre_hooks or _global_backward_hooks
1540 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1541 return forward_call(*args, **kwargs)
1543 try:
1544 result = None
File /usr/local/lib/python3.10/site-packages/peft/tuners/tuners_utils.py:179, in BaseTuner.forward(self, *args, **kwargs)
178 def forward(self, *args: Any, **kwargs: Any):
--> 179 return self.model.forward(*args, **kwargs)
File ~/.cache/huggingface/modules/transformers_modules/RLHFlow/ArmoRM-Llama3-8B-v0.1/97bc38d5bc709b850e236ef5f03589f6098552c0/modeling_custom.py:152, in LlamaForRewardModelWithGating.forward(self, input_ids, attention_mask, position_ids, past_key_values, inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)
149 assert hidden_states.shape == (batch_size, self.config.hidden_size)
150 rewards = self.regression_layer(hidden_states)
--> 152 gating_token_positions = [find_token_for_gating(ids.tolist()) for ids in input_ids]
153 prompt_embedding = tokens_hidden_states[dummy_iterator, gating_token_positions, :]
154 gating_output = self.gating(prompt_embedding)
File ~/.cache/huggingface/modules/transformers_modules/RLHFlow/ArmoRM-Llama3-8B-v0.1/97bc38d5bc709b850e236ef5f03589f6098552c0/modeling_custom.py:152, in (.0)
149 assert hidden_states.shape == (batch_size, self.config.hidden_size)
150 rewards = self.regression_layer(hidden_states)
--> 152 gating_token_positions = [find_token_for_gating(ids.tolist()) for ids in input_ids]
153 prompt_embedding = tokens_hidden_states[dummy_iterator, gating_token_positions, :]
154 gating_output = self.gating(prompt_embedding)
File ~/.cache/huggingface/modules/transformers_modules/RLHFlow/ArmoRM-Llama3-8B-v0.1/97bc38d5bc709b850e236ef5f03589f6098552c0/modeling_custom.py:47, in find_token_for_gating(lst)
45 if lst[j:j + token_pattern_len] == token_pattern:
46 return j
---> 47 raise ValueError("Token pattern not found in the list.")
ValueError: Token pattern not found in the list.
hi can you go to our GitHub page and create an issue?
I can @haoxiang there for discussion
Sure; thanks!
Have you updated the transformers
library to the newest?
@nshen7