keras-hub

Modular Natural Language Processing workflows with Keras

APACHE-2.0 License

Downloads
4.7K
Stars
762

Bot releases are visible (Hide)

keras-hub - v0.15.1

Published by mattdangerw 30 days ago

Summary

Bug fix patch release.

  • Always run tf preprocessing on CPU.
  • Fix running preprocessing outside the main python thread.
  • Fix loading classifiers with the "old name" of XXClasssifier as XXTextClassifier.
  • Restore support for bytestring to tokenizers and other preprocessing layers as strings.

What's Changed

Full Changelog: https://github.com/keras-team/keras-hub/compare/v0.15.0...v0.15.1

keras-hub - v0.15.0

Published by mattdangerw about 1 month ago

Summary

📢 KerasNLP is becoming KerasHub 📢, read more about it here.

This release contains a number of feature improvements:

  • Added int8 quantization support.
    • Use the quantize() method to quantize any model.
    • Llama 2 and Llama 3 pre-quantized presets are available.
  • PaliGemmaCausalLM will automatically resize input images during preprocessing.
  • Added more converters for hugginface/transformers checkpoints.
    • Gemma 2, PaliGemma, GPT2, Bert, Albert, DistilBert, Bart.
  • Class detection for huggingface/transformers checkpoints.
    • Call from_preset() on a base class, and we will find the correct subclass to create.
  • Added Vicuna presets.
  • Alias Classifier as TextClassifier, BertClassifier as BertTextClassifier.
  • Added tokenizer.special_tokens and tokenizer.special_token_ids as convenient properties to view all special tokens on a pretrained tokenizer.
# Quantize an unquantized model.
lm = keras_nlp.models.CausalLM.from_preset(
    "gemma2_instruct_2b_en",
    dtype="bfloat16",
)
lm.quantize("int8")
# Load a pre-quantized model.
lm = keras_nlp.models.CausalLM.from_preset(
    "llama3_instruct_8b_en_int8",
    dtype="bfloat16",
)
# Convert a bert model in the huggingface/transformers format.
classifier = keras_nlp.models.TextClassifier.from_preset(
    "hf://google-bert/bert-base-uncased",
    num_classes=2,
)
# View all special tokens.
print(classifier.preprocessor.tokenizer.special_tokens)
print(classifier.preprocessor.tokenizer.special_token_ids)

Breaking changes

  • On all backends, all strings and ragged output will be returned as python strings or python lists respectively.
    • This include preprocessing methods like tokenize() and detokenize().
    • This may break code that depended on tf.Tensor output on the tensorflow backend, but will lead to consistent output on all backends, which we believe will be an overall improvement.
    • Preprocessing layers can still always be included in a tf.data preprocessing pipeline, on any backend.

What's Changed

New Contributors

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.14.4...v0.15.0

keras-hub - v0.14.4

Published by mattdangerw 2 months ago

Summary

  • Fix issues with Gemma 2 sliding window.
  • Fix TensorFlow backend Gemma 2 generation.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.14.3...v0.14.4

keras-hub - v0.14.3

Published by mattdangerw 3 months ago

Summary

  • Short names for shield gemma checkpoints.
keras_nlp.models.GemmaCausalLM.from_preset("shieldgemma_2b_en")

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.14.2...v0.14.3

keras-hub - v0.14.2

Published by mattdangerw 3 months ago

Summary

  • Add Gemma 2 2b.
  • Fixes for logit softcapping.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.14.1...v0.14.2

keras-hub - v0.14.1

Published by mattdangerw 3 months ago

Summary

  • Update Gemma 2 9b to fix minor config error.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.14.0...v0.14.1

keras-hub - 0.14.0

Published by grasskin 4 months ago

Summary

  • Add Gemma 2 model!
  • Support loading fine-tuned transformers checkpoints in KerasNLP. Loading Gemma and Llama3 models are supported for now and will convert on the fly.
  • KerasNLP no longer supports Keras 2. Read Getting started with Keras for more information on installing Keras 3 and compatibility with different frameworks. We recommend using KerasNLP with TensorFlow 2.16 or later, as TF 2.16 packages Keras 3 by default.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.12.1...r0.14

keras-hub - v0.12.1 Latest Release

Published by mattdangerw 5 months ago

Summary

  • ⚠️ PaliGemma includes rescaling by default, so images are expected to be passed in the [0, 255] range. This is a backward incompatible change with the original release. Restore the original behavior as follows:
keras_nlp.models.PaliGemmaBackbone.from_preset(
    "pali_gemma_3b_224",
    include_rescaling=False,
)
  • Released the Falcon model.

What's Changed

New Contributors

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.12.0...v0.12.1

keras-hub - v0.12.0

Published by divyashreepathihalli 5 months ago

Summary

Add PaliGemma, Llama 3, and Phi 3 models.

PaliGemma quickstart, see a complete usage on Kaggle.

