Skip to content

Commit

Permalink
add tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Jan 6, 2025
1 parent 05e0a1d commit cea2d1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/openvino/models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Here is the list of the supported architectures :
- GPT-NeoX-Japanese
- Gemma
- Gemma2
- Granite
- GraniteMoE
- Hubert
- IBert
- InternLM
Expand Down
2 changes: 2 additions & 0 deletions optimum/exporters/openvino/model_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3603,6 +3603,7 @@ def __exit__(self, exc_type, exc_value, traceback):
block.attn.forward = block.attn._orig_forward


# copied from https://github.com/huggingface/transformers/blob/v4.47.1/src/transformers/models/granitemoe/modeling_granitemoe.py#L321
def _granite_moe_topk_gating_forward(self, hidden_states):
# compute the top_k routing decision
logits = self.layer(hidden_states).float() # [batch_size x seq_len, num_experts]
Expand All @@ -3629,6 +3630,7 @@ def _granite_moe_topk_gating_forward(self, hidden_states):
return index_sorted_experts, batch_index, batch_gates, expert_size, logits


# copied from https://github.com/huggingface/transformers/blob/v4.47.1/src/transformers/models/granitemoe/modeling_granitemoe.py#L281
def _granite_moe_parallel_experts_forward(self, inputs, expert_size):
output_list = []
# difference with original
Expand Down
2 changes: 2 additions & 0 deletions tests/openvino/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
"gpt_neox": "hf-internal-testing/tiny-random-GPTNeoXForCausalLM",
"gpt_neox_japanese": "hf-internal-testing/tiny-random-GPTNeoXJapaneseForCausalLM",
"gptj": "hf-internal-testing/tiny-random-GPTJModel",
"granite": "katuni4ka/tiny-random-granite",
"granite-moe": "katuni4ka/tiny-random-granite-moe",
"hubert": "hf-internal-testing/tiny-random-HubertModel",
"ibert": "hf-internal-testing/tiny-random-ibert",
"internlm": "katuni4ka/tiny-random-internlm",
Expand Down

0 comments on commit cea2d1f

Please sign in to comment.