Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Dockerfile #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

add Dockerfile #30

wants to merge 3 commits into from

Conversation

bitplane
Copy link

@bitplane bitplane commented Dec 9, 2024

Add a Dockerfile, a script to start it on the machine, and a post-build script that runs the first time you execute it on a machine with a GPU (some things won't build without CUDA in the builder, which is currently unsupported by buildx)

@bitplane bitplane force-pushed the docker branch 2 times, most recently from 3f7fc6c to fd81a7f Compare December 9, 2024 03:57
@bitplane
Copy link
Author

bitplane commented Dec 9, 2024

Nothing to do with my day job, no conflict of interest or IP claims - all my own sweat and tears

@microsoft-github-policy-service agree

Add a post-build script that runs the first time you execute it on
a machine with a GPU, since some stuff won't build in the builder

Changed app.py to serve on 0.0.0.0, 'cause otherwise we can't expose
the ports
Dockerfile Outdated
# git and build-essential are needed for post_install.sh script.
# vim and strace are useful for debugging, remove those if you want to.
RUN apt update && \
apt upgrade && \
Copy link

@AnotiaWang AnotiaWang Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe missing a -y option here in apt upgrade? Otherwise docker will fail:

Need to get xxxMB of archives.
After this operation, xxxMB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
ERROR: failed to solve: process "/bin/sh -c apt upgrade" did not complete successfully: exit code: 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof! Yes I added this without testing it. You wouldn't believe how many times I've rebuilt this image! Thanks :)

@ecker00
Copy link

ecker00 commented Jan 19, 2025

Could we add a compose.yml file as icing on top? or some docker run examples in the readme?

@johnwick67943532
Copy link

johnwick67943532 commented Jan 20, 2025

This commit bash files and dockerfile is great.

If we can provide docker build cmd and run cmd might be more clear ? :
docker build -t trellis_01 .

also linux host machine might need to install nvidia cuda driver ?

docker run --gpus all \
        -p 7860:7860 \
         trellis_01 

Then port 7860 is ready to serve : )

@johnwick67943532
Copy link

And do we have good support on trellis main repo code update CI into current image/container ?

@johnwick67943532
Copy link

johnwick67943532 commented Jan 20, 2025

And i also got some running fail log after docker build and run

docker run --gpus all \
        -p 7860:7860 \
         trellis_01 &>run.log
click to open log

==========
== CUDA ==
==========

CUDA Version 12.4.0

Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.

