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", | |
| "class_name": "Qwen3_5CausalLM", | |
| "config": { | |
| "backbone": { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_backbone", | |
| "class_name": "Qwen3_5Backbone", | |
| "config": { | |
| "name": "qwen3_5_backbone", | |
| "trainable": true, | |
| "dtype": { | |
| "module": "keras", | |
| "class_name": "DTypePolicy", | |
| "config": { | |
| "name": "float32" | |
| }, | |
| "registered_name": null | |
| }, | |
| "vocabulary_size": 248320, | |
| "num_layers": 24, | |
| "num_query_heads": 8, | |
| "hidden_dim": 2048, | |
| "head_dim": 256, | |
| "intermediate_dim": 6144, | |
| "layer_types": [ | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "full_attention" | |
| ], | |
| "partial_rotary_factor": 0.25, | |
| "rope_max_wavelength": 10000000, | |
| "rope_scaling_factor": 1.0, | |
| "num_key_value_heads": 2, | |
| "layer_norm_epsilon": 1e-06, | |
| "dropout": 0.0, | |
| "tie_word_embeddings": true, | |
| "sliding_window_size": 32768, | |
| "linear_num_key_heads": 16, | |
| "linear_num_value_heads": 16, | |
| "linear_key_head_dim": 128, | |
| "linear_value_head_dim": 128, | |
| "linear_conv_kernel_dim": 4, | |
| "mrope_section": [ | |
| 11, | |
| 11, | |
| 10 | |
| ], | |
| "vision_encoder": { | |
| "module": "keras_hub.src.models.qwen3_5.qwen3_5_vision_encoder", | |
| "class_name": "Qwen3_5VisionEncoder", | |
| "config": { | |
| "depth": 24, | |
| "hidden_size": 1024, | |
| "num_heads": 16, | |
| "intermediate_size": 4096, | |
| "in_channels": 3, | |
| "patch_size": 16, | |
| "temporal_patch_size": 2, | |
| "spatial_merge_size": 2, | |
| "out_hidden_size": 2048, | |
| "num_position_embeddings": 2304 | |
| }, | |
| "registered_name": "Qwen3_5VisionEncoder" | |
| } | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5Backbone" | |
| }, | |
| "preprocessor": { | |
| "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" | |
| }, | |
| "name": "qwen3_5_causal_lm" | |
| }, | |
| "registered_name": "keras_hub>Qwen3_5CausalLM" | |
| } |