Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
8f40a40
1
Parent(s):
9e3a951
updated
Browse files- README.md +5 -0
- app.py +2 -0
- zero123plus/model.py +12 -4
- zero123plus/pipeline.py +5 -0
README.md
CHANGED
@@ -38,4 +38,9 @@ This application uses:
|
|
38 |
- InstantMesh for high-quality refinement
|
39 |
- ZeroGPU for efficient GPU resource management
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
38 |
- InstantMesh for high-quality refinement
|
39 |
- ZeroGPU for efficient GPU resource management
|
40 |
|
41 |
+
## Implementation Notes
|
42 |
+
|
43 |
+
- PyTorch 2.0.1 compatibility is ensured through a custom patch (torch_patch.py) that enables newer diffusers versions to work with PyTorch 2.0.1 by adding placeholder attributes
|
44 |
+
- Diffusers 0.24.0 is used as it provides the necessary functionality while being compatible with our patching approach
|
45 |
+
|
46 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -7,6 +7,8 @@ from PIL import Image
|
|
7 |
from omegaconf import OmegaConf
|
8 |
from pytorch_lightning import seed_everything
|
9 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
10 |
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
|
11 |
from einops import rearrange
|
12 |
from shap_e.diffusion.sample import sample_latents
|
|
|
7 |
from omegaconf import OmegaConf
|
8 |
from pytorch_lightning import seed_everything
|
9 |
from huggingface_hub import hf_hub_download
|
10 |
+
# Import our torch patch before diffusers
|
11 |
+
import torch_patch
|
12 |
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
|
13 |
from einops import rearrange
|
14 |
from shap_e.diffusion.sample import sample_latents
|
zero123plus/model.py
CHANGED
@@ -1,16 +1,24 @@
|
|
1 |
import os
|
2 |
-
import numpy as np
|
3 |
import torch
|
4 |
import torch.nn as nn
|
|
|
|
|
5 |
import torch.nn.functional as F
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
from tqdm import tqdm
|
8 |
from torchvision.transforms import v2
|
9 |
from torchvision.utils import make_grid, save_image
|
10 |
-
from einops import rearrange
|
11 |
|
12 |
from src.utils.train_util import instantiate_from_config
|
13 |
-
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler, DDPMScheduler, UNet2DConditionModel
|
14 |
from .pipeline import RefOnlyNoisedUNet
|
15 |
|
16 |
|
|
|
1 |
import os
|
|
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
+
import numpy as np
|
5 |
+
from einops import rearrange
|
6 |
import torch.nn.functional as F
|
7 |
+
from PIL import Image
|
8 |
+
from huggingface_hub import hf_hub_download
|
9 |
+
from omegaconf import OmegaConf
|
10 |
+
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
|
11 |
+
|
12 |
+
# Import torch patch before diffusers
|
13 |
+
import sys
|
14 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
15 |
+
import torch_patch
|
16 |
+
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler, DDPMScheduler, UNet2DConditionModel
|
17 |
from tqdm import tqdm
|
18 |
from torchvision.transforms import v2
|
19 |
from torchvision.utils import make_grid, save_image
|
|
|
20 |
|
21 |
from src.utils.train_util import instantiate_from_config
|
|
|
22 |
from .pipeline import RefOnlyNoisedUNet
|
23 |
|
24 |
|
zero123plus/pipeline.py
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
from typing import Any, Dict, Optional
|
|
|
|
|
|
|
|
|
|
|
2 |
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
3 |
from diffusers.schedulers import KarrasDiffusionSchedulers
|
4 |
|
|
|
1 |
from typing import Any, Dict, Optional
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
# Add parent directory to path and import torch patch before diffusers
|
5 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
6 |
+
import torch_patch
|
7 |
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
8 |
from diffusers.schedulers import KarrasDiffusionSchedulers
|
9 |
|