Skip to content

Commit 9efb889

Browse files
authored
Merge pull request #1028 from reyoung/feature/fix_embedding
Check md5 when download word embedding.
2 parents 4f4b226 + ba3fcc5 commit 9efb889

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

demo/model_zoo/embedding/pre_DictAndModel.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,20 @@
1414
# limitations under the License.
1515
set -e
1616
set -x
17+
BASE_URL='http://paddlepaddle.cdn.bcebos.com/model_zoo/embedding'
1718

18-
# download the dictionary and pretrained model
19-
for file in baidu.dict model_32.emb model_64.emb model_128.emb model_256.emb
20-
do
21-
wget http://paddlepaddle.bj.bcebos.com/model_zoo/embedding/$file
19+
wget ${BASE_URL}/baidu.dict
20+
21+
DOWNLOAD_ITEMS=(model_32.emb model_64.emb model_128.emb model_256.emb)
22+
ITEM_MD5=(f88c8325ee6da6187f1080e8fe66c1cd
23+
927cf70f27f860aff1a5703ebf7f1584
24+
a52e43655cd25d279777ed509a1ae27b
25+
b92c67fe9ff70fea53596080e351ac80)
26+
27+
for ((i=0; i<${#ITEM_MD5[@]}; i++))
28+
do
29+
FILENAME=${DOWNLOAD_ITEMS[${i}]}
30+
REAL_MD5=`wget ${BASE_URL}/${FILENAME} -O - | tee ${FILENAME} | md5sum | cut -d ' ' -f 1`
31+
EXPECTED_MD5=${ITEM_MD5[${i}]}
32+
[ "${EXPECTED_MD5}" = "${REAL_MD5}" ]
2233
done

0 commit comments

Comments
 (0)