Text-to-Image
Diffusers
Safetensors
MageFlowPipeline
ajh
mage-flow
mage-flow-nvfp4-ajh
nvfp4
blackwell
qwen3-vl
quantization
Instructions to use ajh-code/Mage-Flow-NVFP4-AJH with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ajh-code/Mage-Flow-NVFP4-AJH with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ajh-code/Mage-Flow-NVFP4-AJH", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
| set -euo pipefail | |
| RELEASE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| RUNTIME_ROOT="${RELEASE_ROOT}/runtime" | |
| PYTHON_BIN="${PYTHON_BIN:-python}" | |
| CUDA_TOOLKIT_ROOT="${CUDA_HOME:-/usr/local/cuda}" | |
| NVCC="${CUDA_TOOLKIT_ROOT}/bin/nvcc" | |
| if [[ ! -x "${NVCC}" ]]; then | |
| echo "nvcc was not found at ${NVCC}" >&2 | |
| exit 1 | |
| fi | |
| mkdir -p "${RUNTIME_ROOT}" | |
| "${NVCC}" \ | |
| -std=c++17 -O3 -arch=sm_120a -shared -Xcompiler=-fPIC \ | |
| "${RUNTIME_ROOT}/nvfp4_linear.cu" \ | |
| -o "${RUNTIME_ROOT}/libmage_nvfp4_linear.so" \ | |
| -L"${CUDA_TOOLKIT_ROOT}/lib64" -lcublasLt -lcublas | |
| PYTORCH_INCLUDE_FLAGS="$("${PYTHON_BIN}" - <<'PY' | |
| from torch.utils.cpp_extension import include_paths | |
| print(" ".join(f"-I{path}" for path in include_paths())) | |
| PY | |
| )" | |
| PYTORCH_LIBRARY_FLAGS="$("${PYTHON_BIN}" - <<'PY' | |
| from torch.utils.cpp_extension import library_paths | |
| print(" ".join(f"-L{path}" for path in library_paths())) | |
| PY | |
| )" | |
| PYTORCH_RPATH_FLAGS="$("${PYTHON_BIN}" - <<'PY' | |
| from torch.utils.cpp_extension import library_paths | |
| print(" ".join(f"-Wl,-rpath,{path}" for path in library_paths())) | |
| PY | |
| )" | |
| PYTORCH_ABI_FLAG="$("${PYTHON_BIN}" - <<'PY' | |
| import torch | |
| print(f"-D_GLIBCXX_USE_CXX11_ABI={int(torch.compiled_with_cxx11_abi())}") | |
| PY | |
| )" | |
| g++ \ | |
| -std=c++20 -O3 -shared -fPIC \ | |
| ${PYTORCH_ABI_FLAG} \ | |
| ${PYTORCH_INCLUDE_FLAGS} \ | |
| ${PYTORCH_LIBRARY_FLAGS} \ | |
| ${PYTORCH_RPATH_FLAGS} \ | |
| -I"${CUDA_TOOLKIT_ROOT}/include" \ | |
| -I"${RUNTIME_ROOT}" \ | |
| -o "${RUNTIME_ROOT}/libmage_nvfp4_torch_op.so" \ | |
| "${RUNTIME_ROOT}/sm120_linear_op.cpp" \ | |
| -L"${CUDA_TOOLKIT_ROOT}/lib64" \ | |
| -L"${RUNTIME_ROOT}" \ | |
| -Wl,-rpath,"${CUDA_TOOLKIT_ROOT}/lib64" \ | |
| -Wl,-rpath,'$ORIGIN' \ | |
| -ltorch -ltorch_cpu -ltorch_cuda -lc10 -lc10_cuda -lcudart \ | |
| -lmage_nvfp4_linear | |
| echo "Built the packaged SM120 runtime in ${RUNTIME_ROOT}" | |