Skip to content

Commit

Permalink
Address PR alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
PatriceVignola committed Sep 18, 2024
1 parent 9468b53 commit ccbd6cf
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/python/py/models/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2357,15 +2357,15 @@ def make_layer(self, layer_id, layer):


class GemmaModel(MistralModel):
def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, ep, cache_dir, extra_options)
def __init__(self, config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options)
self.embed_attrs["scale"] = np.round(np.sqrt(self.hidden_size), decimals=2)
self.layernorm_attrs["add_offset"] = 1


class Gemma2Model(GemmaModel):
def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, ep, cache_dir, extra_options)
def __init__(self, config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options)
self.attention_attrs["scale"] = config.query_pre_attn_scalar ** -0.5
self.lm_head_attrs["scale"] = config.final_logit_softcapping

Expand Down Expand Up @@ -2709,19 +2709,19 @@ def make_mlp_proj(self, layer_id, mlp, root_input):


class Phi3Small128KModel(Phi3Small8KModel):
def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, ep, cache_dir, extra_options)
def __init__(self, config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options)
self.make_rotary_embedding_multi_cache()


class Phi3VModel(Phi3Mini128KModel):
def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, ep, cache_dir, extra_options)
def __init__(self, config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options)


class Phi3MoE128KModel(MistralModel):
def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, ep, cache_dir, extra_options)
def __init__(self, config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options):
super().__init__(config, io_dtype, onnx_dtype, no_contrib_ops, ep, cache_dir, extra_options)
assert io_dtype == TensorProto.FLOAT16, "This model only supports float16 io type."

self.layernorm_attrs["simple"] = False
Expand Down

0 comments on commit ccbd6cf

Please sign in to comment.