--- license: mit base_model: wushuang98/Direct3D-V3 base_model_relation: quantized pipeline_tag: image-to-3d library_name: direct3d tags: - image-to-3d - 3d - mesh - direct3d - direct3d-v3 - int8 - quantized - comfyui - low-vram --- # Direct3D-V3 INT8 (w8g32) — made by @MostAadTech A compact INT8 version of [Direct3D-V3](https://huggingface.co/wushuang98/Direct3D-V3) by DreamTech. It is made for consumer GPUs and small disks, and is used by the [Direct3D-V3 ComfyUI nodes](https://github.com/Mstafa-awad/Direct3D-V3_Comfyui_Nodes). **Quantized and packaged by Mostafa Awad ([@MostAadTech](https://github.com/Mstafa-awad)).** - **About 3× smaller on disk:** 5.9 GB instead of about 18.4 GB. - **Close to FP16 quality:** per-step error is about 1.6× normal FP16 rounding noise (details below). - **Runs on 8 GB GPUs:** tested on an RTX 5050 Laptop (8 GB) at 1536 resolution with 150k+ tokens. - **Works with every speed mode of the node:** `lossless`, `fast`, `fastest`, `off`. ## Files | Folder | Contents | Size | |---|---|---| | `shape_transformers_512/` | 512 stage, INT8 w8g32 | 1.31 GiB | | `shape_transformers_1024/` | 1024 stage, INT8 w8g32 | 1.31 GiB | | `shape_transformers_1536/` | 1536 stage, INT8 w8g32 | 1.31 GiB | | `image_encoder/` | DINOv3 ViT-H+/16 image encoder, FP16 | 1.57 GiB | | `model_index.json`, `config.json` | pipeline layout (same as the original) | – | The folder layout and configs match the original repository, so the files can replace the originals directly. ## Quality | | Original | This repo | |---|---|---| | Geometry stages | FP32 safetensors, about 5.0 GB each | INT8 + FP32 scales, 1.31 GiB each | | Image encoder | FP32, about 3.4 GB | FP16, 1.57 GiB | | Per-step error vs FP32 file (CFG output, 1024 stage) | – | 0.15–0.18 % | | Normal FP16 rounding noise, same measure | 0.10 % | 0.10 % | - **Image encoder:** the pipeline already runs it in FP16, so its output is bit-identical to the original. - **Geometry stages:** the weights are rebuilt to FP16 when they load, so all runtime kernels work unchanged. The small extra error (about 1.6× the FP16 noise floor) did not visibly change meshes in our tests (witch, dragon and house assets at 512, 1024 and 1536). ## Format (`direct3d-v3-w8g32`) Each geometry stage `model.safetensors` has the metadata `{"format": "direct3d-v3-w8g32", "group": "32"}`. - **Large weights:** every Linear weight (2-D, at least 65,536 values, input size divisible by 32) is stored as two tensors: - `.q8`: `int8 [out, in]`, values in −127..127. - `.s`: `float32 [out, in / 32]`, one scale per group of 32 consecutive input weights. The scale is `max(|w|) / 127` within each group, symmetric with no zero point. - **Everything else:** all other tensors (biases, norms, embeddings, small layers) are stored as FP16 under their normal names. To rebuild a weight: ```python import torch def dequantize_w8g32(q, s, dtype=torch.float16): out_f, in_f = q.shape w = q.float().view(out_f, in_f // 32, 32) * s.float().view(out_f, in_f // 32, 1) return w.view(out_f, in_f).to(dtype) ``` Loaders that don't recognize the format will not load these files. The ComfyUI node handles it automatically, in `vendor/Direct3D-V3/direct3d/models/checkpoint.py`. ## Usage with ComfyUI 1. Install the [Direct3D-V3 ComfyUI nodes](https://github.com/Mstafa-awad/Direct3D-V3_Comfyui_Nodes). 2. Download this repository into the node's model folder: ```bash huggingface-cli download MostAadTech/Direct3D-V3-INT8 --local-dir "ComfyUI/custom_nodes/ComfyUI-Direct3D-V3/models/Direct3D-V3" ``` 3. Leave the node's `model` field at its default; the node finds the local folder by itself. Keep `offline` on. For a 1536-only setup, `shape_transformers_1536/` and `image_encoder/` are enough. Set `resolution = 1536` and `stage_mode = single_stage`, or `start_resolution = 1536`. ## Node features that go with this model These features belong to the ComfyUI node, not to the weights: - **Speed modes:** `accel_mode` `lossless` / `fast` / `fastest` with Triton INT8 and FP16 kernels. At 152k tokens and 1536 resolution on an RTX 5050 Laptop, sampling time drops from 925 s to 576 s (lossless) and 459 s (fast). - **Multiview refinement:** front plus back, left, right, top and bottom images. - **Stage control:** a start/target stage picker, e.g. 1024 → 1536. - **Guidance:** CFG, APG or FDG, plus an option to turn guidance off for the last steps. - **Surface extraction:** marching cubes, or sparse dual contouring for sharp edges. ## License and credits - **Direct3D-V3 geometry weights:** © DreamTech, released under the **MIT License** (see the [original repository](https://huggingface.co/wushuang98/Direct3D-V3)). This repository is a quantized redistribution of those weights under the same license. - **Image encoder (`image_encoder/`):** Meta's **DINOv3**, distributed under the **DINOv3 License**, not MIT. Your use of that folder is governed by Meta's license; read it before commercial use. - **INT8 conversion, packaging and the ComfyUI integration:** Mostafa Awad (@MostAadTech), MIT. If you use this work, please credit **@MostAadTech** and cite the original Direct3D-V3 authors. ``` Original model: DreamTech, Direct3D-V3 — https://huggingface.co/wushuang98/Direct3D-V3 INT8 version: Mostafa Awad (@MostAadTech) — https://github.com/Mstafa-awad/Direct3D-V3_Comfyui_Nodes ```