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

Add StableLM-3B 4E1T to Keras Hub #2151

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

Bond099
Copy link

@Bond099 Bond099 commented Mar 18, 2025

This PR adds the StableLM-3B 4E1T model to Keras Hub. However, numerical matching with the Hugging Face implementation is still in progress.

@Bond099
Copy link
Author

Bond099 commented Mar 22, 2025

@divyashreepathihalli Here is a comparison of numerics with Hugging Face in Colab. The results match with an absolute tolerance of 1e-3, but they do not match when using 1e-5. Could you please take a look and suggest some improvements or explanations for this discrepancy?

with StableLM's official configuration(https://github.com/Stability-AI/StableLM/blob/main/configs/stablelm-3b-4e1t.yml).

Args:
num_query_heads (int): Number of attention heads for queries.
Copy link
Collaborator

Choose a reason for hiding this comment

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

format type hints similar to other models

StableLM model with any number of layers, heads, and embedding dimensions.

Args:
vocabulary_size (int): The size of the token vocabulary.
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix type hint format


@keras_hub_export("keras_hub.models.StableLMBackbone")
class StableLMBackbone(Backbone):
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

first one line description should be immediately after """


Example:
```python
# Randomly initialized StableLM decoder with custom config
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a from preset example

`keras.distribution.LayoutMap` that contains the sharding spec
for all the model weights.
"""
# The weight path and shape of the Llama backbone is like below
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove commented code

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Mar 24, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Mar 24, 2025
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.

3 participants