Friday, December 8, 2023
Google search engine
HomeUncategorizedShow HN: Local implementation of text-to-3D using Shap-E

Show HN: Local implementation of text-to-3D using Shap-E

The code to run shap-e text-to-3d sample code locally.

The original code is available at (

Why I make this project?

One nice thing about being able to run code locally is that 3D models can be generated without an Internet connection.

For this reason, I created this project as a sample for those who want to generate 3D models offline, or for those who are looking for a place to boast their ample GPU power.


I imported the 3D models (.obj) generated by the following prompts into Blender and rendered them:

  • an apple
  • a shark
  • a table

The walls and the floor is blender’s built-in plane object.


OS: Ubuntu 20.04.5 LTS

CPU: Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz

GPU: NVIDIA GeForce RTX 3090

Cuda version: 12.1

pip version: 23.1.2

conda version: 23.5.0


1. Download this project as a zip folder, then unzip it

2. Create a virtual environment using Anaconda, then activate it

conda create -n shap-e python=3.10
conda activate shap-e

3. Change your current directory to unzipped folder

// example
cd shap-e-local-main

4. Install required libraries

pip install -e .
pip install pyyaml ipywidgets fvcore iopath

5. Run to confirm torch is recognizing cuda

If the output of this program looks like this, you are okay to go:

PyTorch is using: cuda  
PyTorch version: 2.0.1+cu117  
Result of tensor operation: tensor([ 8., 15.], device='cuda:0')  

6. Run to check suitable version of pytorch3d

This program output a string (“py310_cu117_pyt201”, for example)

Remember this string.

7. Install pytorch3d library

pip install --no-index --no-cache-dir pytorch3d -f{output string}/download.html

// example
pip install --no-index --no-cache-dir pytorch3d -f

8. Finally, let’s generate a 3D model!

Before running the code below, you can edit to change the input text prompt, batch_size, etc.

This program outputs some .obj files and .ply files according to the batch_size you specified.

9. For those who want to see a preview of generated 3D models..

First install required libraries to display 3D objects.

pip install vedo
pip install open3d

Then, use the commands below to inspect generated files.

(command line argument “filename” is the name of a file except file extension part.

e.g. you type “python example_mesh_0” to inspect “example_mesh_0.ply” file.)

python {filename}
python {filename}

Please make sure that or files and .obj or .ply files are in the same directory.

Read More



Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments