keras / mistral_7b_en

huggingface.co
Total runs: 13
24-hour runs: 0
7-day runs: -32
30-day runs: -23
Model's Last Updated: June 17 2025
text-generation

Introduction of mistral_7b_en

Model Details of mistral_7b_en

Model Overview

Mistral is a set of large language models published by the Mistral AI team. Both pretrained and instruction tuned models are available with 7 billion parameters. See the model card below for benchmarks, data sources, and intended use cases.

Both weights and Keras model code is released under the Apache 2 License .

Links
Installation

Keras and KerasHub can be installed with:

pip install -U -q keras-hub
pip install -U -q keras>=3

Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the Keras Getting Started page.

Presets

The following model checkpoints are provided by the Keras team. Full code examples for each are available below.

Preset name Parameters Description
mistral_7b_en 7.24B 7B base model
mistral_instruct_7b_en 7.24B 7B instruction-tuned model
mistral_0.2_instruct_7b_en 7.24B 7B instruction-tuned model version 0.2
Prompts

Mistral "instruct" models are instruction tuned on turn by turn conversations and should be prompted with examples that precisely match the training data. Specifically, you must alternate user and assistant turns that begin and end with special tokens. See the following for an example:

prompt = """[INST] Hello! [/INST] Hello! How are you? [INST] I'm great. Could you help me with a task? [/INST]
"""

Base models (without instruct in the name) have no specific prompting structure, and should usually be fine-tuned for a specific task.

Example Usage
import keras
import keras_hub
import numpy as np

Use generate() to do text generation.

mistral_lm = keras_hub.models.MistralCausalLM.from_preset("mistral_7b_en")
mistral_lm.generate("[INST] What is Keras? [/INST]", max_length=500)

# Generate with batched prompts.
mistral_lm.generate(["[INST] What is Keras? [/INST]", "[INST] Give me your best brownie recipe. [/INST]"], max_length=500)

Compile the generate() function with a custom sampler.

mistral_lm = keras_hub.models.MistralCausalLM.from_preset("mistral_7b_en")
mistral_lm.compile(sampler="greedy")
mistral_lm.generate("I want to say", max_length=30)

mistral_lm.compile(sampler=keras_hub.samplers.BeamSampler(num_beams=2))
mistral_lm.generate("I want to say", max_length=30)

Use generate() without preprocessing.

prompt = {
    # `1` maps to the start token followed by "I want to say".
    "token_ids": np.array([[1, 315, 947, 298, 1315, 0, 0, 0, 0, 0]] * 2),
    # Use `"padding_mask"` to indicate values that should not be overridden.
    "padding_mask": np.array([[1, 1, 1, 1, 1, 0, 0, 0, 0, 0]] * 2),
}

mistral_lm = keras_hub.models.MistralCausalLM.from_preset(
    "mistral_7b_en",
    preprocessor=None,
    dtype="bfloat16"
)
mistral_lm.generate(prompt)

Call fit() on a single batch.

features = ["The quick brown fox jumped.", "I forgot my homework."]
mistral_lm = keras_hub.models.MistralCausalLM.from_preset("mistral_7b_en")
mistral_lm.fit(x=features, batch_size=2)

Call fit() without preprocessing.

x = {
    "token_ids": np.array([[1, 315, 947, 298, 1315, 369, 315, 837, 0, 0]] * 2),
    "padding_mask": np.array([[1, 1, 1, 1, 1, 1, 1, 1, 0, 0]] * 2),
}
y = np.array([[315, 947, 298, 1315, 369, 315, 837, 0, 0, 0]] * 2)
sw = np.array([[1, 1, 1, 1, 1, 1, 1, 0, 0, 0]] * 2)

mistral_lm = keras_hub.models.MistralCausalLM.from_preset(
    "mistral_7b_en",
    preprocessor=None,
    dtype="bfloat16"
)
mistral_lm.fit(x=x, y=y, sample_weight=sw, batch_size=2)
Example Usage with Hugging Face URI
import keras
import keras_hub
import numpy as np

Use generate() to do text generation.

mistral_lm = keras_hub.models.MistralCausalLM.from_preset("hf://keras/mistral_7b_en")
mistral_lm.generate("[INST] What is Keras? [/INST]", max_length=500)

# Generate with batched prompts.
mistral_lm.generate(["[INST] What is Keras? [/INST]", "[INST] Give me your best brownie recipe. [/INST]"], max_length=500)

Compile the generate() function with a custom sampler.

mistral_lm = keras_hub.models.MistralCausalLM.from_preset("hf://keras/mistral_7b_en")
mistral_lm.compile(sampler="greedy")
mistral_lm.generate("I want to say", max_length=30)

mistral_lm.compile(sampler=keras_hub.samplers.BeamSampler(num_beams=2))
mistral_lm.generate("I want to say", max_length=30)

Use generate() without preprocessing.

prompt = {
    # `1` maps to the start token followed by "I want to say".
    "token_ids": np.array([[1, 315, 947, 298, 1315, 0, 0, 0, 0, 0]] * 2),
    # Use `"padding_mask"` to indicate values that should not be overridden.
    "padding_mask": np.array([[1, 1, 1, 1, 1, 0, 0, 0, 0, 0]] * 2),
}

