-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextto3Dexample_temp.sh
More file actions
executable file
·57 lines (48 loc) · 1.81 KB
/
textto3Dexample_temp.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Run text-to-image-to-3D pipeline in custom TRELLIS container
# Load necessary modules
module load gcc/11.2.0
module load cuda/12.2
module load python3
module load tacc-apptainer
# Ensure correct directory
cd $SCRATCH/x2sim
# Container path
export CONTAINER_PATH="$SCRATCH/x2sim/trellis.sif"
# Source environment variables
source credentials.sh
# Set your text prompt
export TEXT_PROMPT=$(cat current_prompt.txt)
# Create cache directories in scratch space
mkdir -p $SCRATCH/cache/huggingface
mkdir -p $SCRATCH/cache/torch
mkdir -p $SCRATCH/cache/warp
mkdir -p $SCRATCH/cache/pip
mkdir -p $SCRATCH/cache/python
# Export cache environment variables
export HF_HOME=$SCRATCH/cache/huggingface
export HF_DATASETS_CACHE=$SCRATCH/cache/huggingface/datasets
export TRANSFORMERS_CACHE=$SCRATCH/cache/huggingface/transformers
export HUGGINGFACE_HUB_CACHE=$SCRATCH/cache/huggingface/hub
export TORCH_HOME=$SCRATCH/cache/torch
export XDG_CACHE_HOME=$SCRATCH/cache
export PYTHONUSERBASE=$SCRATCH/python_env
export WARP_CACHE_PATH=$SCRATCH/cache/warp
# Run with environment variables and bind for caching and for running code example
apptainer exec --cleanenv --no-home --nv \
--env "OPENAI_API_KEY=$OPENAI_API_KEY" \
--env "HF_HOME=$HF_HOME" \
--env "HF_DATASETS_CACHE=$HF_DATASETS_CACHE" \
--env "TRANSFORMERS_CACHE=$TRANSFORMERS_CACHE" \
--env "HUGGINGFACE_HUB_CACHE=$HUGGINGFACE_HUB_CACHE" \
--env "TORCH_HOME=$TORCH_HOME" \
--env "XDG_CACHE_HOME=$XDG_CACHE_HOME" \
--env "PYTHONUSERBASE=$PYTHONUSERBASE" \
--env "WARP_CACHE_PATH=$WARP_CACHE_PATH" \
--env "SCRATCH=$SCRATCH" \
--bind "$SCRATCH/cache:/tmp/cache" \
--bind "$SCRATCH/cache/huggingface:/root/.cache/huggingface" \
--bind "$SCRATCH/x2sim:/code" \
--writable-tmpfs \
$CONTAINER_PATH \
/usr/bin/python3 /code/TRELLIS/run_x2sim.py "$TEXT_PROMPT"