Suppport qwen model and solve some problems (#75)

This commit is contained in:
Arcmoon
2024-01-23 12:14:51 +08:00
committed by GitHub
parent e08bca2840
commit 63e97e5e4c
7 changed files with 274 additions and 4 deletions

View File

@@ -20,8 +20,10 @@ class ModelConfig:
# Unify the config keys for hf_config
self.context_len = get_context_length(self.hf_config)
self.head_dim = self.hf_config.hidden_size // self.hf_config.num_attention_heads
self.num_key_value_heads = self.hf_config.num_key_value_heads
self.num_attention_heads = self.hf_config.num_attention_heads
self.num_key_value_heads = getattr(self.hf_config, "num_key_value_heads", None)
if self.num_key_value_heads is None:
self.num_key_value_heads = self.num_attention_heads
self.hidden_size = self.hf_config.hidden_size
self.num_hidden_layers = self.hf_config.num_hidden_layers
self.vocab_size = self.hf_config.vocab_size