TripoSR を Colab で使うメモ

TripoSR を Colab で使うメモ

実行環境 Google Colab Pro+

!git clone -b dev https://github.com/camenduru/TripoSR-hf
%cd /content/TripoSR-hf

でダウンロード

libnvinfer.so.10
libcudnn_adv.so.9
を colabへインストール

!apt-get update
!apt-get install -y libnvinfer8 libnvinfer-plugin8 libnvinfer-dev

!apt-get install -y libcudnn9-cuda-12 libcudnn9-dev-cuda-12 libcudnn9-static-cuda-12

テストのため

!apt-get install libcudnn9-samples

!cd /usr/src/cudnn_samples_v9/mnistCUDNN
!make clean && make
!./mnistCUDNN

!apt-get update
!apt-get install -y libfreeimage-dev

!cd /usr/src/cudnn_samples_v9/mnistCUDNN && make clean && make

!cd /usr/src/cudnn_samples_v9/mnistCUDNN && ./mnistCUDNN

これで
Test passed!
がでればOK

!pip install onnxruntime
!pip install onnxruntime-gpu

でライブラリインストール

import onnxruntime as ort

providers = ort.get_available_providers()
print("Available providers:", providers)

を実行し

Available providers: ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']

となればOK

# Make sure that your environment meets the requirements above
!pip install git+https://github.com/tatsy/torchmcubes.git

でインストール

!pip install tensorrt

でライブラリインストール

!pip install -r requirements.txt

で必要なパッケージインストール

!pip install transformers -U
!pip install huggingface_hub -U

!transformers-cli cache clear

!pip install gradio==5.7.0 gradio-client==1.5.0 diffusers==0.15.0 sentence-transformers==2.2.2
!export LD_LIBRARY_PATH=/path/to/TensorRT/lib:$LD_LIBRARY_PATH

でパスを通しておく

!python app.py

で起動

To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
/content/TripoSR-hf/tsr/system.py:69: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  ckpt = torch.load(weight_path, map_location="cpu")
2024-12-07 21:34:10.493703261 [E:onnxruntime:Default, provider_bridge_ort.cc:1848 TryGetProviderInfo_TensorRT] /onnxruntime_src/onnxruntime/core/session/provider_bridge_ort.cc:1539 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_tensorrt.so with error: libnvinfer_plugin.so.10: cannot open shared object file: No such file or directory

*************** EP Error ***************
EP Error /onnxruntime_src/onnxruntime/python/onnxruntime_pybind_state.cc:507 void onnxruntime::python::RegisterTensorRTPluginsAsCustomOps(PySessionOptions&, const onnxruntime::ProviderOptions&) Please install TensorRT libraries as mentioned in the GPU requirements page, make sure they're in the PATH or LD_LIBRARY_PATH, and that your GPU is supported.
 when using ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
****************************************
* Running on local URL:  http://127.0.0.1:7860
* Running on public URL: 

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
Could not load symbol cuFuncGetName. Error: /usr/lib64-nvidia/libcuda.so.1: undefined symbol: cuFuncGetName

とエラーが出るけサンプルは動いた

操作は

【超便利】TripoSRで画像から3Dを生成する方法とは?
を参考に
なお写真をアップロードすれば撮影した画像から3Dモデルの作成が可能

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です