Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix falcon dummy input generator #1825

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions optimum/utils/input_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,11 +1090,12 @@ def __init__(
random_sequence_length_range=random_sequence_length_range,
**kwargs,
)
self.num_kv_heads = self.num_kv_heads = (
normalized_config.num_kv_heads
if (normalized_config.new_decoder_architecture or not normalized_config.multi_query)
else 1
)
if normalized_config.new_decoder_architecture and normalized_config.multi_query:
self.num_kv_heads = normalized_config.num_attention_heads
elif normalized_config.new_decoder_architecture:
self.num_kv_heads = normalized_config.num_kv_heads
else:
self.num_kv_heads = 1
Comment on lines +1093 to +1098
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be :

Suggested change
if normalized_config.new_decoder_architecture and normalized_config.multi_query:
self.num_kv_heads = normalized_config.num_attention_heads
elif normalized_config.new_decoder_architecture:
self.num_kv_heads = normalized_config.num_kv_heads
else:
self.num_kv_heads = 1
if normalized_config.new_decoder_architecture:
self.num_kv_heads = normalized_config.num_attention_heads
else:
self.num_kv_heads = normalized_config.num_kv_heads if not normalized_config.multi_query else 1

?

self.head_dim = self.hidden_size // self.num_attention_heads

Copy link
Collaborator

@echarlaix echarlaix Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also shouldn't it be udpated here and here as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also why not have this value set in the normalized_config directly and use it in both FalconDummyPastKeyValuesGenerator and ORTFalconForCausalLM @fxmarty ? (removing the need to have this check in both places)

def generate(self, input_name: str, framework: str = "pt", int_dtype: str = "int64", float_dtype: str = "fp32"):
Expand Down