Text-to-Image
Diffusers
TensorBoard
Safetensors
StableDiffusionPipeline
dreambooth
diffusers-training
stable-diffusion
stable-diffusion-diffusers
Instructions to use NadaGh/working with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use NadaGh/working with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("NadaGh/working", dtype=torch.bfloat16, device_map="cuda") prompt = "tst chair" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Download diffusers/tests/models/test_activations.py from NadaGh/working: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/NadaGh/working/resolve/main/diffusers/tests/models/test_activations.py
- Command line
-
hf download hf://NadaGh/working/diffusers/tests/models/test_activations.py
-
curl -L -o test_activations.py https://huggingface.co/NadaGh/working/resolve/main/diffusers/tests/models/test_activations.py
1.87 kB
| import unittest | |
| import torch | |
| from torch import nn | |
| from diffusers.models.activations import get_activation | |
| class ActivationsTests(unittest.TestCase): | |
| def test_swish(self): | |
| act = get_activation("swish") | |
| self.assertIsInstance(act, nn.SiLU) | |
| self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0) | |
| self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20) | |
| def test_silu(self): | |
| act = get_activation("silu") | |
| self.assertIsInstance(act, nn.SiLU) | |
| self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0) | |
| self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20) | |
| def test_mish(self): | |
| act = get_activation("mish") | |
| self.assertIsInstance(act, nn.Mish) | |
| self.assertEqual(act(torch.tensor(-200, dtype=torch.float32)).item(), 0) | |
| self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20) | |
| def test_gelu(self): | |
| act = get_activation("gelu") | |
| self.assertIsInstance(act, nn.GELU) | |
| self.assertEqual(act(torch.tensor(-100, dtype=torch.float32)).item(), 0) | |
| self.assertNotEqual(act(torch.tensor(-1, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(0, dtype=torch.float32)).item(), 0) | |
| self.assertEqual(act(torch.tensor(20, dtype=torch.float32)).item(), 20) | |