<commit_before>#!/usr/bin/env bash
#
# Entry point for running the compute_hash_codes.py script with standard IO.
#
set -e

function usage() {
  echo "$0 config computed_files"
}

input_config="$1"
input_computed_files="$2"
now=$(date +%Y%m%d_%H%M%S)

if [ ! -f "${input_config}" ]
then
  echo "ERROR No input config given"
  exit 1
elif [ ! -f "${input_computed_files}" ]
then
  echo "ERROR No computed files CSV given"
  exit 1
fi

# Translate computed files CSV into just a UUIDs list
uuids_list="image_dump.${now}.uuids_list.txt"
cat "${input_computed_files}" | cut -d, -f2 >"${uuids_list}"

# Compute hash codes for UUIDs
models_dir="models"
base_h2u="lsh.hash2uuid.pickle"
output_h2u="lsh.hash2uuid.${now}.pickle"
output_log="image_dump.${now}.log.compute_hash_codes.txt"
scripts/compute_hash_codes.py -v \
  -c "${input_config}" \
  --uuids-list "${uuids_list}" \
  --input-hash2uuids "${models_dir}/${base_h2u}" \
  --output-hash2uuids "${models_dir}/${output_h2u}" \
  2>&1 | tee "${output_log}"<commit_msg>Added unique UUID filter to ``run.compute_hash_codes.sh`` script<commit_after>#!/usr/bin/env bash
#
# Entry point for running the compute_hash_codes.py script with standard IO.
#
set -e

function usage() {
  echo "$0 config computed_files"
}

input_config="$1"
input_computed_files="$2"
now=$(date +%Y%m%d_%H%M%S)

if [ ! -f "${input_config}" ]
then
  echo "ERROR No input config given"
  exit 1
elif [ ! -f "${input_computed_files}" ]
then
  echo "ERROR No computed files CSV given"
  exit 1
fi

# Translate computed files CSV into just a UUIDs list
uuids_list="image_dump.${now}.uuids_list.txt"
cat "${input_computed_files}" | cut -d, -f2 | sort | uniq >"${uuids_list}"

# Compute hash codes for UUIDs
models_dir="models"
base_h2u="lsh.hash2uuid.pickle"
output_h2u="lsh.hash2uuid.${now}.pickle"
output_log="image_dump.${now}.log.compute_hash_codes.txt"
scripts/compute_hash_codes.py -v \
  -c "${input_config}" \
  --uuids-list "${uuids_list}" \
  --input-hash2uuids "${models_dir}/${base_h2u}" \
  --output-hash2uuids "${models_dir}/${output_h2u}" \
  2>&1 | tee "${output_log}"
{'fraction_non_alphanumeric': 0.16499761564139245, 'fraction_numerical': 0.015259895088221268, 'mean_word_length': 4.811634349030471, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6700833', 'n_tokens_mistral': 821, 'n_tokens_neox': 804, 'n_words': 183}