KerasHub: Pretrained Models / API documentation / Model Architectures / Qwen3.5 MoE / Qwen3_5MoeCausalLMPreprocessor layer

Qwen3_5MoeCausalLMPreprocessor layer

[source]

Qwen3_5MoeCausalLMPreprocessor class

keras_hub.models.Qwen3_5MoeCausalLMPreprocessor(
    tokenizer,
    image_converter=None,
    video_converter=None,
    sequence_length=1024,
    add_start_token=False,
    add_end_token=True,
    video_fps=2.0,
    **kwargs
)

Qwen3.5 MoE Causal LM preprocessor with multimodal support.

Inherits all multimodal preprocessing logic from the Qwen3.5 dense preprocessor (image/video conversion, M-RoPE position IDs, vision indices, special token handling). The only differences are the backbone_cls and tokenizer_cls references.


[source]

from_preset method

Qwen3_5MoeCausalLMPreprocessor.from_preset(
    preset, config_file="preprocessor.json", **kwargs
)

Instantiate a keras_hub.models.Preprocessor from a model preset.

A preset is a directory of configs, weights and other file assets used to save and load a pre-trained model. The preset can be passed as one of:

  1. a built-in preset identifier like 'bert_base_en'
  2. a Kaggle Models handle like 'kaggle://user/bert/keras/bert_base_en'
  3. a Hugging Face handle like 'hf://user/bert_base_en'
  4. a path to a local preset directory like './bert_base_en'

For any Preprocessor subclass, you can run cls.presets.keys() to list all built-in presets available on the class.

As there are usually multiple preprocessing classes for a given model, this method should be called on a specific subclass like keras_hub.models.BertTextClassifierPreprocessor.from_preset().

Arguments

  • preset: string. A built-in preset identifier, a Kaggle Models handle, a Hugging Face handle, or a path to a local directory.

Examples

# Load a preprocessor for Gemma generation.
preprocessor = keras_hub.models.CausalLMPreprocessor.from_preset(
    "gemma_2b_en",
)

# Load a preprocessor for Bert classification.
preprocessor = keras_hub.models.TextClassifierPreprocessor.from_preset(
    "bert_base_en",
)
Preset Parameters Description
qwen3_5_moe_35b_a3b_base 35.11B 35 billion total parameter Qwen3.5 MoE base model with ~3 billion active parameters per token. Features a 3:1 hybrid attention stack (GatedDeltaNet linear attention and full attention) with sparse Mixture-of-Experts feedforward for highly efficient inference. Supports text and multimodal inputs.
qwen3_5_moe_35b_a3b 35.11B 35 billion total parameter Qwen3.5 MoE instruction-tuned model with ~3 billion active parameters per token. Features a 3:1 hybrid attention stack (GatedDeltaNet linear attention and full attention) with sparse Mixture-of-Experts feedforward. Optimized for chat, reasoning, coding, and multimodal tasks.
qwen3_6_moe_35b_a3b 35.11B 35 billion total parameter Qwen3.6 MoE instruction-tuned model with ~3 billion active parameters per token. Features a 3:1 hybrid attention stack (GatedDeltaNet linear attention and full attention) with sparse Mixture-of-Experts feedforward. Optimized for fast inference and extended context lengths.

tokenizer property

keras_hub.models.Qwen3_5MoeCausalLMPreprocessor.tokenizer

The tokenizer used to tokenize strings.