Doing post install steps
Install stuff that couldn't be installed without GPU
Cloning into '/tmp/extensions/diffoctreerast'...
Submodule 'lib/glm' (https://github.com/g-truc/glm.git) registered for path 'lib/glm'
Cloning into '/tmp/extensions/diffoctreerast/lib/glm'...
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Cloning into '/tmp/extensions/mip-splatting'...
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[SYSTEM] PyTorch Version: 2.5.1+cu124, CUDA Version: 12.4
Submodule path 'lib/glm': checked out '33b4a621a697a305bc3a7610d290677b96beb181'
Processing /tmp/extensions/diffoctreerast
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: diffoctreerast
  Building wheel for diffoctreerast (setup.py): started
  Building wheel for diffoctreerast (setup.py): finished with status 'done'
  Created wheel for diffoctreerast: filename=diffoctreerast-0.0.0-cp311-cp311-linux_x86_64.whl size=1747670 sha256=7dee7c7eac54a1b053dcab17de2ab33c41ae56ff709c3815fb2c52cb7f60e3c3
  Stored in directory: /tmp/pip-ephem-wheel-cache-mm1j1k4m/wheels/a9/61/c8/937a0854c9b43d708de23a8b4acf88df4937bac7e549132431
Successfully built diffoctreerast
Installing collected packages: diffoctreerast
Successfully installed diffoctreerast-0.0.0
Processing /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: diff_gaussian_rasterization
  Building wheel for diff_gaussian_rasterization (setup.py): started
  Building wheel for diff_gaussian_rasterization (setup.py): finished with status 'done'
  Created wheel for diff_gaussian_rasterization: filename=diff_gaussian_rasterization-0.0.0-cp311-cp311-linux_x86_64.whl size=669613 sha256=ed934e33c5908849f53b149c20b815df74d1d3efb59f3e3ef0dc9ad0104b8a83
  Stored in directory: /root/.cache/pip/wheels/3c/f8/bd/28c4aa67994d4bc4e767ba758e4836e3272049aac2bcdd9541
Successfully built diff_gaussian_rasterization
Installing collected packages: diff_gaussian_rasterization
Successfully installed diff_gaussian_rasterization-0.0.0

Proving it actually works...
Traceback (most recent call last):
  File "/app/example.py", line 13, in <module>
    pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/pipelines/trellis_image_to_3d.py", line 55, in from_pretrained
    pipeline = super(TrellisImageTo3DPipeline, TrellisImageTo3DPipeline).from_pretrained(path)
[SPARSE] Backend: spconv, Attention: flash_attn
Please install kaolin and diso to use the mesh extractor.
Warp 1.5.1 initialized:
   CUDA Toolkit 12.6, Driver 12.6
   Devices:
     "cpu"      : "x86_64"
     "cuda:0"   : "NVIDIA GeForce RTX 3060" (12 GiB, sm_86, mempool enabled)
   Kernel cache:
     /root/.cache/warp/1.5.1
[SPARSE][CONV] spconv algo: native
[ATTENTION] Using backend: flash_attn
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/pipelines/base.py", line 39, in from_pretrained
    _models = {
              ^
  File "/app/trellis/pipelines/base.py", line 40, in <dictcomp>
    k: models.from_pretrained(f"{path}/{v}")
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/models/__init__.py", line 59, in from_pretrained
    model = __getattr__(config['name'])(**config['args'], **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/models/structured_latent_vae/decoder_mesh.py", line 105, in __init__
    self.mesh_extractor = SparseFeatures2Mesh(res=self.resolution*4, use_color=self.rep_config.get('use_color', False))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/representations/mesh/cube2mesh.py", line 69, in __init__
    self.mesh_extractor = FlexiCubes(device=device)
                          ^^^^^^^^^^
NameError: name 'FlexiCubes' is not defined
Launching app
/opt/conda/lib/python3.11/site-packages/gradio_client/utils.py:1097: UserWarning: file() is deprecated and will be removed in a future version. Use handle_file() instead.
  warnings.warn(
[SPARSE] Backend: spconv, Attention: flash_attn
Please install kaolin and diso to use the mesh extractor.
Warp 1.5.1 initialized:
   CUDA Toolkit 12.6, Driver 12.6
   Devices:
     "cpu"      : "x86_64"
     "cuda:0"   : "NVIDIA GeForce RTX 3060" (12 GiB, sm_86, mempool enabled)
   Kernel cache:
     /root/.cache/warp/1.5.1
[SPARSE][CONV] spconv algo: auto
[ATTENTION] Using backend: flash_attn
Traceback (most recent call last):
  File "/app/app.py", line 246, in <module>
    pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/pipelines/trellis_image_to_3d.py", line 55, in from_pretrained
    pipeline = super(TrellisImageTo3DPipeline, TrellisImageTo3DPipeline).from_pretrained(path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/pipelines/base.py", line 39, in from_pretrained
    _models = {
              ^
  File "/app/trellis/pipelines/base.py", line 40, in <dictcomp>
    k: models.from_pretrained(f"{path}/{v}")
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/models/__init__.py", line 59, in from_pretrained
    model = __getattr__(config['name'])(**config['args'], **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/models/structured_latent_vae/decoder_mesh.py", line 105, in __init__
    self.mesh_extractor = SparseFeatures2Mesh(res=self.resolution*4, use_color=self.rep_config.get('use_color', False))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/trellis/representations/mesh/cube2mesh.py", line 69, in __init__
    self.mesh_extractor = FlexiCubes(device=device)
                          ^^^^^^^^^^
NameError: name 'FlexiCubes' is not defined
Something went wrong and it exited?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants