Bug fixes and improvements to llmadapter
This commit is contained in:
@@ -147,13 +147,14 @@ class LLMAdapter(torch.nn.Module):
|
||||
prompt_attention_mask = text_inputs.attention_mask.to(device)
|
||||
|
||||
# remove the system prompt from the input and attention mask
|
||||
text_input_ids = text_input_ids[:, self.system_prompt_length:]
|
||||
prompt_attention_mask = prompt_attention_mask[:, self.system_prompt_length:]
|
||||
|
||||
prompt_embeds = text_encoder(
|
||||
text_input_ids, attention_mask=prompt_attention_mask, output_hidden_states=True
|
||||
)
|
||||
prompt_embeds = prompt_embeds.hidden_states[-2]
|
||||
|
||||
prompt_embeds = prompt_embeds[:, self.system_prompt_length:]
|
||||
prompt_attention_mask = prompt_attention_mask[:, self.system_prompt_length:]
|
||||
|
||||
dtype = text_encoder.dtype
|
||||
|
||||
|
||||
Reference in New Issue
Block a user