Text-to-Image
Diffusers
Safetensors
English
Chinese
QwenImage21Pipeline
sdnq
int4
uint4
image-generation
image-editing
apple-silicon
8-bit precision
Instructions to use ixim/Image21-INT4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ixim/Image21-INT4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ixim/Image21-INT4", 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
| """Validate a staged release, then upload only files named by its manifest.""" | |
| import argparse | |
| import os | |
| from pathlib import Path | |
| from scripts.release import validate_release | |
| def modelscope_access(config, owner): | |
| token = os.environ.get('MODELSCOPE_API_TOKEN') | |
| if token: | |
| return token | |
| if not config.get_cookies(): | |
| raise RuntimeError('No valid ModelScope API login. Log in locally with a fresh SDK token.') | |
| user = config.get_user_info() | |
| if not user or user[0] != owner: | |
| raise ValueError('Authenticated ModelScope account differs from the requested account') | |
| return None | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('platform', choices=['huggingface', 'modelscope']) | |
| parser.add_argument('--folder') | |
| parser.add_argument('--repo-id') | |
| parser.add_argument('--dry-run', action='store_true') | |
| args = parser.parse_args() | |
| folder = Path(args.folder or f'release/{args.platform}') | |
| repo_id = args.repo_id or ('ixim/Image21-INT4' if args.platform == 'huggingface' else 'iximbox/Image21-INT4') | |
| owner = 'ixim' if args.platform == 'huggingface' else 'iximbox' | |
| if repo_id.split('/')[0] != owner or len(repo_id.split('/')) != 2: | |
| raise ValueError(f'Expected the {owner} namespace') | |
| rows = validate_release(folder) | |
| names = [row['path'] for row in rows] + ['MANIFEST.json'] | |
| print(f'Validated {len(rows)} files for {args.platform}:{repo_id}', flush=True) | |
| if args.dry_run: | |
| print('Dry run: no network mutation performed.') | |
| return | |
| if args.platform == 'huggingface': | |
| from huggingface_hub import HfApi, get_token | |
| token = get_token() | |
| if not token: | |
| raise RuntimeError('No Hugging Face credentials. Run hf auth login with this project HF_HOME first.') | |
| api = HfApi(token=token) | |
| if api.whoami()['name'] != owner: | |
| raise ValueError('Authenticated Hugging Face account differs from the requested account') | |
| api.create_repo(repo_id=repo_id, repo_type='model', private=False, exist_ok=True) | |
| result = api.upload_folder(repo_id=repo_id, repo_type='model', folder_path=str(folder), | |
| allow_patterns=names, commit_message='Release verified Image21-INT4 conversion') | |
| print(result) | |
| else: | |
| from modelscope.hub.api import HubApi, ModelScopeConfig | |
| from modelscope.hub.errors import NotExistError | |
| from requests.exceptions import HTTPError | |
| api = HubApi() | |
| token = modelscope_access(ModelScopeConfig, owner) | |
| try: | |
| api.get_model(repo_id) | |
| except HTTPError as exc: | |
| if exc.response is None or exc.response.status_code != 404: | |
| raise | |
| api.create_model(repo_id, visibility=5, license='other', | |
| original_model_id='Qwen/Qwen-Image-2.1', token=token) | |
| except NotExistError: | |
| api.create_model(repo_id, visibility=5, license='other', | |
| original_model_id='Qwen/Qwen-Image-2.1', token=token) | |
| result = api.upload_folder(repo_id=repo_id, folder_path=str(folder), token=token, | |
| allow_patterns=names, max_workers=4, | |
| commit_message='Release verified Image21-INT4 conversion') | |
| print(result) | |
| if __name__ == '__main__': | |
| main() | |