Instructions to use socialtrait/flux-3-image-klein-infendpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use socialtrait/flux-3-image-klein-infendpoint with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("socialtrait/flux-3-image-klein-infendpoint", 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
Download verify_checkpoint.py from socialtrait/flux-3-image-klein-infendpoint: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/socialtrait/flux-3-image-klein-infendpoint/resolve/main/verify_checkpoint.py
- Command line
-
hf download hf://socialtrait/flux-3-image-klein-infendpoint/verify_checkpoint.py
-
curl -L -o verify_checkpoint.py https://huggingface.co/socialtrait/flux-3-image-klein-infendpoint/resolve/main/verify_checkpoint.py
2.29 kB
| """Verify a downloaded checkpoint offline; optionally hash all selected weights.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| from model_config import GGUF_FILENAME | |
| def verify_checkpoint(path, quantization='q8_0', check_hashes=False): | |
| path = Path(path) | |
| manifest = json.loads((path / 'checkpoint_manifest.json').read_text()) | |
| required = ['modular_model_index.json', 'transformer/config.json', 'vae/config.json', | |
| 'text_encoder/config.json', 'text_encoder/tokenizer.json', | |
| 'text_encoder/tokenizer_config.json', 'text_encoder/chat_template.json', | |
| 'text_encoder/preprocessor_config.json', 'text_encoder/video_preprocessor_config.json', | |
| 'text_encoder/model.safetensors.index.json'] | |
| if quantization in ('bf16', 'all'): | |
| required.append('transformer/diffusion_pytorch_model.safetensors.index.json') | |
| for filename in required: | |
| if not (path / filename).is_file(): | |
| raise FileNotFoundError(f'Missing checkpoint file: {filename}') | |
| verified = [] | |
| for item in manifest['weights']: | |
| filename = item['path'] | |
| if filename.startswith('transformer/') and quantization != 'all': | |
| if (filename == GGUF_FILENAME) != (quantization == 'q8_0'): | |
| continue | |
| target = path / filename | |
| if not target.is_file() or target.stat().st_size != item['bytes']: | |
| raise ValueError(f'Missing or incomplete weight: {filename}') | |
| if check_hashes: | |
| with target.open('rb') as source: | |
| checksum = hashlib.file_digest(source, 'sha256').hexdigest() | |
| if checksum != item['sha256']: | |
| raise ValueError(f'Checksum mismatch: {filename}') | |
| verified.append(filename) | |
| return {'quantization': quantization, 'weights': verified, 'hashes_checked': check_hashes} | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('path', type=Path) | |
| parser.add_argument('--quantization', choices=['q8_0', 'bf16', 'all'], default='q8_0') | |
| parser.add_argument('--hashes', action='store_true') | |
| args = parser.parse_args() | |
| print(json.dumps(verify_checkpoint(args.path, args.quantization, args.hashes), indent=2)) | |