Instructions to use keras/qwen3_5_2b_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/qwen3_5_2b_base with KerasHub:
import keras_hub # Load CausalLM model (optional: use half precision for inference) causal_lm = keras_hub.models.CausalLM.from_preset("hf://keras/qwen3_5_2b_base", dtype="bfloat16") causal_lm.compile(sampler="greedy") # (optional) specify a sampler # Generate text causal_lm.generate("Keras: deep learning for", max_length=64)import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/qwen3_5_2b_base") - Keras
How to use keras/qwen3_5_2b_base with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://keras/qwen3_5_2b_base") - Notebooks
- Google Colab
- Kaggle
| { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_causal_lm_preprocessor", | |
| "class_name": "Qwen3_5CausalLMPreprocessor", | |
| "config": { | |
| "name": "qwen3_5_causal_lm_preprocessor", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "tokenizer": { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_tokenizer", | |
| "class_name": "Qwen3_5Tokenizer", | |
| "config": { | |
| "name": "qwen3_5_tokenizer", | |
| "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": [ | |
| "<|object_ref_start|>", | |
| "<|file_sep|>", | |
| "<|video_pad|>", | |
| "<|quad_end|>", | |
| "<|vision_end|>", | |
| "</tool_call>", | |
| "<|fim_pad|>", | |
| "<|fim_suffix|>", | |
| "<|vision_pad|>", | |
| "<|repo_name|>", | |
| "<|box_end|>", | |
| "<tool_call>", | |
| "<|object_ref_end|>", | |
| "<|vision_start|>", | |
| "<|fim_prefix|>", | |
| "<|box_start|>", | |
| "<|fim_middle|>", | |
| "<|endoftext|>", | |
| "<|im_start|>", | |
| "<|quad_start|>", | |
| "<|im_end|>", | |
| "<|image_pad|>" | |
| ], | |
| "has_vision_tokens": true | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5Tokenizer" | |
| }, | |
| "image_converter": { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_image_converter", | |
| "class_name": "Qwen3_5ImageConverter", | |
| "config": { | |
| "name": "qwen3_5_image_converter", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "image_size": null, | |
| "scale": [ | |
| 0.00784313725490196, | |
| 0.00784313725490196, | |
| 0.00784313725490196 | |
| ], | |
| "offset": [ | |
| -1.0, | |
| -1.0, | |
| -1.0 | |
| ], | |
| "interpolation": "bicubic", | |
| "antialias": true, | |
| "crop_to_aspect_ratio": true, | |
| "pad_to_aspect_ratio": false, | |
| "bounding_box_format": "yxyx", | |
| "patch_size": 16, | |
| "temporal_patch_size": 2, | |
| "spatial_merge_size": 2, | |
| "min_pixels": 65536, | |
| "max_pixels": 16777216 | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5ImageConverter" | |
| }, | |
| "video_converter": { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_video_converter", | |
| "class_name": "Qwen3_5VideoConverter", | |
| "config": { | |
| "name": "qwen3_5_video_converter", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "image_size": null, | |
| "scale": [ | |
| 0.00784313725490196, | |
| 0.00784313725490196, | |
| 0.00784313725490196 | |
| ], | |
| "offset": [ | |
| -1.0, | |
| -1.0, | |
| -1.0 | |
| ], | |
| "patch_size": 16, | |
| "temporal_patch_size": 2, | |
| "spatial_merge_size": 2, | |
| "min_pixels": 4096, | |
| "max_pixels": 234881024, | |
| "interpolation": "bicubic", | |
| "antialias": true | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5VideoConverter" | |
| }, | |
| "config_file": "preprocessor.json", | |
| "sequence_length": 1024, | |
| "add_start_token": false, | |
| "add_end_token": true, | |
| "video_fps": 2.0 | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5CausalLMPreprocessor" | |
| } |