File size: 1,744 Bytes
3738140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
58
#!/usr/bin/env bash
set -euo pipefail

export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-1}"

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
workdir="$repo_root/compare_model/ReplaceMe"
default_config="$workdir/examples/llama2_7b_replaceme_lstsq_skip16_common.yaml"
config_path="${CONFIG_PATH:-$default_config}"
target_tokens="${COMMON_TARGET_TOKENS_OVERRIDE:-}"
passthrough_args=()

while [[ $# -gt 0 ]]; do
  case "$1" in
    --target_tokens)
      if [[ $# -lt 2 ]]; then
        echo "error: --target_tokens requires a value" >&2
        exit 1
      fi
      target_tokens="$2"
      shift 2
      ;;
    --target_tokens=*)
      target_tokens="${1#*=}"
      shift
      ;;
    *)
      passthrough_args+=("$1")
      shift
      ;;
  esac
done

mkdir -p "$repo_root/results/llama_7b_replaceme_common_16"
git_commit="unknown"
if git -C "$repo_root" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
  git_commit=$(git -C "$repo_root" rev-parse HEAD)
fi
{
  echo "git_commit=$git_commit"
  echo "config_path=$config_path"
  echo "COMMON_TARGET_TOKENS_OVERRIDE=${target_tokens:-4500000}"
  echo "command:"
  printf '%q ' python "$repo_root/compare_model/ReplaceMe/run_replaceme.py" --config "$config_path"
  if [[ -n "$target_tokens" ]]; then
    printf '%q ' "# COMMON_TARGET_TOKENS_OVERRIDE=$target_tokens"
  fi
  if [[ ${#passthrough_args[@]} -gt 0 ]]; then
    printf '%q ' "${passthrough_args[@]}"
  fi
  echo
} > "$repo_root/results/llama_7b_replaceme_common_16/run_args.txt"

cd "$workdir"
COMMON_TARGET_TOKENS_OVERRIDE="${target_tokens:-${COMMON_TARGET_TOKENS_OVERRIDE:-}}" \
PYTHONPATH="$workdir:$repo_root${PYTHONPATH:+:$PYTHONPATH}" \
python run_replaceme.py --config "$config_path" "${passthrough_args[@]}"