Skip to content

Add Mixtral #2196

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add Mixtral #2196

wants to merge 12 commits into from

Conversation

heyyanshuman
Copy link
Collaborator

@heyyanshuman heyyanshuman commented Apr 2, 2025

This PR adds Mixtral to Keras Hub.

Reference

@heyyanshuman heyyanshuman marked this pull request as ready for review April 10, 2025 08:40
@heyyanshuman
Copy link
Collaborator Author

Output matching :

image

Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

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

Left a few comments! Please provide a demo colab

)
self._query_dense.build(inputs_shape)

self._key_dense = keras.layers.EinsumDense(
Copy link
Collaborator

Choose a reason for hiding this comment

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

update the layer names to be compatible with enable_lora

@keras_hub_export("keras_hub.models.MixtralBackbone")
class MixtralBackbone(Backbone):
"""
The Mixtral Transformer core architecture with hyperparameters.
Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring first line should follow """

self.num_experts = num_experts
self.top_k = top_k
self.router_jitter_noise = router_jitter_noise

Copy link
Collaborator

Choose a reason for hiding this comment

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

remove new line

preprocessor("League of legends")

# Tokenize a batch of sentences.
sentences = tf.constant(["Taco tuesday", "Fish taco please!"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

why tf?

target_ids = keras.ops.roll(generation_ids, shift=-1, axis=1)

embeddings = None
with tf.GradientTape(watch_accessed_variables=True) as tape:
Copy link
Collaborator

Choose a reason for hiding this comment

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

why tf?

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