Unverified Commit 2bbbf1be authored by Arthur's avatar Arthur Committed by GitHub
Browse files

[`BC`] Fix BC for other libraries (#29934)

* fi xbc?

* nit
parent 4df5b9b4
......@@ -1139,7 +1139,7 @@ class CohereForCausalLM(CoherePreTrainedModel):
# TODO joao: standardize interface for the different Cache classes and remove of this if
has_static_cache = False
if past_key_values is None:
past_key_values = getattr(self.model.layers[0].self_attn, "past_key_value", None)
past_key_values = getattr(getattr(self.model.layers[0], "self_attn", {}), "past_key_value", None)
has_static_cache = past_key_values is not None
past_length = 0
......
......@@ -1143,7 +1143,7 @@ class GemmaForCausalLM(GemmaPreTrainedModel):
# TODO joao: standardize interface for the different Cache classes and remove of this if
has_static_cache = False
if past_key_values is None:
past_key_values = getattr(self.model.layers[0].self_attn, "past_key_value", None)
past_key_values = getattr(getattr(self.model.layers[0], "self_attn", {}), "past_key_value", None)
has_static_cache = past_key_values is not None
past_length = 0
......
......@@ -1240,7 +1240,7 @@ class LlamaForCausalLM(LlamaPreTrainedModel):
# TODO joao: standardize interface for the different Cache classes and remove of this if
has_static_cache = False
if past_key_values is None:
past_key_values = getattr(self.model.layers[0].self_attn, "past_key_value", None)
past_key_values = getattr(getattr(self.model.layers[0], "self_attn", {}), "past_key_value", None)
has_static_cache = past_key_values is not None
past_length = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment