Instructions to use kingjones777/Ming-Image-0.1-Design-ROCm-INT8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use kingjones777/Ming-Image-0.1-Design-ROCm-INT8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("kingjones777/Ming-Image-0.1-Design-ROCm-INT8", 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 code/tests/test_padding.py from kingjones777/Ming-Image-0.1-Design-ROCm-INT8: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/kingjones777/Ming-Image-0.1-Design-ROCm-INT8/resolve/main/code/tests/test_padding.py
- Command line
-
hf download hf://kingjones777/Ming-Image-0.1-Design-ROCm-INT8/code/tests/test_padding.py
-
curl -L -o test_padding.py https://huggingface.co/kingjones777/Ming-Image-0.1-Design-ROCm-INT8/resolve/main/code/tests/test_padding.py
1.23 kB
| import unittest | |
| try: | |
| import torch | |
| except ImportError: | |
| torch = None | |
| if torch is not None: | |
| from diffusion.padding import mask_out_alignment_padding | |
| class ZeroPaddingTest(unittest.TestCase): | |
| def test_masks_alignment_padding_at_per_item_offsets(self): | |
| attention_mask = torch.ones((2, 8), dtype=torch.bool) | |
| pad_masks = [ | |
| torch.tensor([False, False, True, True]), | |
| torch.tensor([False, True, False]), | |
| ] | |
| result = mask_out_alignment_padding(attention_mask, pad_masks, [0, 3]) | |
| self.assertEqual( | |
| result[0].tolist(), | |
| [True, True, False, False, True, True, True, True], | |
| ) | |
| self.assertEqual( | |
| result[1].tolist(), | |
| [True, True, True, True, False, True, True, True], | |
| ) | |
| def test_rejects_non_boolean_attention_mask(self): | |
| attention_mask = torch.ones((1, 4), dtype=torch.float32) | |
| with self.assertRaisesRegex(ValueError, "2D boolean"): | |
| mask_out_alignment_padding( | |
| attention_mask, [torch.zeros(4, dtype=torch.bool)], [0] | |
| ) | |
| if __name__ == "__main__": | |
| unittest.main() | |