3D generation subnet provides a platform to democratize 3D content creation, ultimately allowing anyone to create virtual worlds, games and AR/VR/XR experiences. This subnet leverages the existing fragmented and diverse landscape of Open Source 3D generative models ranging from Gaussian Splatting, Neural Radiance Fields, 3D Diffusion Models and Point-Cloud approaches to facilitate innovation - ideal for decentralized incentive-based networks via Bittensor. This subnet aims to kickstart the next revolution in gaming around AI native games, ultimately leveraging the broader Bittensor ecosystem to facilitate experiences in which assets, voice and sound are all generated at runtime. This would effectively allow a creative individual without any coding or game-dev experience to simply describe the game they want to create and have it manifested before them in real time.
The project is divided into three key modules, each designed to perform specific tasks within our 3D content generation and validation framework:
Generation Module(generation): Central to 3D content creation, compatible with miner neurons but can also be used independently for development and testing.
Neurons Module (neurons): This module contains the neuron entrypoints for miners and validators. Miners call the RPC endpoints in the mining module to generate images. Validators retrieve and validate generated images. This module handles running the Bittensor subnet protocols and workflows.
Validation Module (validation): Dedicated to ensuring the quality and integrity of 3D content. Like the mining module, it is designed for tandem operation with validator neurons or standalone use for thorough testing and quality checks.
Our recommended setup aligns with RunPod 1 x RTX 4090 specs:
Minimal setup aligns with RunPod 1 x L4 specs:
Our code is compatible across various operating systems, yet it has undergone most of its testing on Debian 11, Ubuntu 20 and Arch Linux. The most rigorous testing environment used is the Deep Learning VM Image, which includes pre-installed ML frameworks and tools essential for development.
NOTE: the linux image should come with pytorch 2.1+ and CUDA 12.1.1 otherwise you might have problems with running miner or validator pipelines.
For optimal environment setup:
conda_env_*.yml files for package details, and use requirements.txt. Utilizing a virtual environment is highly advised for dependency management.To manage application processes:
By running a miner on this subnet you agree that you have obtained all licenses, rights and consents required to use, reproduce, modify, display, distribute and make available your submitted results to this subnet and its end users.
To operate the miner, the miner neuron and generation endpoints must be initiated. While currently supporting a single generation endpoint, future updates are intended to allow a miner to utilize multiple generation endpoints simultaneously.
Set up the environment by navigating to the directory and running the setup script:
cd three-gen-subnet/generation
./setup_env.sh
This script creates a Conda environment three-gen-mining, installs dependencies, and sets up a PM2 configuration file (generation.config.js).
After optional modifications to generation.config.js, initiate it using PM2:
pm2 start generation.config.js
To verify the endpoint's functionality generate a test video:
curl -d "prompt=pink bicycle" -X POST http://127.0.0.1:8093/generate_video/ > video.mp4
Ensure wallet registration as per the official bittensor guide.
Prepare the neuron by executing the setup script in the neurons directory:
cd three-gen-subnet/neurons
./setup_env.sh
This script generates a Conda environment three-gen-neurons, installs required dependencies, and prepares miner.config.js for PM2 configuration.
Update miner.config.js with wallet information and ports, then execute with PM2:
pm2 start miner.config.js
Key Aspects of Operating a Validator:
Set up the environment by navigating to the directory and running the setup script:
cd three-gen-subnet/validation
./setup_env.sh
This script creates a Conda environment three-gen-validation, installs dependencies, and sets up a PM2 configuration file (validation.config.js).
After optional modifications to validation.config.js, initiate it using PM2:
pm2 start validation.config.js
Security considerations: Run validation endpoint behind the firewall (close the validation endpoint port).
Ensure wallet registration as per the official bittensor guide.
Prepare the neuron by executing the setup script in the neurons directory:
cd three-gen-subnet/neurons
./setup_env.sh
This script generates a Conda environment three-gen-neurons, installs required dependencies, and prepares validator.config.js for PM2 configuration.
Update validator.config.js with wallet information and ports, then execute with PM2:
pm2 start validator.config.js
Validator must serve the axon and the port must be opened. You can check the port using nc.
nc -vz [Your Validator IP] [Port]
You can also test the validator using the mock script. Navigate to the mocks folder and run
PYTHONPATH=$PWD/.. python mock_miner.py --subtensor.network finney --netuid 17 --wallet.name default --wallet.hotkey default --logging.trace
Our subnet supports prompt generation from two main sources: organic traffic via Public API
and continuously updated datasets. By default, it regularly fetches new batches of prompts from our service.
For real-time prompt generation, we currently utilize two different LLM models:
llama3-8b-instruct and gemma-1.1-7b-instruct.
To ensure suitability for 3D generation, our system employs a carefully tailored input prompt-instruction. This instruction forces the LLM to select objects for prompt generation from one of the 13 object categories identified based on our industry knowledge and research of gaming asset store trends. These selections can be updated in the future to better align with more specific datasets or marketplace curation.
To achieve true decentralization, you can switch to running the prompt generation locally and change the
--dataset.prompter.endpoint parameter.
Our prompter solution consists of two services: the generator and the collector.
Multiple instances of prompt generators continuously produce small batches of prompts and send them to the collector service. You can and should launch multiple generator services to maintain a robust and dynamic system.
To set up the prompt generators:
For more details and to get started with prompt generators, visit the following URL:
The prompt collector accumulates prompts from multiple generators and serves fresh large batches of prompts to validators upon request. Validators fetch these batches every hour by default, but this interval can be customized.
To set up the prompt collector:
For more details and to get started with the prompt collector, visit the following URL:
This repository contains scripts for generating 3D models from text descriptions using TRELLIS.
Hardware Requirements:
CUDA Requirements:
System Dependencies (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y \
libgl1-mesa-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libglew-dev \
libglfw3-dev \
libglvnd-dev \
pkg-config \
xvfb
There are three ways to set up the environment:
We provide three separate conda environments for different components:
conda env create -f environment_trellis.yml
conda activate trellis_new
conda env create -f environment_mining.yml
conda activate three-gen-mining
conda env create -f environment_neurons.yml
conda activate three-gen-neurons
conda create -n trellis python=3.10
conda activate trellis
# Install PyTorch with CUDA support
conda install -c pytorch pytorch==2.4.0 torchvision==0.19.0 pytorch-cuda=11.8 -c pytorch -c nvidia
# Install required compilers
conda install -c conda-forge gcc=12 gxx=12
# Install Kaolin
git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
cd kaolin
git checkout v0.17.0 # Match your desired version
pip install -r tools/requirements.txt
python setup.py develop
cd ..
# Install nvdiffrast
git clone https://github.com/NVlabs/nvdiffrast
cd nvdiffrast
pip install ninja
pip install .
or alternatively for nvdiffrast:
pip install git+https://github.com/NVlabs/nvdiffrast.git
export CC=$(which gcc)
export CXX=$(which g++)
pip install -r requirements.txt
# Install mip-splatting and diff-gaussian-rasterization
git clone https://github.com/autonomousvision/mip-splatting --recursive /tmp/extensions/mip-splatting/
pip install /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/
conda activate trellis_new
git clone --recurse-submodules https://github.com/microsoft/TRELLIS.git
cd TRELLIS
./setup.sh --basic --xformers --flash-attn --diffoctreerast --spconv --mipgaussian --kaolin --nvdiffrast
Required environment variables:
export SPCONV_ALGO=native
export ATTN_BACKEND=xformers
export CC=$(which gcc)
export CXX=$(which g++)
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Optional environment variables:
export CUDA_VISIBLE_DEVICES=0 # Specify GPU device
export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 # Help with OOM errors
Run the generation script:
python test_trellis.py
The script will generate a 3D model from the prompt "a blue monkey sitting on temple" and save the outputs in the following formats:
outputs/blue_monkey_gaussian.plyoutputs/blue_monkey.glboutputs/preview_gaussian.mp4 (Gaussian splatting preview)outputs/preview_rf.mp4 (Radiance field preview)outputs/preview_mesh.mp4 (Mesh preview)CUDA Version Mismatch
RuntimeError: CUDA error: no kernel image is available for execution on the device
Solution: Make sure your NVIDIA drivers support your CUDA version. For CUDA 11.8:
# Check NVIDIA driver version
nvidia-smi
# If needed, install correct driver
sudo apt install nvidia-driver-525
OpenGL Issues
ImportError: libGL.so.1: cannot open shared object file
Solution: Reinstall OpenGL libraries:
sudo apt-get install --reinstall libgl1-mesa-glx
Kaolin Installation Issues If Kaolin fails to install, try:
conda install -c conda-forge pytorch-cuda=11.8
pip uninstall kaolin
pip install kaolin==0.13.0
Flash Attention Issues If you encounter flash attention errors, set this environment variable:
export ATTN_BACKEND=xformers
| Component | Version | Compatible With |
|---|---|---|
| PyTorch | 2.4.0 | CUDA 11.8/12.1 |
| Kaolin | 0.13.0 | PyTorch 2.4.0 |
| nvdiffrast | latest | CUDA 11.8/12.1 |
| gcc/g++ | 12.x | All |
Monitor GPU usage during generation:
watch -n 1 nvidia-smi
Monitor CPU and memory:
htop
When backing up or moving to a new instance, save these files:
test_trellis.pyserve_trellis.pyenvironment_trellis.ymlenvironment_mining.ymlenvironment_neurons.ymlrequirements.txtsetup_requirements.txtThe conda environments themselves should be recreated rather than backed up.
# install dependencies
conda create -n primx python=3.9
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source /home/mbhat/miniconda/bin/activate
conda activate primx
nvcc --version
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 -c pytorch -c nvidia
# requires xformer for efficient attention
conda install xformers::xformers
cd 3DTopia-XL
# install other dependencies
pip install -r requirements.txt
pip install git+https://github.com/NVlabs/nvdiffrast
pip install "numpy<2"
pip install onnxruntime
export CUDA_LAUNCH_BLOCKING=1 # Synchronize CUDA errors
export TORCH_USE_CUDA_DSA=1 # Enable device-side assertions
apt-get install libeigen3-dev # For Ubuntu/Debian
git clone https://github.com/ashawkey/cubvh
If needed: Then modify cubvh/setup.py to use system Eigen headers instead of the submodule:
# kill -9 35563 && rm /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock
# In setup.py, change:
include_dirs=[
os.path.join(_src_path, 'include'),
os.path.join(_src_path, 'third_party', 'eigen'), # ← Remove this line
'/usr/include/eigen3', # ← Add this line
],
Then:
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install ninja # Critical for compiling extensions
Then:
apt-get update && apt-get install -y libeigen3-dev
cd cubvh
git submodule update --init --recursive
rm -rf third_party/eigen
git clone https://gitlab.com/libeigen/eigen.git third_party/eigen
cd third_party/eigen
git checkout 3.4.0 # Use a stable version
cd ../..
# Copy eigen headers to torch include directory
mkdir -p /home/mbhat/miniconda/envs/3dtopia/lib/python3.9/site-packages/torch/include/eigen
cp -r third_party/eigen/Eigen /home/mbhat/miniconda/envs/3dtopia/lib/python3.9/site-packages/torch/include/eigen/
# Install with correct CUDA architecture flags
# For RTX 4090 (8.9), RTX 3090 (8.6), or A6000 (8.6)
export TORCH_CUDA_ARCH_LIST="8.6" # Use 8.6 for most recent NVIDIA GPUs
export FORCE_CUDA=1
pip install . --verbose
If you encounter compilation errors, try these troubleshooting steps:
nvidia-smi
pip install pysdf
# Install Eigen from conda
conda install -c conda-forge eigen
# Then try installing cubvh again with specific flags
export EIGEN_INCLUDE_DIR=/home/mbhat/miniconda/envs/3dtopia/include/eigen3
export FORCE_CUDA=1
pip install . --verbose
then the main:
cd 3DTopia-XL
bash install.sh
download important files:
mkdir pretrained && cd pretrained
# download DiT
wget https://huggingface.co/FrozenBurning/3DTopia-XL/resolve/main/model_sview_dit_fp16.pt
# download VAE
wget https://huggingface.co/FrozenBurning/3DTopia-XL/resolve/main/model_vae_fp16.pt
mkdir pretrained
mv model_* pretrained/
cd ..
install inference files:
export CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub
conda install pytorch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 pytorch-cuda=12.1 -c pytorch -c nvidia
conda install -c iopath iopath
conda install -c bottler nvidiacub
conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python
git clone --recursive https://github.com/facebookresearch/pytorch3d
#Normal:
cd pytorch3d
python setup.py clean
python setup.py install # Use --user if not in a virtual env
#For A6000:
CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="8.6" pip install -e .
#or for all together:
cd /home/mbhat/three-gen-subnet-trellis/3DTopia-XL/pytorch3d && CUDA_HOME=/usr/local/cuda-11.8 CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="8.6" pip install -e .
Run inference:
python inference.py ./configs/inference_dit.yml
git clone https://github.com/VAST-AI-Research/DetailGen3D --recursive
conda create -n trellis_detail python=3.10 numpy=1.24.3 scipy=1.10.1 -y
conda activate trellis_detail && pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 && pip install -r requirements.txt && pip install -r DetailGen3D/requirements.txt
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9
export CUDA_HOME=/usr/local/cuda-11.8
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
pip install numpy==1.24
conda install pytorch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 pytorch-cuda=11.8 -c pytorch -c nvidia
git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
cd kaolin
pip install Cython>=0.29.37
pip install -r tools/requirements.txt
pip install scipy==1.15.3
python setup.py develop
pip install ninja
pip install git+https://github.com/NVlabs/nvdiffrast
pip install .
cd .
pip install /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/
pip uninstall -y torch-cluster
nvcc --version
pip uninstall torch-cluster
FORCE_CUDA=1 pip install --no-cache-dir --verbose torch-cluster
cd TRELLIS/
./setup.sh --basic --xformers --flash-attn --diffoctreerast --spconv --mipgaussian
cd ..
pip install huggingface-hub
huggingface-cli login
export SPCONV_ALGO=native
export ATTN_BACKEND=xformers
export CC=$(which gcc)
export CXX=$(which g++)
pip install accelerate
huggingface-cli download VAST-AI/DetailGen3D --local-dir detailgen3d --local-dir-use-symlinks False
cp DetailGen3D/detailgen3d detailgen3d/ -r
python test_trellis_detail.py
pip uninstall -y numpy scipy trimesh scikit-image && pip install numpy==1.24.3 && pip install scipy==1.10.1 && pip install trimesh scikit-image
conda env create -f requirements.yml
conda activate 3dtopia-first
python -u sample_stage1.py --text "a robot" --samples 1 --sampler ddim --steps 200 --cfg_scale 7.5 --seed 0
source /home/mbhat/miniconda/bin/activate
conda create -n 3dtopia-second python=3.9 -y
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9
export CUDA_HOME=/usr/local/cuda-11.8
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export TORCH_CUDA_ARCH_LIST="8.6" # Use 8.6 for most recent NVIDIA GPUs
export FORCE_CUDA=1
mkdir -p /home/mbhat/miniconda/envs/3dtopia-second/bin && ln -s /usr/local/cuda-11.3/bin/nvcc /home/mbhat/miniconda/envs/3dtopia-second/bin/nvcc
conda install -c conda-forge cudatoolkit=11.8
conda install -c conda-forge eigen
pip install pysdf
conda activate 3dtopia-second
conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=11.8 -c pytorch -c nvidia
git clone https://github.com/3DTopia/threefiner
cd threefiner
export CUDA_HOME=/usr/local/cuda-11.8 && export PATH=/usr/local/cuda-11.8/bin:$PATH && export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH && cd /home/mbhat/three-gen-subnet-trellis/3DTopia/threefiner && pip install .
pip install git+https://github.com/NVlabs/nvdiffrast
pip install --no-cache-dir --verbose git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
apt-get update && apt-get install -y libegl1-mesa-dev
apt-get update && apt-get install -y xvfb && Xvfb :1 -screen 0 1024x768x24 & export DISPLAY=:1 && nvidia-smi -pm 1
threefiner sd --mesh results/default/stage1/a_robot_0_0.ply --prompt "a robot" --text_dir --front_dir='-y' --outdir results/default/stage2/ --save a_robot_0_0_sd.glb --force_cuda_rast
huggingface-cli login
or export HF_TOKEN=
threefiner if2 --mesh results/default/stage2/a_robot_0_0_sd.glb --prompt "a robot" --outdir results/default/stage2/ --save a_robot_0_0_if2.glb --force_cuda_rast
Install trellis-text
conda create -n trellis_text python=3.10
conda activate trellis_text
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.1 -c pytorch -c nvidia
export CUDA_HOME=/usr/local/cuda-12.1
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export FORCE_CUDA=1
pip install -r requirements.txt
git clone --recurse-submodules https://github.com/microsoft/TRELLIS.git
cd TRELLIS
cp trellis ../TRELLIS-TextImagen3D
./setup.sh --basic --kaolin
export HF_TOKEN=
huggingface-cli login
Note: Make sure all environment variables are properly set and the CUDA toolkit is correctly installed before running inference.
TRELLIS is licensed under Microsoft Research License.
Python
69.8%
Jupyter Notebook
17.4%
C++
6.5%
Cuda
4.5%
C
1.0%
3D generation subnet provides a platform to democratize 3D content creation, ultimately allowing anyone to create virtual worlds, games and AR/VR/XR experiences. This subnet leverages the existing fragmented and diverse landscape of Open Source 3D generative models ranging from Gaussian Splatting, Neural Radiance Fields, 3D Diffusion Models and Point-Cloud approaches to facilitate innovation - ideal for decentralized incentive-based networks via Bittensor. This subnet aims to kickstart the next revolution in gaming around AI native games, ultimately leveraging the broader Bittensor ecosystem to facilitate experiences in which assets, voice and sound are all generated at runtime. This would effectively allow a creative individual without any coding or game-dev experience to simply describe the game they want to create and have it manifested before them in real time.
The project is divided into three key modules, each designed to perform specific tasks within our 3D content generation and validation framework:
Generation Module(generation): Central to 3D content creation, compatible with miner neurons but can also be used independently for development and testing.
Neurons Module (neurons): This module contains the neuron entrypoints for miners and validators. Miners call the RPC endpoints in the mining module to generate images. Validators retrieve and validate generated images. This module handles running the Bittensor subnet protocols and workflows.
Validation Module (validation): Dedicated to ensuring the quality and integrity of 3D content. Like the mining module, it is designed for tandem operation with validator neurons or standalone use for thorough testing and quality checks.
Our recommended setup aligns with RunPod 1 x RTX 4090 specs:
Minimal setup aligns with RunPod 1 x L4 specs:
Our code is compatible across various operating systems, yet it has undergone most of its testing on Debian 11, Ubuntu 20 and Arch Linux. The most rigorous testing environment used is the Deep Learning VM Image, which includes pre-installed ML frameworks and tools essential for development.
NOTE: the linux image should come with pytorch 2.1+ and CUDA 12.1.1 otherwise you might have problems with running miner or validator pipelines.
For optimal environment setup:
conda_env_*.yml files for package details, and use requirements.txt. Utilizing a virtual environment is highly advised for dependency management.To manage application processes:
By running a miner on this subnet you agree that you have obtained all licenses, rights and consents required to use, reproduce, modify, display, distribute and make available your submitted results to this subnet and its end users.
To operate the miner, the miner neuron and generation endpoints must be initiated. While currently supporting a single generation endpoint, future updates are intended to allow a miner to utilize multiple generation endpoints simultaneously.
Set up the environment by navigating to the directory and running the setup script:
cd three-gen-subnet/generation
./setup_env.sh
This script creates a Conda environment three-gen-mining, installs dependencies, and sets up a PM2 configuration file (generation.config.js).
After optional modifications to generation.config.js, initiate it using PM2:
pm2 start generation.config.js
To verify the endpoint's functionality generate a test video:
curl -d "prompt=pink bicycle" -X POST http://127.0.0.1:8093/generate_video/ > video.mp4
Ensure wallet registration as per the official bittensor guide.
Prepare the neuron by executing the setup script in the neurons directory:
cd three-gen-subnet/neurons
./setup_env.sh
This script generates a Conda environment three-gen-neurons, installs required dependencies, and prepares miner.config.js for PM2 configuration.
Update miner.config.js with wallet information and ports, then execute with PM2:
pm2 start miner.config.js
Key Aspects of Operating a Validator:
Set up the environment by navigating to the directory and running the setup script:
cd three-gen-subnet/validation
./setup_env.sh
This script creates a Conda environment three-gen-validation, installs dependencies, and sets up a PM2 configuration file (validation.config.js).
After optional modifications to validation.config.js, initiate it using PM2:
pm2 start validation.config.js
Security considerations: Run validation endpoint behind the firewall (close the validation endpoint port).
Ensure wallet registration as per the official bittensor guide.
Prepare the neuron by executing the setup script in the neurons directory:
cd three-gen-subnet/neurons
./setup_env.sh
This script generates a Conda environment three-gen-neurons, installs required dependencies, and prepares validator.config.js for PM2 configuration.
Update validator.config.js with wallet information and ports, then execute with PM2:
pm2 start validator.config.js
Validator must serve the axon and the port must be opened. You can check the port using nc.
nc -vz [Your Validator IP] [Port]
You can also test the validator using the mock script. Navigate to the mocks folder and run
PYTHONPATH=$PWD/.. python mock_miner.py --subtensor.network finney --netuid 17 --wallet.name default --wallet.hotkey default --logging.trace
Our subnet supports prompt generation from two main sources: organic traffic via Public API
and continuously updated datasets. By default, it regularly fetches new batches of prompts from our service.
For real-time prompt generation, we currently utilize two different LLM models:
llama3-8b-instruct and gemma-1.1-7b-instruct.
To ensure suitability for 3D generation, our system employs a carefully tailored input prompt-instruction. This instruction forces the LLM to select objects for prompt generation from one of the 13 object categories identified based on our industry knowledge and research of gaming asset store trends. These selections can be updated in the future to better align with more specific datasets or marketplace curation.
To achieve true decentralization, you can switch to running the prompt generation locally and change the
--dataset.prompter.endpoint parameter.
Our prompter solution consists of two services: the generator and the collector.
Multiple instances of prompt generators continuously produce small batches of prompts and send them to the collector service. You can and should launch multiple generator services to maintain a robust and dynamic system.
To set up the prompt generators:
For more details and to get started with prompt generators, visit the following URL:
The prompt collector accumulates prompts from multiple generators and serves fresh large batches of prompts to validators upon request. Validators fetch these batches every hour by default, but this interval can be customized.
To set up the prompt collector:
For more details and to get started with the prompt collector, visit the following URL:
This repository contains scripts for generating 3D models from text descriptions using TRELLIS.
Hardware Requirements:
CUDA Requirements:
System Dependencies (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y \
libgl1-mesa-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libglew-dev \
libglfw3-dev \
libglvnd-dev \
pkg-config \
xvfb
There are three ways to set up the environment:
We provide three separate conda environments for different components:
conda env create -f environment_trellis.yml
conda activate trellis_new
conda env create -f environment_mining.yml
conda activate three-gen-mining
conda env create -f environment_neurons.yml
conda activate three-gen-neurons
conda create -n trellis python=3.10
conda activate trellis
# Install PyTorch with CUDA support
conda install -c pytorch pytorch==2.4.0 torchvision==0.19.0 pytorch-cuda=11.8 -c pytorch -c nvidia
# Install required compilers
conda install -c conda-forge gcc=12 gxx=12
# Install Kaolin
git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
cd kaolin
git checkout v0.17.0 # Match your desired version
pip install -r tools/requirements.txt
python setup.py develop
cd ..
# Install nvdiffrast
git clone https://github.com/NVlabs/nvdiffrast
cd nvdiffrast
pip install ninja
pip install .
or alternatively for nvdiffrast:
pip install git+https://github.com/NVlabs/nvdiffrast.git
export CC=$(which gcc)
export CXX=$(which g++)
pip install -r requirements.txt
# Install mip-splatting and diff-gaussian-rasterization
git clone https://github.com/autonomousvision/mip-splatting --recursive /tmp/extensions/mip-splatting/
pip install /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/
conda activate trellis_new
git clone --recurse-submodules https://github.com/microsoft/TRELLIS.git
cd TRELLIS
./setup.sh --basic --xformers --flash-attn --diffoctreerast --spconv --mipgaussian --kaolin --nvdiffrast
Required environment variables:
export SPCONV_ALGO=native
export ATTN_BACKEND=xformers
export CC=$(which gcc)
export CXX=$(which g++)
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Optional environment variables:
export CUDA_VISIBLE_DEVICES=0 # Specify GPU device
export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 # Help with OOM errors
Run the generation script:
python test_trellis.py
The script will generate a 3D model from the prompt "a blue monkey sitting on temple" and save the outputs in the following formats:
outputs/blue_monkey_gaussian.plyoutputs/blue_monkey.glboutputs/preview_gaussian.mp4 (Gaussian splatting preview)outputs/preview_rf.mp4 (Radiance field preview)outputs/preview_mesh.mp4 (Mesh preview)CUDA Version Mismatch
RuntimeError: CUDA error: no kernel image is available for execution on the device
Solution: Make sure your NVIDIA drivers support your CUDA version. For CUDA 11.8:
# Check NVIDIA driver version
nvidia-smi
# If needed, install correct driver
sudo apt install nvidia-driver-525
OpenGL Issues
ImportError: libGL.so.1: cannot open shared object file
Solution: Reinstall OpenGL libraries:
sudo apt-get install --reinstall libgl1-mesa-glx
Kaolin Installation Issues If Kaolin fails to install, try:
conda install -c conda-forge pytorch-cuda=11.8
pip uninstall kaolin
pip install kaolin==0.13.0
Flash Attention Issues If you encounter flash attention errors, set this environment variable:
export ATTN_BACKEND=xformers
| Component | Version | Compatible With |
|---|---|---|
| PyTorch | 2.4.0 | CUDA 11.8/12.1 |
| Kaolin | 0.13.0 | PyTorch 2.4.0 |
| nvdiffrast | latest | CUDA 11.8/12.1 |
| gcc/g++ | 12.x | All |
Monitor GPU usage during generation:
watch -n 1 nvidia-smi
Monitor CPU and memory:
htop
When backing up or moving to a new instance, save these files:
test_trellis.pyserve_trellis.pyenvironment_trellis.ymlenvironment_mining.ymlenvironment_neurons.ymlrequirements.txtsetup_requirements.txtThe conda environments themselves should be recreated rather than backed up.
# install dependencies
conda create -n primx python=3.9
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source /home/mbhat/miniconda/bin/activate
conda activate primx
nvcc --version
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 -c pytorch -c nvidia
# requires xformer for efficient attention
conda install xformers::xformers
cd 3DTopia-XL
# install other dependencies
pip install -r requirements.txt
pip install git+https://github.com/NVlabs/nvdiffrast
pip install "numpy<2"
pip install onnxruntime
export CUDA_LAUNCH_BLOCKING=1 # Synchronize CUDA errors
export TORCH_USE_CUDA_DSA=1 # Enable device-side assertions
apt-get install libeigen3-dev # For Ubuntu/Debian
git clone https://github.com/ashawkey/cubvh
If needed: Then modify cubvh/setup.py to use system Eigen headers instead of the submodule:
# kill -9 35563 && rm /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock
# In setup.py, change:
include_dirs=[
os.path.join(_src_path, 'include'),
os.path.join(_src_path, 'third_party', 'eigen'), # ← Remove this line
'/usr/include/eigen3', # ← Add this line
],
Then:
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install ninja # Critical for compiling extensions
Then:
apt-get update && apt-get install -y libeigen3-dev
cd cubvh
git submodule update --init --recursive
rm -rf third_party/eigen
git clone https://gitlab.com/libeigen/eigen.git third_party/eigen
cd third_party/eigen
git checkout 3.4.0 # Use a stable version
cd ../..
# Copy eigen headers to torch include directory
mkdir -p /home/mbhat/miniconda/envs/3dtopia/lib/python3.9/site-packages/torch/include/eigen
cp -r third_party/eigen/Eigen /home/mbhat/miniconda/envs/3dtopia/lib/python3.9/site-packages/torch/include/eigen/
# Install with correct CUDA architecture flags
# For RTX 4090 (8.9), RTX 3090 (8.6), or A6000 (8.6)
export TORCH_CUDA_ARCH_LIST="8.6" # Use 8.6 for most recent NVIDIA GPUs
export FORCE_CUDA=1
pip install . --verbose
If you encounter compilation errors, try these troubleshooting steps:
nvidia-smi
pip install pysdf
# Install Eigen from conda
conda install -c conda-forge eigen
# Then try installing cubvh again with specific flags
export EIGEN_INCLUDE_DIR=/home/mbhat/miniconda/envs/3dtopia/include/eigen3
export FORCE_CUDA=1
pip install . --verbose
then the main:
cd 3DTopia-XL
bash install.sh
download important files:
mkdir pretrained && cd pretrained
# download DiT
wget https://huggingface.co/FrozenBurning/3DTopia-XL/resolve/main/model_sview_dit_fp16.pt
# download VAE
wget https://huggingface.co/FrozenBurning/3DTopia-XL/resolve/main/model_vae_fp16.pt
mkdir pretrained
mv model_* pretrained/
cd ..
install inference files:
export CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub
conda install pytorch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 pytorch-cuda=12.1 -c pytorch -c nvidia
conda install -c iopath iopath
conda install -c bottler nvidiacub
conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python
git clone --recursive https://github.com/facebookresearch/pytorch3d
#Normal:
cd pytorch3d
python setup.py clean
python setup.py install # Use --user if not in a virtual env
#For A6000:
CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="8.6" pip install -e .
#or for all together:
cd /home/mbhat/three-gen-subnet-trellis/3DTopia-XL/pytorch3d && CUDA_HOME=/usr/local/cuda-11.8 CUB_HOME=/home/mbhat/miniconda/envs/primx/include/cub FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="8.6" pip install -e .
Run inference:
python inference.py ./configs/inference_dit.yml
git clone https://github.com/VAST-AI-Research/DetailGen3D --recursive
conda create -n trellis_detail python=3.10 numpy=1.24.3 scipy=1.10.1 -y
conda activate trellis_detail && pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 && pip install -r requirements.txt && pip install -r DetailGen3D/requirements.txt
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9
export CUDA_HOME=/usr/local/cuda-11.8
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
pip install numpy==1.24
conda install pytorch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 pytorch-cuda=11.8 -c pytorch -c nvidia
git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
cd kaolin
pip install Cython>=0.29.37
pip install -r tools/requirements.txt
pip install scipy==1.15.3
python setup.py develop
pip install ninja
pip install git+https://github.com/NVlabs/nvdiffrast
pip install .
cd .
pip install /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/
pip uninstall -y torch-cluster
nvcc --version
pip uninstall torch-cluster
FORCE_CUDA=1 pip install --no-cache-dir --verbose torch-cluster
cd TRELLIS/
./setup.sh --basic --xformers --flash-attn --diffoctreerast --spconv --mipgaussian
cd ..
pip install huggingface-hub
huggingface-cli login
export SPCONV_ALGO=native
export ATTN_BACKEND=xformers
export CC=$(which gcc)
export CXX=$(which g++)
pip install accelerate
huggingface-cli download VAST-AI/DetailGen3D --local-dir detailgen3d --local-dir-use-symlinks False
cp DetailGen3D/detailgen3d detailgen3d/ -r
python test_trellis_detail.py
pip uninstall -y numpy scipy trimesh scikit-image && pip install numpy==1.24.3 && pip install scipy==1.10.1 && pip install trimesh scikit-image
conda env create -f requirements.yml
conda activate 3dtopia-first
python -u sample_stage1.py --text "a robot" --samples 1 --sampler ddim --steps 200 --cfg_scale 7.5 --seed 0
source /home/mbhat/miniconda/bin/activate
conda create -n 3dtopia-second python=3.9 -y
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run --override --silent --toolkit
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9
export CUDA_HOME=/usr/local/cuda-11.8
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export TORCH_CUDA_ARCH_LIST="8.6" # Use 8.6 for most recent NVIDIA GPUs
export FORCE_CUDA=1
mkdir -p /home/mbhat/miniconda/envs/3dtopia-second/bin && ln -s /usr/local/cuda-11.3/bin/nvcc /home/mbhat/miniconda/envs/3dtopia-second/bin/nvcc
conda install -c conda-forge cudatoolkit=11.8
conda install -c conda-forge eigen
pip install pysdf
conda activate 3dtopia-second
conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=11.8 -c pytorch -c nvidia
git clone https://github.com/3DTopia/threefiner
cd threefiner
export CUDA_HOME=/usr/local/cuda-11.8 && export PATH=/usr/local/cuda-11.8/bin:$PATH && export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH && cd /home/mbhat/three-gen-subnet-trellis/3DTopia/threefiner && pip install .
pip install git+https://github.com/NVlabs/nvdiffrast
pip install --no-cache-dir --verbose git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
apt-get update && apt-get install -y libegl1-mesa-dev
apt-get update && apt-get install -y xvfb && Xvfb :1 -screen 0 1024x768x24 & export DISPLAY=:1 && nvidia-smi -pm 1
threefiner sd --mesh results/default/stage1/a_robot_0_0.ply --prompt "a robot" --text_dir --front_dir='-y' --outdir results/default/stage2/ --save a_robot_0_0_sd.glb --force_cuda_rast
huggingface-cli login
or export HF_TOKEN=
threefiner if2 --mesh results/default/stage2/a_robot_0_0_sd.glb --prompt "a robot" --outdir results/default/stage2/ --save a_robot_0_0_if2.glb --force_cuda_rast
Install trellis-text
conda create -n trellis_text python=3.10
conda activate trellis_text
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.1 -c pytorch -c nvidia
export CUDA_HOME=/usr/local/cuda-12.1
export TORCH_CUDA_ARCH_LIST="8.9;9.0;8.6"
export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export FORCE_CUDA=1
pip install -r requirements.txt
git clone --recurse-submodules https://github.com/microsoft/TRELLIS.git
cd TRELLIS
cp trellis ../TRELLIS-TextImagen3D
./setup.sh --basic --kaolin
export HF_TOKEN=
huggingface-cli login
Note: Make sure all environment variables are properly set and the CUDA toolkit is correctly installed before running inference.
TRELLIS is licensed under Microsoft Research License.
Python
69.8%
Jupyter Notebook
17.4%
C++
6.5%
Cuda
4.5%
C
1.0%