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
| # coding=utf-8 | |
| # Copyright 2024 ANT Group and the HuggingFace Inc. team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| from transformers import PretrainedConfig | |
| from qwen2_5_vit import Qwen2_5_VLVisionConfig | |
| from configuration_bailing_moe_v2 import BailingMoeV2Config | |
| class BailingMM2Config(PretrainedConfig): | |
| model_type = "bailingmm_moe_v2_lite" | |
| # Declared so transformers' `_attn_implementation` setter recurses into both towers. | |
| # Without it an explicit attn_implementation (e.g. "eager" on ROCm, which has no | |
| # flash-attn) never reaches them, and their "flash_attention_2" defaults raise at | |
| # model construction. | |
| sub_configs = {"vision_config": Qwen2_5_VLVisionConfig, "llm_config": BailingMoeV2Config} | |
| def __init__( | |
| self, | |
| mlp_depth=1, | |
| llm_config: BailingMoeV2Config = None, | |
| vision_config: Qwen2_5_VLVisionConfig = None, | |
| audio_config=None, | |
| **kwargs | |
| ): | |
| if audio_config is not None: | |
| raise ValueError("audio_config is not supported by Ming Image inference") | |
| self.audio_config = None | |
| self.vision_config = Qwen2_5_VLVisionConfig(**vision_config) if isinstance(vision_config, dict) else vision_config | |
| self.llm_config = BailingMoeV2Config(**llm_config) if isinstance(llm_config, dict) else llm_config | |
| self.mlp_depth = mlp_depth | |
| super().__init__(**kwargs) | |