Instructions to use recoilme/ra4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use recoilme/ra4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("recoilme/ra4", 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 src/paths.py from recoilme/ra4: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/recoilme/ra4/resolve/main/src/paths.py
- Command line
-
hf download hf://recoilme/ra4/src/paths.py
-
curl -L -o paths.py https://huggingface.co/recoilme/ra4/resolve/main/src/paths.py
1.51 kB
| """Поиск компонентов модели: bundle самодостаточен, локальные папки — фолбэк. | |
| Раскладка bundle (совпадает с конвенцией diffusers): | |
| ra4-218M/ | |
| transformer/ обученное: config.json + safetensors (fp16) | |
| text_encoder/ LongCLIP-L, заморожен | |
| tokenizer/ CLIP BPE | |
| vae/ AsymmetricAutoencoderKL (32 канала, f8/f16) | |
| README.md карточка модели | |
| """ | |
| from __future__ import annotations | |
| from pathlib import Path | |
| def resolve(kind: str, model: Path | str | None = None) -> Path | None: | |
| """`kind` ∈ {transformer, text_encoder, tokenizer, vae}. | |
| 1) `<model>/<kind>`, 2) `<model>` если это уже нужная папка, | |
| 3) локальная `<kind>/` рядом с проектом. | |
| """ | |
| root = Path(model) if model else None | |
| if root is not None: | |
| cand = root / kind | |
| if cand.exists(): | |
| return cand | |
| if root.name == kind and root.exists(): # передали саму папку компонента | |
| return root | |
| if root.is_dir() and kind == "transformer" and (root / "config.json").exists(): | |
| return root # передали саму transformer/ | |
| local = Path(__file__).resolve().parent.parent / kind | |
| return local if local.exists() else (root / kind if root is not None else None) | |