yiyixuxu commited on
Commit
2f6f299
1 Parent(s): 4b31036
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - image-to-image
5
+ - text-to-3d
6
+ - diffusers
7
+ - shap-e
8
+ ---
9
+
10
+ # Shap-E
11
+
12
+ Shap-E introduces a diffusion process that can generate a 3D image from a text prompt. It was introduced in [Shap-E: Generating Conditional 3D Implicit Functions](https://arxiv.org/abs/2305.02463) by Heewoo Jun and Alex Nichol from OpenAI.
13
+
14
+ Original repository of Shap-E can be found here: https://github.com/openai/shap-e.
15
+
16
+ _The authors of Shap-E didn't author this model card. They provide a separate model card [here](https://github.com/openai/shap-e/blob/main/model-card.md)._
17
+
18
+ ## Introduction
19
+
20
+ The abstract of the Shap-E paper:
21
+
22
+ *We present Shap-E, a conditional generative model for 3D assets. Unlike recent work on 3D generative models which produce a single output representation, Shap-E directly generates the parameters of implicit functions that can be rendered as both textured meshes and neural radiance fields. We train Shap-E in two stages: first, we train an encoder that deterministically maps 3D assets into the parameters of an implicit function; second, we train a conditional diffusion model on outputs of the encoder. When trained on a large dataset of paired 3D and text data, our resulting models are capable of generating complex and diverse 3D assets in a matter of seconds. When compared to Point-E, an explicit generative model over point clouds, Shap-E converges faster and reaches comparable or better sample quality despite modeling a higher-dimensional, multi-representation output space. We release model weights, inference code, and samples at [this https URL](https://github.com/openai/shap-e).*
23
+
24
+ ## Released checkpoints
25
+
26
+ The authors released the following checkpoints:
27
+
28
+ * [openai/shap-e](https://hf.co/openai/shap-e): produces a 3D image from a text input prompt
29
+ * [openai/shap-e-img2img](https://hf.co/openai/shap-e-img2img): samples a 3D image from synthetic 2D image
30
+
31
+ ## Usage examples in 🧨 diffusers
32
+
33
+ First make sure you have installed all the dependencies:
34
+
35
+ ```bash
36
+ pip install transformers accelerate -q
37
+ pip install git+https://github.com/huggingface/diffusers@@shap-ee
38
+ ```
39
+
40
+ Once the dependencies are installed, use the code below:
41
+
42
+ ```python
43
+ import torch
44
+ from diffusers import ShapEImg2ImgPipeline
45
+ from diffusers.utils import export_to_gif, load_image
46
+
47
+
48
+ ckpt_id = "openai/shap-e-img2img"
49
+ pipe = ShapEImg2ImgPipeline.from_pretrained(repo).to("cuda")
50
+
51
+ img_url = "https://hf.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi.png"
52
+ image = load_image(img_url)
53
+
54
+
55
+ generator = torch.Generator(device="cuda").manual_seed(0)
56
+ batch_size = 4
57
+ guidance_scale = 3.0
58
+
59
+ images = pipe(
60
+ image,
61
+ num_images_per_prompt=batch_size,
62
+ generator=generator,
63
+ guidance_scale=guidance_scale,
64
+ num_inference_steps=64,
65
+ size=256,
66
+ output_type="pil"
67
+ ).images
68
+
69
+ gif_path = export_to_gif(images, "corgi_sampled_3d.gif")
70
+ ```
71
+
72
+ ## Results
73
+
74
+ <table>
75
+ <tbody>
76
+ <tr>
77
+ <td align="center">
78
+ <img src="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi.png" alt="Reference corgi image in 2D">
79
+ </td>
80
+ <td align="center">
81
+ <img src="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi_sampled_3d.gif" alt="Sampled image in 3D (one)">
82
+ </td align="center">
83
+ <td align="center">
84
+ <img src="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi_sampled_3d_two.gif" alt="Sampled image in 3D (two)">
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td align="center">Reference corgi image in 2D</td>
89
+ <td align="center">Sampled image in 3D (one)</td>
90
+ <td align="center">Sampled image in 3D (two)</td>
91
+ </tr>
92
+ </tr>
93
+ </tbody>
94
+ <table>
95
+
96
+ ## Training details
97
+
98
+ Refer to the [original paper](https://arxiv.org/abs/2305.02463).
99
+
100
+ ## Known limitations and potential biases
101
+
102
+ Refer to the [original model card](https://github.com/openai/shap-e/blob/main/model-card.md).
103
+
104
+ ## Citation
105
+
106
+ ```bibtex
107
+ @misc{jun2023shape,
108
+ title={Shap-E: Generating Conditional 3D Implicit Functions},
109
+ author={Heewoo Jun and Alex Nichol},
110
+ year={2023},
111
+ eprint={2305.02463},
112
+ archivePrefix={arXiv},
113
+ primaryClass={cs.CV}
114
+ }
115
+ ```
image_encoder/model.fp16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4523175837d6342fd2d3ca38ce84912dbc722b556747c883b2842157e9a0f035
3
+ size 606409288
prior/diffusion_pytorch_model.fp16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6d92d12597b298dfb84b32ccfc74a94d2f25d7600f330b39722bd0f0835862e
3
+ size 631964448
renderer/config.json CHANGED
@@ -2,6 +2,11 @@
2
  "_class_name": "ShapERenderer",
3
  "_diffusers_version": "0.18.0.dev0",
4
  "act_fn": "swish",
 
 
 
 
 
5
  "d_hidden": 256,
6
  "d_latent": 1024,
7
  "insert_direction_at": 4,
 
2
  "_class_name": "ShapERenderer",
3
  "_diffusers_version": "0.18.0.dev0",
4
  "act_fn": "swish",
5
+ "background": [
6
+ 255.0,
7
+ 255.0,
8
+ 255.0
9
+ ],
10
  "d_hidden": 256,
11
  "d_latent": 1024,
12
  "insert_direction_at": 4,
renderer/diffusion_pytorch_model.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2b50111f786c3dfca1d14cb1536a761cbc6826923a1f0021a19e156df5e171ee
3
- size 905200536
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:134b0ea32cf69fdb86f4303b6b1910fb5c391e7158a0dd89c91dbe037ebcc67c
3
+ size 905233202
renderer/diffusion_pytorch_model.fp16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:394d52e159447b2bfb944d3bfa4f438180b72ba40644dc4c730282e7a9b62c65
3
+ size 452597858