CoolFace
Modelpublic

keras/bloomz_1.7b_multi

sourceHugging Faceopenrailupdated 2y agoView on Hugging Face
0likes23downloads
Model Card

Model Overview

BLOOM as described in as descriped in BLOOM: A 176B-Parameter Open-Access Multilingual Language Model, is a large language model published by BigScience. BLOOM is able to output coherent text in 46 languages and 13 programming languages. BLOOM models range in size from 0.5 billion to 3 billion parameters. See the model card below for benchmarks, data sources, and intended use cases.

Weights are released under the RAIL License. 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 nameParametersDescription
bloom_560m_multi559M560M base model
bloom_1.1b_multi1.06B1B base model
bloom_1.7b_multi1.72B1.7B base model
bloom_3b_multi3B3B base model
bloomz_560m_multi559M560m instruction-tuned model
bloomz_1.1b_multi1.06B1B instruction-tuned model
bloomz_1.7b_multi1.72B1.7B instruction-tuned model
bloomz_3b_multi3B3B instruction-tuned model

Prompts

The performance may vary depending on the prompt. For BLOOMZ models, we recommend making it very clear when the input stops to avoid the model trying to continue it. For example, the prompt "Translate to English: Je t'aime" without the full stop (.) at the end, may result in the model trying to continue the French sentence. Better prompts are e.g. "Translate to English: Je t'aime.", "Translate to English: Je t'aime. Translation:" "What is "Je t'aime." in English?", where it is clear for the model when it should answer. Further, we recommend providing the model as much context as possible. For example, if you want it to answer in Telugu, then tell the model, e.g. "Explain in a sentence in Telugu what is backpropagation in neural networks.".

Example Usage

python

import os

os.environ["KERAS_BACKEND"] = "jax"

import keras
import keras_hub

# When running only inference, bfloat16 saves memory usage significantly.
keras.config.set_floatx("bfloat16")

bloom_lm = keras_hub.models.BloomCausalLM.from_preset(
    "bloomz_1.7b_multi"
)
bloom_lm.summary()

outputs = bloom_lm.generate([
    "What is Keras?",
], max_length=512)

for output in outputs:
    print(output)

Example Usage with Hugging Face URI

python

import os

os.environ["KERAS_BACKEND"] = "jax"

import keras
import keras_hub

# When running only inference, bfloat16 saves memory usage significantly.
keras.config.set_floatx("bfloat16")

bloom_lm = keras_hub.models.BloomCausalLM.from_preset(
    "hf://keras/bloomz_1.7b_multi"
)
bloom_lm.summary()

outputs = bloom_lm.generate([
    "What is Keras?",
], max_length=512)

for output in outputs:
    print(output)