pali_gemma_lm = keras_nlp.models.PaliGemmaCausalLM.from_preset(
    "pali_gemma_3b_224"
)
pali_gemma_lm.generate(
    inputs={
        "images": images,
        "prompts": prompts,
    }
)

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.11.1...v0.12.0

keras-hub - v0.11.1

Published by grasskin 6 months ago

Summary

  • Add new Code Gemma 1.1 presets, which improve on Code Gemma performance.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.11.0...v0.11.1

keras-hub - v0.11.0

Published by mattdangerw 6 months ago

Summary

This release has no major feature updates, but changes the location our source code is help. Source code is split into a src/ and api/ directory with an explicit API surface similar to core Keras.

When adding or removing new API in a PR, use ./shell/api_gen.sh to update the autogenerated api/ files. See our contributing guide.

What's Changed

New Contributors

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.10.0...v0.11.0

keras-hub - v0.10.0

Published by SamanehSaadat 6 months ago

Summary

  • Added support for Task (CausalLM and Classifier) saving and loading which allows uploading Tasks.
  • Added basic Model Card for Hugging Face upload.
  • Added support for a positions array in our RotaryEmbedding layer.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.3...v0.10.0

keras-hub - v0.10.0.dev2

Published by SamanehSaadat 6 months ago

Summary

  • Added support for Task (CausalLM and Classifier) saving and loading which allows uploading Tasks.
  • Added basic Model Card for Hugging Face upload.
  • Added support for a positions array in our RotaryEmbedding layer.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.3...v0.10.0.dev2

keras-hub - v0.10.0.dev1

Published by SamanehSaadat 6 months ago

Summary

  • Added support for Task (CausalLM and Classifier) saving and loading which allows uploading Tasks.
  • Added basic Model Card for Hugging Face upload.
  • Added support for a positions array in our RotaryEmbedding layer.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.3...v0.10.0.dev1

keras-hub - v0.10.0.dev0

Published by SamanehSaadat 6 months ago

Summary

  • Add support for Task (CausalLM and Classifier) saving and loading which allows uploading Tasks.
  • Add basic Model Card for Hugging Face upload.
  • Add support for a positions array in our RotaryEmbedding layer.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.3...v0.10.0.dev0

keras-hub - v0.9.3

Published by mattdangerw 6 months ago

Patch release with fixes for Llama and Mistral saving.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.2...v0.9.3

keras-hub - v0.9.2

Published by mattdangerw 6 months ago

Summary

  • Initial release of CodeGemma.
  • Bump to a Gemma 1.1 version without download issues on Kaggle.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.1...v0.9.2

keras-hub - v0.9.2.dev0

Published by mattdangerw 6 months ago

🚧🚧Pre-release🚧🚧

Summary

  • Initial release of CodeGemma.
  • Bump to a Gemma 1.1 version without download issues on Kaggle.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.1...v0.9.2.dev0

keras-hub - v0.9.1

Published by mattdangerw 7 months ago

Patch fix for bug with stop_token_ids.

What's Changed

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.9.0...v0.9.1

keras-hub - v0.9.0

Published by mattdangerw 7 months ago

The 0.9.0 release adds new models, hub integrations, and general usability improvements.

Summary

  • Added the Gemma 1.1 release.
  • Added the Llama 2, BLOOM and ELECTRA models.
  • Expose new base classes. Allow from_preset() on base classes.
    • keras_nlp.models.Backbone
    • keras_nlp.models.Task
    • keras_nlp.models.Classifier
    • keras_nlp.models.CausalLM
    • keras_nlp.models.Seq2SeqLM
    • keras_nlp.models.MaskedLM
  • Some initial features for uploading to model hubs.
    • backbone.save_to_preset, tokenizer.save_to_preset, keras_nlp.upload_preset.
    • from_preset and upload_preset now work with the Hugging Face Models Hub.
    • More features (task saving, lora saving), and full documentation coming soon.
  • Numerical fixes for the Gemma model at mixed_bfloat16 precision. Thanks unsloth for catching!
# Llama 2. Needs Kaggle consent and login, see https://github.com/Kaggle/kagglehub
causal_lm = keras_nlp.models.LlamaCausalLM.from_preset(
    "llama2_7b_en",
    dtype="bfloat16", # Run at half precision for inference.
)
causal_lm.generate("Keras is a", max_length=128)
# Base class usage.
keras_nlp.models.Classifier.from_preset("bert_base_en", num_classes=2)
keras_nlp.models.Tokenizer.from_preset("gemma_2b_en")
keras_nlp.models.CausalLM.from_preset("gpt2_base_en", dtype="mixed_bfloat16")

What's Changed

New Contributors

Full Changelog: https://github.com/keras-team/keras-nlp/compare/v0.8.2...v0.9.0

Package Rankings
Top 34.6% on Pypi.org
Badges
Extracted from project README
contributions welcome