Instructions to use hugaagg/IR_expeiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hugaagg/IR_expeiment with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("hugaagg/IR_expeiment", 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 PART1/CodeFormer/basicsr/models/__init__.py from hugaagg/IR_expeiment: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/hugaagg/IR_expeiment/resolve/main/PART1/CodeFormer/basicsr/models/__init__.py
- Command line
-
hf download hf://hugaagg/IR_expeiment/PART1/CodeFormer/basicsr/models/__init__.py
-
curl -L -o __init__.py https://huggingface.co/hugaagg/IR_expeiment/resolve/main/PART1/CodeFormer/basicsr/models/__init__.py
1.04 kB
| import importlib | |
| from copy import deepcopy | |
| from os import path as osp | |
| from basicsr.utils import get_root_logger, scandir | |
| from basicsr.utils.registry import MODEL_REGISTRY | |
| __all__ = ['build_model'] | |
| # automatically scan and import model modules for registry | |
| # scan all the files under the 'models' folder and collect files ending with | |
| # '_model.py' | |
| model_folder = osp.dirname(osp.abspath(__file__)) | |
| model_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(model_folder) if v.endswith('_model.py')] | |
| # import all the model modules | |
| _model_modules = [importlib.import_module(f'basicsr.models.{file_name}') for file_name in model_filenames] | |
| def build_model(opt): | |
| """Build model from options. | |
| Args: | |
| opt (dict): Configuration. It must constain: | |
| model_type (str): Model type. | |
| """ | |
| opt = deepcopy(opt) | |
| model = MODEL_REGISTRY.get(opt['model_type'])(opt) | |
| logger = get_root_logger() | |
| logger.info(f'Model [{model.__class__.__name__}] is created.') | |
| return model | |