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

Falcon support #890

Merged
merged 5 commits into from
Jul 2, 2023
Merged

Falcon support #890

merged 5 commits into from
Jul 2, 2023

Conversation

KexinFeng
Copy link
Contributor

The falcon models tiiuae/falcon-40b tiiuae/falcon-7b require special handling of the kv_cache, done in FalconBlock.

# concatenate along seq_length dimension:
# [batch, seq, num_heads*kvDim = 73 * 64]
#  - key: [batch_size * self.num_kv, seq, kvDim]. [2, 6, 64]
#  - value: [batch_size * self.num_kv, seq, kvDim]. [2, 6, 64]

# Falcon
# fused_qkv: [batch, seq, (num_heads=71 + num_kv=1 + num_kv=1) * kvDim]
# query_layer: [batch*num_heads=71,  seq, kvDim]
# key_layer  : [batch*num_kv, seq, kvDim].  num_kv=1
# value_layer: [batch*num_kv, seq, kvDim].  num_kv=1
# hidden_dim = 4544

Note:
The tokenizer of falcon models have bug. It cannot tokenize two strings with different lengths.

@KexinFeng KexinFeng requested review from zachgk, frankfliu and a team as code owners June 30, 2023 22:57
@KexinFeng KexinFeng merged commit bba1578 into deepjavalibrary:master Jul 2, 2023
KexinFeng added a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
KexinFeng added a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants