|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
URL=https://romang.blob.core.windows.net/mariandev/regression-tests/data |
|
TOKEN="${AZURE_STORAGE_SAS_TOKEN:-}" |
|
|
|
|
|
if [ -z $TOKEN ]; then |
|
echo "No SAS token provided. Using statmt.org mirror" |
|
URL=http://data.statmt.org/romang/marian-regression-tests/data |
|
else |
|
echo "SAS token provided. It has ${#TOKEN} characters" |
|
fi |
|
echo "Downloading from: $URL" |
|
|
|
|
|
|
|
DATA_TARBALLS=( |
|
europarl.de-en |
|
exdb_mnist |
|
) |
|
|
|
AZCOPY=true |
|
if ! grep -q "blob\.core\.windows\.net" <<< "$URL"; then |
|
echo "Warning: URL does not look like Azure blob storage URI. Using wget" |
|
AZCOPY=false |
|
elif ! command -v azcopy &> /dev/null; then |
|
echo "Warning: azcopy is not installed in your system. Using wget" |
|
AZCOPY=false |
|
fi |
|
|
|
for name in ${DATA_TARBALLS[@]}; do |
|
file=$name.tar.gz |
|
|
|
echo Downloading checksum for $file ... |
|
if $AZCOPY; then |
|
azcopy copy "$URL/$file.md5?$TOKEN" $name.md5.newest |
|
else |
|
wget -nv -O- $URL/$file.md5 > $name.md5.newest |
|
fi |
|
|
|
|
|
|
|
if test -s $name.md5 && $(cmp --silent $name.md5 $name.md5.newest); then |
|
echo File $file does not need to be updated |
|
else |
|
echo Downloading $file ... |
|
if $AZCOPY; then |
|
azcopy copy "$URL/$file?$TOKEN" . |
|
else |
|
wget -nv $URL/$file |
|
fi |
|
|
|
|
|
|
|
|
|
fi |
|
mv $name.md5.newest $name.md5 |
|
done |
|
|
|
DATA_FILES=( |
|
europarl.de-en/corpus.bpe.de.gz |
|
europarl.de-en/corpus.bpe.en.gz |
|
) |
|
|
|
for file in ${DATA_FILES[@]}; do |
|
echo Extracting $file ... |
|
test -s $file || exit 1 |
|
|
|
target="${file%.*}" |
|
test -s $target || gzip -dc $file > $target |
|
done |
|
|
|
|
|
test -s europarl.de-en/corpus.small.de.gz || head -n 100000 europarl.de-en/corpus.bpe.de | sed 's/@@ //g' | gzip > europarl.de-en/corpus.small.de.gz |
|
test -s europarl.de-en/corpus.small.en.gz || head -n 100000 europarl.de-en/corpus.bpe.en | sed 's/@@ //g' | gzip > europarl.de-en/corpus.small.en.gz |
|
|