Skip to content

Commit 239be0d

Browse files
authored
Merge pull request #751 from wangzhen38/fix_w2v_readme
fix word2vec run_in_root_dir
2 parents 89f532f + 599bc78 commit 239be0d

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

models/rank/dlrm/criteo_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from __future__ import print_function
1616
import numpy as np
17-
17+
import paddle
1818
from paddle.io import IterableDataset
1919

2020

models/recall/word2vec/word2vec_infer_reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import numpy as np
1717
import io
1818
import six
19-
19+
import os
2020
from paddle.io import IterableDataset
2121

2222

@@ -25,10 +25,12 @@ def __init__(self, file_list, config):
2525
super(RecDataset, self).__init__()
2626
self.file_list = file_list
2727
self.config = config
28+
self.config_abs_dir = config.get("config_abs_dir", None)
2829
self.init()
2930

3031
def init(self):
3132
dict_path = self.config.get("runner.word_id_dict_path")
33+
dict_path = os.path.join(self.config_abs_dir, dict_path)
3234
self.word_to_id = dict()
3335
self.id_to_word = dict()
3436
with io.open(dict_path, 'r', encoding='utf-8') as f:

models/recall/word2vec/word2vec_reader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import six
1919
import time
2020
import random
21+
import os
2122
from paddle.io import IterableDataset
2223

2324

@@ -45,10 +46,12 @@ def __init__(self, file_list, config):
4546
super(RecDataset, self).__init__()
4647
self.file_list = file_list
4748
self.config = config
49+
self.config_abs_dir = config.get("config_abs_dir", None)
4850
self.init()
4951

5052
def init(self):
5153
dict_path = self.config.get("runner.word_count_dict_path")
54+
dict_path = os.path.join(self.config_abs_dir, dict_path)
5255
self.window_size = self.config.get("hyper_parameters.window_size")
5356
self.neg_num = self.config.get("hyper_parameters.neg_num")
5457
self.with_shuffle_batch = self.config.get(
@@ -127,6 +130,7 @@ def __init__(self, file_list, config):
127130

128131
def init(self):
129132
dict_path = self.config.get("runner.word_id_dict_path")
133+
dict_path = os.path.join(self.config_abs_dir, dict_path)
130134
self.word_to_id = dict()
131135
self.id_to_word = dict()
132136
with io.open(dict_path, 'r', encoding='utf-8') as f:

test_tipc/configs/tisas/train_infer_python.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ inference:-u test_tipc/configs/tisas/paddle_infer.py --model_name=tisas --reader
4242
--enable_mkldnn:True|False
4343
--cpu_threads:1|6
4444
--batchsize:1
45-
--enable_tensorRT:False
45+
--enable_tensorRT:True|False
4646
--precision:fp32
4747
--model_dir:
4848
--data_dir:test_tipc/data/infer

0 commit comments

Comments
 (0)