Text-to-Image
Diffusers
Safetensors
English
Chinese
QwenImage21Pipeline
sdnq
int4
uint4
image-generation
image-editing
apple-silicon
8-bit precision
Instructions to use ixim/Image21-INT4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ixim/Image21-INT4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ixim/Image21-INT4", 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
Download tests/test_device.py from ixim/Image21-INT4: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/ixim/Image21-INT4/resolve/main/tests/test_device.py
- Command line
-
hf download hf://ixim/Image21-INT4/tests/test_device.py
-
curl -L -o test_device.py https://huggingface.co/ixim/Image21-INT4/resolve/main/tests/test_device.py
1.07 kB
| import unittest | |
| from scripts.device import choose_runtime | |
| GIB = 1024 ** 3 | |
| class DevicePolicyTests(unittest.TestCase): | |
| def test_eight_gigabyte_cuda_uses_group_offload(self): | |
| policy = choose_runtime('cuda', 8 * GIB) | |
| self.assertEqual(policy['offload'], 'group') | |
| self.assertFalse(policy['use_stream']) | |
| def test_large_cuda_keeps_a_whole_component_on_gpu(self): | |
| policy = choose_runtime('cuda', 32 * GIB) | |
| self.assertEqual(policy['offload'], 'model') | |
| def test_apple_silicon_stays_on_the_eager_resident_path(self): | |
| policy = choose_runtime('mps', 24 * GIB) | |
| self.assertEqual(policy['offload'], 'resident') | |
| self.assertFalse(policy['use_stream']) | |
| self.assertEqual(policy['dtype'], 'bfloat16') | |
| def test_cpu_is_resident(self): | |
| self.assertEqual(choose_runtime('cpu', 64 * GIB)['offload'], 'resident') | |
| def test_unknown_device_is_rejected(self): | |
| with self.assertRaises(ValueError): | |
| choose_runtime('xpu', 8 * GIB) | |
| if __name__ == '__main__': | |
| unittest.main() | |