Instructions to use hansQAQ/icip_source_2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hansQAQ/icip_source_2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("hansQAQ/icip_source_2", 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
| """ | |
| Import utilities: Utilities related to imports and our lazy inits. | |
| """ | |
| import importlib | |
| import importlib.util | |
| import torch | |
| _flash3_available = importlib.util.find_spec( | |
| "flash_attn_interface" | |
| ) is not None and "H800" in torch.cuda.get_device_name(0) | |
| try: | |
| from flash_attn_interface import flash_attn_func | |
| except ImportError: | |
| _flash3_available = False | |
| _is_sdpa_available = True | |
| try: | |
| import torch.nn.functional as F | |
| _is_sdpa_available = hasattr(F, "scaled_dot_product_attention") | |
| except ImportError: | |
| _is_sdpa_available = False | |
| def is_flash3_available() -> bool: | |
| return _flash3_available | |
| def is_sdpa_available() -> bool: | |
| return _is_sdpa_available | |