Last active
November 16, 2020 02:29
-
-
Save heeh/9b4b8ab7c78f6a9264c6d8df98f99aff to your computer and use it in GitHub Desktop.
GNU Parallel Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d "targets" ]; then | |
mkdir targets | |
fi | |
if [ ! -d "frames" ]; then | |
mkdir frames | |
fi | |
word2target() { | |
wordloc=paragraphs/$(printf "%04d" $1).txt | |
echo $wordloc | |
if [ -f $wordloc ] ; then | |
python -m sesame.targetid --mode predict --model_name custom_tid --raw_input $wordloc | |
fi | |
} | |
export -f word2target | |
target2frame() { | |
targetloc=targets/$(printf "%04d" $1).txt | |
echo $targetloc | |
if [ -f $targetloc ] ; then | |
python -m sesame.frameid --mode predict --model_name custom_fid --raw_input $targetloc | |
fi | |
} | |
export -f target2frame | |
#word2target 0000 | |
#target2frame 0000 | |
parallel -k -j 10 word2target {1} :::: <(seq 10 2776) | |
wait | |
parallel -k -j 10 target2frame {1} :::: <(seq 10 2776) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment