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
| 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() | |