automate/020_huggingface.sh

42 lines
1.3 KiB
Bash

# DEST=${1:-/etc/skel}
DEST=${HOME}
# the tokens you created in your huggingface account
READ_TOKEN="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"
WRITE_TOKEN"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"
# Plugins that Use OPENAI_API_KEYs get called early so so we need to put them
# in .zshrc.pre-plugins.d so they can be loaded before the plugins are loaded.
cat <<-EOF | sudo tee "${DEST}"/.zshrc.pre-plugins.d/009_huggingface.zsh
export HF_WRITE_TOKEN="$READ_TOKEN"
export HF_READ_TOKEN="$WRITE_TOKEN"
export HUGGINGFACEHUB_API_TOKEN="\${HF_READ_TOKEN}"
# Generic
export HF_ENDPOINT="https://huggingface.co"
export HF_INFERENCE_ENDPOINT="https://api-inference.huggingface.com"
export HF_HOME="\${XDG_CACHE_HOME:-\$HOME/.cache}/huggingface"
export HUGGINGFACE_HUB_CACHE="\$HF_HOME/hub"
export HUGGINGFACE_ASSETS_CACHE="\$HF_HOME/assets"
export HUGGINGFACE_HUB_VERBOSITY="warning"
export HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD=""
# Boolean values
export HF_HUB_OFFLINE=""
export HF_HUB_DISABLE_IMPLICIT_TOKEN=""
export HF_HUB_DISABLE_PROGRESS_BARS=""
export HF_HUB_DISABLE_SYMLINKS_WARNING=""
export HF_HUB_DISABLE_EXPERIMENTAL_WARNING=""
export HF_HUB_DISABLE_TELEMETRY=""
export HF_HUB_ENABLE_HF_TRANSFER=""
# From external tools
export NO_COLOR=""
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
EOF
pipx install openai
pipx install langchain