Qwen3
Collection
13 items • Updated
How to use zeromodels/qwen3-4b-instruct-2507 with ZeroModels:
# pip install -U zeromodels
# ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow".
import os
os.environ["KERAS_BACKEND"] = "jax"
from zeromodels import AutoZModel
# AutoZModel reads the repo's model_type and loads the matching class.
# For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect /
# AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto).
model = AutoZModel.from_weights("zeromodels/qwen3-4b-instruct-2507")
How to use zeromodels/qwen3-4b-instruct-2507 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://zeromodels/qwen3-4b-instruct-2507")
Pure-Keras 3 conversion of Qwen/Qwen3-4B-Instruct-2507 for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX. This is a dense Qwen3; weights are stored in bfloat16.
For model details, license, and usage terms, see the upstream model card.
Paper: Qwen3 Technical Report (arXiv:2505.09388) · HF Papers
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from zeromodels.models.qwen3 import Qwen3TextGenerate, Qwen3Tokenizer
model = Qwen3TextGenerate.from_weights("zeromodels/qwen3-4b-instruct-2507")
tokenizer = Qwen3Tokenizer.from_weights("zeromodels/qwen3-4b-instruct-2507")
inputs = tokenizer("Give me a short introduction to large language models.")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0]))
A huge thank you to the Qwen team at Alibaba for creating and releasing these models.
License: Apache 2.0.
Base model
Qwen/Qwen3-4B-Instruct-2507