Instructions to use keras/llama3.1_instruct_8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/llama3.1_instruct_8b with KerasHub:
import keras_hub # Create a LlamaCausalLM model task = keras_hub.models.LlamaCausalLM.from_preset("hf://keras/llama3.1_instruct_8b")import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/llama3.1_instruct_8b") - Keras
How to use keras/llama3.1_instruct_8b with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://keras/llama3.1_instruct_8b") - Notebooks
- Google Colab
- Kaggle
Download preprocessor.json from keras/llama3.1_instruct_8b: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/keras/llama3.1_instruct_8b/resolve/main/preprocessor.json
- Command line
-
hf download hf://keras/llama3.1_instruct_8b/preprocessor.json
-
curl -L -o preprocessor.json https://huggingface.co/keras/llama3.1_instruct_8b/resolve/main/preprocessor.json
1.75 kB
| { | |
| "module": "keras_hub.src.models.llama3.llama3_causal_lm_preprocessor", | |
| "class_name": "Llama3CausalLMPreprocessor", | |
| "config": { | |
| "name": "llama3_causal_lm_preprocessor_1", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "tokenizer": { | |
| "module": "keras_hub.src.models.llama3.llama3_tokenizer", | |
| "class_name": "Llama3Tokenizer", | |
| "config": { | |
| "name": "llama3_tokenizer_1", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "int32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "config_file": "tokenizer.json", | |
| "sequence_length": null, | |
| "add_prefix_space": false, | |
| "unsplittable_tokens": [ | |
| "<|end_of_text|>", | |
| "<|finetune_right_pad_id|>", | |
| "<|eot_id|>", | |
| "<|begin_of_text|>", | |
| "<|eom_id|>", | |
| "<|python_tag|>", | |
| "<|start_header_id|>", | |
| "<|end_header_id|>" | |
| ] | |
| }, | |
| "registered_name": "keras_hub>Llama3Tokenizer" | |
| }, | |
| "config_file": "preprocessor.json", | |
| "sequence_length": 1024, | |
| "add_start_token": true, | |
| "add_end_token": true | |
| }, | |
| "registered_name": "keras_hub>Llama3CausalLMPreprocessor" | |
| } |