Instructions to use Snapmap/diffcheckstuffiused with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Snapmap/diffcheckstuffiused with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Snapmap/diffcheckstuffiused", 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
Download unet/Z-Image/src/utils/import_utils.py from Snapmap/diffcheckstuffiused: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/Snapmap/diffcheckstuffiused/resolve/main/unet/Z-Image/src/utils/import_utils.py
- Command line
-
hf download hf://Snapmap/diffcheckstuffiused/unet/Z-Image/src/utils/import_utils.py
-
curl -L -o import_utils.py https://huggingface.co/Snapmap/diffcheckstuffiused/resolve/main/unet/Z-Image/src/utils/import_utils.py
907 Bytes
| import importlib.util | |
| import torch | |
| def is_flash_attn_available(): | |
| return importlib.util.find_spec("flash_attn") is not None | |
| def is_flash_attn_3_available(): | |
| return importlib.util.find_spec("flash_attn_interface") is not None | |
| def is_torch_version(operator: str, version: str): | |
| from packaging import version as pversion | |
| torch_version = pversion.parse(torch.__version__) | |
| target_version = pversion.parse(version) | |
| # print(f"torch_version: {torch_version}, target: torch{operator}{target_version}") | |
| if operator == ">": | |
| return torch_version > target_version | |
| elif operator == ">=": | |
| return torch_version >= target_version | |
| elif operator == "==": | |
| return torch_version == target_version | |
| elif operator == "<=": | |
| return torch_version <= target_version | |
| elif operator == "<": | |
| return torch_version < target_version | |
| return False | |