mistral_lm = keras_hub.models.MistralCausalLM.from_preset(
    "hf://keras/mistral_7b_en",
    preprocessor=None,
    dtype="bfloat16"
)
mistral_lm.generate(prompt)

Call fit() on a single batch.

features = ["The quick brown fox jumped.", "I forgot my homework."]
mistral_lm = keras_hub.models.MistralCausalLM.from_preset("hf://keras/mistral_7b_en")
mistral_lm.fit(x=features, batch_size=2)

Call fit() without preprocessing.

x = {
    "token_ids": np.array([[1, 315, 947, 298, 1315, 369, 315, 837, 0, 0]] * 2),
    "padding_mask": np.array([[1, 1, 1, 1, 1, 1, 1, 1, 0, 0]] * 2),
}
y = np.array([[315, 947, 298, 1315, 369, 315, 837, 0, 0, 0]] * 2)
sw = np.array([[1, 1, 1, 1, 1, 1, 1, 0, 0, 0]] * 2)

mistral_lm = keras_hub.models.MistralCausalLM.from_preset(
    "hf://keras/mistral_7b_en",
    preprocessor=None,
    dtype="bfloat16"
)
mistral_lm.fit(x=x, y=y, sample_weight=sw, batch_size=2)

Runs of keras mistral_7b_en on huggingface.co

13
Total runs
0
24-hour runs
-33
3-day runs
-32
7-day runs
-23
30-day runs

More Information About mistral_7b_en huggingface.co Model

More mistral_7b_en license Visit here:

https://choosealicense.com/licenses/apache-2.0

mistral_7b_en huggingface.co

mistral_7b_en huggingface.co is an AI model on huggingface.co that provides mistral_7b_en's model effect (), which can be used instantly with this keras mistral_7b_en model. huggingface.co supports a free trial of the mistral_7b_en model, and also provides paid use of the mistral_7b_en. Support call mistral_7b_en model through api, including Node.js, Python, http.

mistral_7b_en huggingface.co Url

https://huggingface.co/keras/mistral_7b_en

keras mistral_7b_en online free

mistral_7b_en huggingface.co is an online trial and call api platform, which integrates mistral_7b_en's modeling effects, including api services, and provides a free online trial of mistral_7b_en, you can try mistral_7b_en online for free by clicking the link below.

keras mistral_7b_en online free url in huggingface.co:

https://huggingface.co/keras/mistral_7b_en

mistral_7b_en install

mistral_7b_en is an open source model from GitHub that offers a free installation service, and any user can find mistral_7b_en on GitHub to install. At the same time, huggingface.co provides the effect of mistral_7b_en install, users can directly use mistral_7b_en installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

mistral_7b_en install url in huggingface.co:

https://huggingface.co/keras/mistral_7b_en

Url of mistral_7b_en

mistral_7b_en huggingface.co Url

Provider of mistral_7b_en huggingface.co

keras
ORGANIZATIONS

Other API from keras

huggingface.co

Total runs: 22
Run Growth: 19
Growth Rate: 86.36%
Updated:February 27 2026
huggingface.co

Total runs: 15
Run Growth: -129
Growth Rate: -860.00%
Updated:July 17 2026
huggingface.co

Total runs: 13
Run Growth: -28
Growth Rate: -215.38%
Updated:June 17 2025
huggingface.co

Total runs: 13
Run Growth: 6
Growth Rate: 46.15%
Updated:February 27 2026
huggingface.co

Total runs: 13
Run Growth: 10
Growth Rate: 76.92%
Updated:March 25 2025
huggingface.co

Total runs: 11
Run Growth: 8
Growth Rate: 72.73%
Updated:February 27 2026
huggingface.co

Total runs: 11
Run Growth: -129
Growth Rate: -1172.73%
Updated:July 17 2026
huggingface.co

Total runs: 10
Run Growth: 2
Growth Rate: 18.18%
Updated:March 25 2025
huggingface.co

Total runs: 9
Run Growth: 3
Growth Rate: 33.33%
Updated:March 25 2025
huggingface.co

Total runs: 8
Run Growth: 1
Growth Rate: 12.50%
Updated:March 25 2025
huggingface.co

Total runs: 7
Run Growth: -12
Growth Rate: -171.43%
Updated:May 15 2026
huggingface.co

Total runs: 7
Run Growth: -27
Growth Rate: -385.71%
Updated:June 17 2025
huggingface.co

Total runs: 7
Run Growth: 4
Growth Rate: 57.14%
Updated:February 27 2026
huggingface.co

Total runs: 7
Run Growth: 4
Growth Rate: 57.14%
Updated:February 27 2026
huggingface.co

Total runs: 6
Run Growth: 3
Growth Rate: 50.00%
Updated:June 17 2025
huggingface.co

Total runs: 6
Run Growth: 6
Growth Rate: 100.00%
Updated:June 17 2025
huggingface.co

Total runs: 6
Run Growth: 3
Growth Rate: 50.00%
Updated:March 25 2025