Skip to content

Commit

Permalink
dl_checkpoints.sh run as root but chown to current user (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwilczynskiclearcode authored Jan 23, 2025
1 parent ad11b40 commit cd56616
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions runner/dl_checkpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,31 @@ function build_tensorrt_models() {
docker pull $AI_RUNNER_STREAMDIFFUSION_IMAGE
# ai-worker has tags hardcoded in `var livePipelineToImage` so we need to use the same tag in here:
docker image tag $AI_RUNNER_STREAMDIFFUSION_IMAGE livepeer/ai-runner:live-app-streamdiffusion
docker run --user $(id -u):$(id -g) --rm -v ./models:/models --gpus all -l TensorRT-engines \
$AI_RUNNER_STREAMDIFFUSION_IMAGE \
docker run --rm -v ./models:/models --gpus all -l TensorRT-engines $AI_RUNNER_STREAMDIFFUSION_IMAGE \
bash -c "for model in $MODELS; do
for timestep in $TIMESTEPS; do
echo \"Building TensorRT engines for model=\$model timestep=\$timestep...\" && \
python app/live/StreamDiffusionWrapper/build_tensorrt.py --model-id \$model --timesteps \$timestep
done
done"
done
adduser $(id -u -n)
chown -R $(id -u -n):$(id -g -n) /models
" \
|| (echo "failed streamdiffusion tensorrt"; return 1)

# ComfyUI (only DepthAnything for now)
AI_RUNNER_COMFYUI_IMAGE=${AI_RUNNER_COMFYUI_IMAGE:-livepeer/ai-runner:live-app-comfyui}
docker pull $AI_RUNNER_COMFYUI_IMAGE
# ai-worker has tags hardcoded in `var livePipelineToImage` so we need to use the same tag in here:
docker image tag $AI_RUNNER_COMFYUI_IMAGE livepeer/ai-runner:live-app-comfyui
docker run --user $(id -u):$(id -g) --rm -v ./models:/models --gpus all -l TensorRT-engines \
$AI_RUNNER_COMFYUI_IMAGE \
docker run --rm -v ./models:/models --gpus all -l TensorRT-engines $AI_RUNNER_COMFYUI_IMAGE \
bash -c "cd /comfyui/models/Depth-Anything-Onnx && \
python /comfyui/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py && \
mkdir -p /comfyui/models/tensorrt/depth-anything && \
mv *.engine /comfyui/models/tensorrt/depth-anything"
mv *.engine /comfyui/models/tensorrt/depth-anything && \
adduser $(id -u -n) && \
chown -R $(id -u -n):$(id -g -n) /models" \
|| (echo "failed ComfyUI tensorrt"; return 1)
}

# Download models with a restrictive license.
Expand Down

0 comments on commit cd56616

Please sign in to comment.