Instructions to use AbdulElahGwaith/diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AbdulElahGwaith/diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AbdulElahGwaith/diffusers", 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 tests/models/test_models_auto.py from AbdulElahGwaith/diffusers: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/tests/models/test_models_auto.py
- Command line
-
hf download hf://AbdulElahGwaith/diffusers/tests/models/test_models_auto.py
-
curl -L -o test_models_auto.py https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/tests/models/test_models_auto.py
1.44 kB
| import unittest | |
| from unittest.mock import patch | |
| from transformers import CLIPTextModel, LongformerModel | |
| from diffusers.models import AutoModel, UNet2DConditionModel | |
| class TestAutoModel(unittest.TestCase): | |
| def test_load_from_config_diffusers_with_subfolder(self, mock_load_config): | |
| model = AutoModel.from_pretrained("hf-internal-testing/tiny-stable-diffusion-torch", subfolder="unet") | |
| assert isinstance(model, UNet2DConditionModel) | |
| def test_load_from_config_transformers_with_subfolder(self, mock_load_config): | |
| model = AutoModel.from_pretrained("hf-internal-testing/tiny-stable-diffusion-torch", subfolder="text_encoder") | |
| assert isinstance(model, CLIPTextModel) | |
| def test_load_from_config_without_subfolder(self): | |
| model = AutoModel.from_pretrained("hf-internal-testing/tiny-random-longformer") | |
| assert isinstance(model, LongformerModel) | |
| def test_load_from_model_index(self): | |
| model = AutoModel.from_pretrained("hf-internal-testing/tiny-stable-diffusion-torch", subfolder="text_encoder") | |
| assert isinstance(model, CLIPTextModel) | |