Claude Science on O2

Claude Science on O2

# Original doc: https://claude.com/docs/claude-science/run-on-remote-linux-server # Before running the software, please make sure you read and follow HMS data security policies: https://it.hms.harvard.edu/about/policies-and-guidelines/generative-ai-guidelines # on O2, # prepare singularity home folder # and configure claude sandbox hard fail to false mkdir -p /n/scratch/users/${USER:0:1}/$USER/claude-home/.claude-science/ echo sandbox.hard_fail=false >> /n/scratch/users/${USER:0:1}/$USER/claude-home/.claude-science/config.toml # on you local Mac # add this to your .bashrc # make sure replace 'your_HMS_ID' with your real HMS ID claude() { CLUSTER_USER=your_HMS_ID PORT=$(( (RANDOM % 20000) + 40000 )) ssh -L "$PORT:127.0.0.1:$PORT" "$CLUSTER_USER"@o2.hms.harvard.edu -t " hostname; echo port is: $PORT; lsof -t -i:$PORT 2>/dev/null | xargs -r kill -9 2>/dev/null || true; srun --pty -p priority -t 8:0:0 --tunnel $PORT:$PORT bash -lc ' hostname; echo port is: $PORT; lsof -t -i:$PORT 2>/dev/null | xargs -r kill -9 2>/dev/null || true; apptainer exec --no-mount cwd --home /n/scratch/users/${CLUSTER_USER:0:1}/$CLUSTER_USER/claude-home /n/app/containers/users/$CLUSTER_USER/claude-science.sif \ claude-science serve --no-browser --port '"$PORT"'; ' " }; # source the .bashrc file (only need to this after modifying .bashrc). source .bashrc # then run: claude # then CMD+click this url on the terminal: http://localhost:45164/?nonce=c791e1554abc5facaf18d7a4b1f5f55c9fbbbc31a4b68d890f2dc70a0323e1