Skip to content

Commit

Permalink
no duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel Kluin committed Sep 21, 2023
1 parent 354cbe9 commit f5831a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shell_scripts/model_grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ fi
if [ -n "$1" ]; then
echo "reading from $1 with $ncpu cpus" 1>&2
ls -1 ${path}/*.safetensors | parallel -n 1 -j $ncpu "python ${utilpath}/safetensors_util.py metadata {} -pm 2>/dev/null |
sed -n '1b;p' | jq '.__metadata__.ss_tag_frequency' 2>/dev/null | grep -o -E '\"[^\"]*${1}[^\"]*\": [0-9]+'| sed 's~^~'{}':~p'"
sed -n '1b;p' | jq '.__metadata__.ss_tag_frequency' 2>/dev/null | grep -o -E '\"[^\"]*${1}[^\"]*\": [0-9]+'| sed 's~^~'{}':~'"
else
echo "reading from stdin" 1>&2
tmp=$(mktemp)
sed 's/^/"[^\"]*/;s/$/[^\"]*": [0-9]+/' < /dev/stdin > $tmp
ls -1 ${path}/*.safetensors | parallel -n 1 -j $ncpu "python ${utilpath}/safetensors_util.py metadata {} -pm 2>/dev/null |
sed -n '1b;p' | jq '.__metadata__.ss_tag_frequency' 2>/dev/null | grep -oE -f $tmp | sed 's~^~'{}':~p'"
sed -n '1b;p' | jq '.__metadata__.ss_tag_frequency' 2>/dev/null | grep -oE -f $tmp | sed 's~^~'{}':~'"
echo rm $tmp
fi

Expand Down

0 comments on commit f5831a1

Please sign in to comment.