sayakpaul HF staff commited on
Commit
3bdc4d3
1 Parent(s): d919967

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -1
README.md CHANGED
@@ -1,4 +1,115 @@
1
  ---
 
2
  tags:
 
 
 
3
  - shap-e
4
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ```