Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
d6502a4
1
Parent(s):
5c79851
updated
Browse files- README.md +3 -3
- app.py +0 -2
- app2.py +1 -1
- requirements.txt +2 -2
- requirements2.txt +253 -0
- torch_patch.py +0 -66
- zero123plus/model.py +0 -4
- zero123plus/pipeline.py +0 -5
README.md
CHANGED
|
@@ -40,8 +40,8 @@ This application uses:
|
|
| 40 |
|
| 41 |
## Implementation Notes
|
| 42 |
|
| 43 |
-
- PyTorch 2.
|
| 44 |
-
-
|
| 45 |
-
-
|
| 46 |
|
| 47 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 40 |
|
| 41 |
## Implementation Notes
|
| 42 |
|
| 43 |
+
- The application uses PyTorch 2.1+ which provides native support for the features required by the latest diffusers library
|
| 44 |
+
- This ensures full compatibility with the latest versions of all dependencies while maintaining ZeroGPU support
|
| 45 |
+
- All components are configured for optimal performance on the ZeroGPU platform
|
| 46 |
|
| 47 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -7,8 +7,6 @@ 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 |
-
# 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
|
|
|
|
| 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
|
app2.py
CHANGED
|
@@ -7,7 +7,7 @@ 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 |
-
|
| 11 |
from einops import rearrange
|
| 12 |
from shap_e.diffusion.sample import sample_latents
|
| 13 |
from shap_e.diffusion.gaussian_diffusion import diffusion_from_config
|
|
|
|
| 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
|
| 13 |
from shap_e.diffusion.gaussian_diffusion import diffusion_from_config
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
torch
|
| 2 |
-
torchvision
|
| 3 |
gradio>=4.13.0,<5.0.0
|
| 4 |
diffusers
|
| 5 |
transformers
|
|
|
|
| 1 |
+
torch>=2.1.0
|
| 2 |
+
torchvision>=0.16.0
|
| 3 |
gradio>=4.13.0,<5.0.0
|
| 4 |
diffusers
|
| 5 |
transformers
|
requirements2.txt
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
absl-py==2.1.0
|
| 2 |
+
accelerate==0.21.0
|
| 3 |
+
aiofiles==23.2.1
|
| 4 |
+
aiohappyeyeballs==2.4.0
|
| 5 |
+
aiohttp==3.10.5
|
| 6 |
+
aiosignal==1.3.1
|
| 7 |
+
altair==5.4.1
|
| 8 |
+
annotated-types==0.7.0
|
| 9 |
+
antlr4-python3-runtime==4.9.3
|
| 10 |
+
anyio==4.4.0
|
| 11 |
+
args==0.1.0
|
| 12 |
+
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1698341106958/work
|
| 13 |
+
async-timeout==4.0.3
|
| 14 |
+
asyncer==0.0.8
|
| 15 |
+
attrs==24.2.0
|
| 16 |
+
beautifulsoup4==4.12.3
|
| 17 |
+
bitsandbytes==0.43.3
|
| 18 |
+
blendertoolbox==0.0.3
|
| 19 |
+
blinker==1.9.0
|
| 20 |
+
blobfile==3.0.0
|
| 21 |
+
bpy==4.0.0
|
| 22 |
+
braceexpand==0.1.7
|
| 23 |
+
cachetools==5.5.0
|
| 24 |
+
certifi==2024.8.30
|
| 25 |
+
charset-normalizer==3.3.2
|
| 26 |
+
-e git+ssh://[email protected]/GaParmar/clean-fid.git@bd44693af04626963af76e94bdb1d4529a76bd11#egg=clean_fid
|
| 27 |
+
click==8.1.7
|
| 28 |
+
clint==0.5.1
|
| 29 |
+
clip @ git+https://github.com/openai/CLIP.git@dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1
|
| 30 |
+
coloredlogs==15.0.1
|
| 31 |
+
comm @ file:///home/conda/feedstock_root/build_artifacts/comm_1710320294760/work
|
| 32 |
+
ConfigArgParse==1.7
|
| 33 |
+
contourpy==1.3.0
|
| 34 |
+
cycler==0.12.1
|
| 35 |
+
Cython==3.0.11
|
| 36 |
+
dash==2.18.2
|
| 37 |
+
dash-core-components==2.0.0
|
| 38 |
+
dash-html-components==2.0.0
|
| 39 |
+
dash-table==5.0.0
|
| 40 |
+
dataclasses-json==0.6.7
|
| 41 |
+
debugpy @ file:///home/conda/feedstock_root/build_artifacts/debugpy_1725269181790/work
|
| 42 |
+
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work
|
| 43 |
+
Deprecated==1.2.14
|
| 44 |
+
diffusers==0.19.3
|
| 45 |
+
dill==0.3.7
|
| 46 |
+
einops==0.8.0
|
| 47 |
+
embedding-reader==1.7.0
|
| 48 |
+
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1720869315914/work
|
| 49 |
+
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1725214404607/work
|
| 50 |
+
fairscale==0.4.13
|
| 51 |
+
fastapi==0.115.9
|
| 52 |
+
fastjsonschema==2.21.1
|
| 53 |
+
ffmpy==0.4.0
|
| 54 |
+
filelock==3.16.0
|
| 55 |
+
filetype==1.2.0
|
| 56 |
+
fire==0.7.0
|
| 57 |
+
Flask==3.0.3
|
| 58 |
+
flatbuffers==24.3.25
|
| 59 |
+
fonttools==4.53.1
|
| 60 |
+
frozenlist==1.4.1
|
| 61 |
+
fsspec==2023.10.0
|
| 62 |
+
ftfy==6.3.0
|
| 63 |
+
gdown==5.2.0
|
| 64 |
+
GPUtil==1.4.0
|
| 65 |
+
gradio==3.50.0
|
| 66 |
+
gradio_client==0.6.1
|
| 67 |
+
groovy==0.1.2
|
| 68 |
+
grpcio==1.66.1
|
| 69 |
+
h11==0.14.0
|
| 70 |
+
-e git+https://github.com/tgxs002/HPSv2.git@866735ecaae999fa714bd9edfa05aa2672669ee3#egg=hpsv2
|
| 71 |
+
httpcore==1.0.5
|
| 72 |
+
httpx==0.27.2
|
| 73 |
+
huggingface-hub==0.25.0
|
| 74 |
+
humanfriendly==10.0
|
| 75 |
+
humanize==4.11.0
|
| 76 |
+
idna==3.8
|
| 77 |
+
image-reward==1.5
|
| 78 |
+
imageio==2.35.1
|
| 79 |
+
imageio-ffmpeg==0.5.1
|
| 80 |
+
importlib_metadata==8.4.0
|
| 81 |
+
importlib_resources==6.4.5
|
| 82 |
+
iniconfig==2.0.0
|
| 83 |
+
inquirerpy==0.3.4
|
| 84 |
+
iopath==0.1.10
|
| 85 |
+
ipykernel @ file:///home/conda/feedstock_root/build_artifacts/ipykernel_1719845459717/work
|
| 86 |
+
ipympl==0.9.4
|
| 87 |
+
ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1725050136642/work
|
| 88 |
+
ipython-genutils==0.2.0
|
| 89 |
+
ipywidgets==8.1.5
|
| 90 |
+
itsdangerous==2.2.0
|
| 91 |
+
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1696326070614/work
|
| 92 |
+
Jinja2==3.1.4
|
| 93 |
+
joblib==1.4.2
|
| 94 |
+
jsonschema==4.23.0
|
| 95 |
+
jsonschema-specifications==2023.12.1
|
| 96 |
+
jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1726610684920/work
|
| 97 |
+
jupyter_core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1710257277185/work
|
| 98 |
+
jupyterlab_widgets==3.0.13
|
| 99 |
+
kiui==0.2.13
|
| 100 |
+
kiwisolver==1.4.7
|
| 101 |
+
lazy_loader==0.4
|
| 102 |
+
lightning-utilities==0.11.7
|
| 103 |
+
llvmlite==0.43.0
|
| 104 |
+
loguru==0.7.2
|
| 105 |
+
lxml==5.3.0
|
| 106 |
+
Markdown==3.7
|
| 107 |
+
markdown-it-py==3.0.0
|
| 108 |
+
MarkupSafe==2.1.5
|
| 109 |
+
marshmallow==3.22.0
|
| 110 |
+
matplotlib==3.9.2
|
| 111 |
+
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1713250518406/work
|
| 112 |
+
mdurl==0.1.2
|
| 113 |
+
mmh3==5.0.1
|
| 114 |
+
mpmath==1.3.0
|
| 115 |
+
multidict==6.1.0
|
| 116 |
+
multiprocess==0.70.15
|
| 117 |
+
mypy-extensions==1.0.0
|
| 118 |
+
narwhals==1.6.4
|
| 119 |
+
nbformat==5.10.4
|
| 120 |
+
nest_asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1705850609492/work
|
| 121 |
+
networkx==3.3
|
| 122 |
+
ninja==1.11.1.1
|
| 123 |
+
numba==0.60.0
|
| 124 |
+
numpy==1.26.4
|
| 125 |
+
nvdiffrast @ git+https://github.com/NVlabs/nvdiffrast/@c5caf7bdb8a2448acc491a9faa47753972edd380
|
| 126 |
+
nvidia-cublas-cu12==12.1.3.1
|
| 127 |
+
nvidia-cuda-cupti-cu12==12.1.105
|
| 128 |
+
nvidia-cuda-nvrtc-cu12==12.1.105
|
| 129 |
+
nvidia-cuda-runtime-cu12==12.1.105
|
| 130 |
+
nvidia-cudnn-cu12==9.1.0.70
|
| 131 |
+
nvidia-cufft-cu12==11.0.2.54
|
| 132 |
+
nvidia-curand-cu12==10.3.2.106
|
| 133 |
+
nvidia-cusolver-cu12==11.4.5.107
|
| 134 |
+
nvidia-cusparse-cu12==12.1.0.106
|
| 135 |
+
nvidia-ml-py==12.535.161
|
| 136 |
+
nvidia-nccl-cu12==2.20.5
|
| 137 |
+
nvidia-nvjitlink-cu12==12.6.68
|
| 138 |
+
nvidia-nvtx-cu12==12.1.105
|
| 139 |
+
nvitop==1.3.2
|
| 140 |
+
objaverse==0.1.7
|
| 141 |
+
objprint==0.2.3
|
| 142 |
+
omegaconf==2.3.0
|
| 143 |
+
onnxruntime==1.19.2
|
| 144 |
+
open3d==0.19.0
|
| 145 |
+
open_clip_torch==2.30.0
|
| 146 |
+
opencv-python-headless==4.10.0.84
|
| 147 |
+
OpenEXR==3.3.2
|
| 148 |
+
orjson==3.10.7
|
| 149 |
+
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1718189413536/work
|
| 150 |
+
pandas==2.2.2
|
| 151 |
+
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1712320355065/work
|
| 152 |
+
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1706113125309/work
|
| 153 |
+
pfzy==0.3.4
|
| 154 |
+
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
|
| 155 |
+
pillow==10.4.0
|
| 156 |
+
platformdirs==4.3.2
|
| 157 |
+
plotly==5.24.1
|
| 158 |
+
pluggy==1.5.0
|
| 159 |
+
plyfile==1.1
|
| 160 |
+
pooch==1.8.2
|
| 161 |
+
portalocker==2.10.1
|
| 162 |
+
prompt_toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1718047967974/work
|
| 163 |
+
protobuf==3.20.3
|
| 164 |
+
psutil @ file:///home/conda/feedstock_root/build_artifacts/psutil_1725737838492/work
|
| 165 |
+
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
|
| 166 |
+
pure_eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1721585709575/work
|
| 167 |
+
pyarrow==15.0.2
|
| 168 |
+
pyarrow-hotfix==0.6
|
| 169 |
+
pycryptodomex==3.20.0
|
| 170 |
+
pydantic==2.9.1
|
| 171 |
+
pydantic_core==2.23.3
|
| 172 |
+
pydub==0.25.1
|
| 173 |
+
pygltflib==1.16.2
|
| 174 |
+
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1714846767233/work
|
| 175 |
+
PyMatting==1.1.12
|
| 176 |
+
PyMCubes==0.1.6
|
| 177 |
+
pyparsing==3.1.4
|
| 178 |
+
pyquaternion==0.9.9
|
| 179 |
+
PySocks==1.7.1
|
| 180 |
+
pytest==7.2.0
|
| 181 |
+
pytest-split==0.8.0
|
| 182 |
+
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1709299778482/work
|
| 183 |
+
python-multipart==0.0.20
|
| 184 |
+
-e git+ssh://[email protected]/mseitzer/pytorch-fid.git@b9c18118d082cbd263c1b8963fc4221dc1cbb659#egg=pytorch_fid
|
| 185 |
+
pytorch-lightning==2.1.2
|
| 186 |
+
pytorch3d @ git+https://github.com/facebookresearch/pytorch3d.git@fca83e6369e62de2736763372a2de949d56d5a74
|
| 187 |
+
pytz==2024.1
|
| 188 |
+
PyYAML==6.0.2
|
| 189 |
+
pyzmq @ file:///home/conda/feedstock_root/build_artifacts/pyzmq_1725430379702/work
|
| 190 |
+
referencing==0.35.1
|
| 191 |
+
regex==2024.7.24
|
| 192 |
+
rembg==2.0.59
|
| 193 |
+
requests==2.32.3
|
| 194 |
+
retrying==1.3.4
|
| 195 |
+
rich==13.9.4
|
| 196 |
+
rpds-py==0.20.0
|
| 197 |
+
ruff==0.9.9
|
| 198 |
+
safehttpx==0.1.6
|
| 199 |
+
safetensors==0.4.5
|
| 200 |
+
scikit-image==0.24.0
|
| 201 |
+
scikit-learn==1.6.1
|
| 202 |
+
scipy==1.14.1
|
| 203 |
+
seaborn==0.13.2
|
| 204 |
+
semantic-version==2.10.0
|
| 205 |
+
sentencepiece==0.2.0
|
| 206 |
+
-e git+ssh://[email protected]/Fortunanto/shap-d-edit.git@f58bede0bf8b32ddda9d69af1df15ecc6b8912c2#egg=shap_e
|
| 207 |
+
shellingham==1.5.4
|
| 208 |
+
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
|
| 209 |
+
sniffio==1.3.1
|
| 210 |
+
soupsieve==2.6
|
| 211 |
+
stack-data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work
|
| 212 |
+
starlette==0.45.3
|
| 213 |
+
sympy==1.13.2
|
| 214 |
+
tenacity==9.0.0
|
| 215 |
+
tensorboard==2.17.1
|
| 216 |
+
tensorboard-data-server==0.7.2
|
| 217 |
+
termcolor==2.4.0
|
| 218 |
+
threadpoolctl==3.5.0
|
| 219 |
+
tifffile==2024.8.30
|
| 220 |
+
timm==0.6.13
|
| 221 |
+
tokenizers==0.13.3
|
| 222 |
+
tomli==2.1.0
|
| 223 |
+
tomlkit==0.13.2
|
| 224 |
+
torch==2.4.1
|
| 225 |
+
torchaudio==2.4.1
|
| 226 |
+
torchmetrics==1.4.1
|
| 227 |
+
torchvision==0.19.1
|
| 228 |
+
tornado @ file:///home/conda/feedstock_root/build_artifacts/tornado_1724960687225/work
|
| 229 |
+
tqdm==4.66.5
|
| 230 |
+
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1713535121073/work
|
| 231 |
+
transformers==4.30.2
|
| 232 |
+
trimesh==4.4.9
|
| 233 |
+
triton==3.0.0
|
| 234 |
+
typer==0.15.2
|
| 235 |
+
typing-inspect==0.9.0
|
| 236 |
+
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1717802530399/work
|
| 237 |
+
tzdata==2024.1
|
| 238 |
+
urllib3==2.2.2
|
| 239 |
+
uvicorn==0.30.6
|
| 240 |
+
varname==0.13.3
|
| 241 |
+
watchdog==5.0.3
|
| 242 |
+
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1704731205417/work
|
| 243 |
+
webdataset==0.2.100
|
| 244 |
+
websockets==11.0.3
|
| 245 |
+
Werkzeug==3.0.4
|
| 246 |
+
widgetsnbextension==4.0.13
|
| 247 |
+
wrapt==1.16.0
|
| 248 |
+
xatlas==0.0.9
|
| 249 |
+
xxhash==3.5.0
|
| 250 |
+
yarl==1.11.1
|
| 251 |
+
-e git+ssh://[email protected]/huanngzh/render-toolbox.git@bae8224d09a4aa2302b7e3cd3622079b84e5d193#egg=your_package
|
| 252 |
+
zipp==3.20.1
|
| 253 |
+
zstandard==0.23.0
|
torch_patch.py
DELETED
|
@@ -1,66 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Patch for torch module to make it compatible with newer diffusers versions
|
| 3 |
-
while using PyTorch 2.0.1
|
| 4 |
-
"""
|
| 5 |
-
import torch
|
| 6 |
-
import sys
|
| 7 |
-
import warnings
|
| 8 |
-
import types
|
| 9 |
-
import functools
|
| 10 |
-
|
| 11 |
-
# Check if the attributes already exist
|
| 12 |
-
if not hasattr(torch, 'float8_e4m3fn'):
|
| 13 |
-
# Add missing attributes for compatibility
|
| 14 |
-
# These won't actually function, but they'll allow imports to succeed
|
| 15 |
-
torch.float8_e4m3fn = torch.float16 # Use float16 as a placeholder type
|
| 16 |
-
warnings.warn(
|
| 17 |
-
"Added placeholder for torch.float8_e4m3fn. Actual 8-bit operations won't work, "
|
| 18 |
-
"but imports should succeed. Using PyTorch 2.0.1 with newer diffusers."
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
if not hasattr(torch, 'float8_e5m2'):
|
| 22 |
-
torch.float8_e5m2 = torch.float16 # Use float16 as a placeholder type
|
| 23 |
-
|
| 24 |
-
# Add other missing torch types that might be referenced
|
| 25 |
-
for type_name in ['bfloat16', 'bfloat8', 'float8_e4m3fnuz']:
|
| 26 |
-
if not hasattr(torch, type_name):
|
| 27 |
-
setattr(torch, type_name, torch.float16)
|
| 28 |
-
|
| 29 |
-
# Create a placeholder for torch._dynamo if it doesn't exist
|
| 30 |
-
if not hasattr(torch, '_dynamo'):
|
| 31 |
-
torch._dynamo = types.ModuleType('torch._dynamo')
|
| 32 |
-
sys.modules['torch._dynamo'] = torch._dynamo
|
| 33 |
-
|
| 34 |
-
# Add common attributes/functions used by torch._dynamo
|
| 35 |
-
torch._dynamo.config = types.SimpleNamespace(suppress_errors=True)
|
| 36 |
-
torch._dynamo.optimize = lambda *args, **kwargs: lambda f: f
|
| 37 |
-
torch._dynamo.disable = lambda: None
|
| 38 |
-
torch._dynamo.reset_repro_cache = lambda: None
|
| 39 |
-
|
| 40 |
-
# Add torch.compile if it doesn't exist
|
| 41 |
-
if not hasattr(torch, 'compile'):
|
| 42 |
-
# Just return the function unchanged
|
| 43 |
-
torch.compile = lambda fn, **kwargs: fn
|
| 44 |
-
|
| 45 |
-
# Create a placeholder for torch.cuda.amp if it doesn't exist
|
| 46 |
-
if not hasattr(torch.cuda, 'amp'):
|
| 47 |
-
torch.cuda.amp = types.ModuleType('torch.cuda.amp')
|
| 48 |
-
sys.modules['torch.cuda.amp'] = torch.cuda.amp
|
| 49 |
-
|
| 50 |
-
# Mock autocast
|
| 51 |
-
class MockAutocast:
|
| 52 |
-
def __init__(self, *args, **kwargs):
|
| 53 |
-
pass
|
| 54 |
-
def __enter__(self):
|
| 55 |
-
return self
|
| 56 |
-
def __exit__(self, *args):
|
| 57 |
-
pass
|
| 58 |
-
def __call__(self, func):
|
| 59 |
-
@functools.wraps(func)
|
| 60 |
-
def wrapper(*args, **kwargs):
|
| 61 |
-
return func(*args, **kwargs)
|
| 62 |
-
return wrapper
|
| 63 |
-
|
| 64 |
-
torch.cuda.amp.autocast = MockAutocast
|
| 65 |
-
|
| 66 |
-
print("PyTorch patched for compatibility with newer diffusers - using latest diffusers with PyTorch 2.0.1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zero123plus/model.py
CHANGED
|
@@ -9,10 +9,6 @@ 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
|
|
|
|
| 9 |
from omegaconf import OmegaConf
|
| 10 |
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler, DDPMScheduler, UNet2DConditionModel
|
| 13 |
from tqdm import tqdm
|
| 14 |
from torchvision.transforms import v2
|
zero123plus/pipeline.py
CHANGED
|
@@ -1,9 +1,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 |
|
|
|
|
| 1 |
from typing import Any, Dict, Optional
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
| 3 |
from diffusers.schedulers import KarrasDiffusionSchedulers
|
| 4 |
|