Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
serviceRec
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭羽
serviceRec
Commits
1a556d84
Commit
1a556d84
authored
3 years ago
by
宋柯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型调试
parent
22d0a85e
master
No related merge requests found
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
down_vocab_tfrecord.py
train/down_vocab_tfrecord.py
+45
-0
train_service_sk_tfrecord.py
train/train_service_sk_tfrecord.py
+0
-0
No files found.
train/down_vocab_tfrecord.py
0 → 100644
View file @
1a556d84
import
redis
import
sys
import
os
import
json
def
getRedisConn
():
pool
=
redis
.
ConnectionPool
(
host
=
"172.16.50.145"
,
password
=
"XfkMCCdWDIU
%
ls$h"
,
port
=
6379
,
db
=
0
)
conn
=
redis
.
Redis
(
connection_pool
=
pool
)
# conn = redis.Redis(host="172.16.50.145", port=6379, password="XfkMCCdWDIU%ls$h",db=0)
# conn = redis.Redis(host="172.18.51.10", port=6379, db=0, decode_responses = True) #test
return
conn
if
len
(
sys
.
argv
)
==
2
:
save_dir
=
sys
.
argv
[
1
]
else
:
save_dir
=
'/data/files/wideAndDeep/'
print
(
'save_dir: '
,
save_dir
)
if
not
os
.
path
.
exists
(
save_dir
):
print
(
'mkdir save_dir: '
,
save_dir
)
os
.
makedirs
(
save_dir
)
conn
=
getRedisConn
()
vocab_keys
=
conn
.
lrange
(
"strategy:all:vocab"
,
0
,
-
1
)
print
(
"vocab_keys: "
,
vocab_keys
[
0
])
vocab_keys
=
eval
(
vocab_keys
[
0
])
for
vocab_key
in
vocab_keys
:
print
(
'vocab_key: '
,
vocab_key
)
splits
=
vocab_key
.
split
(
":"
)
field
=
splits
[
1
]
filename
=
field
+
"_vocab.csv"
print
(
'filename: '
,
filename
)
with
open
(
os
.
path
.
join
(
save_dir
,
filename
),
'w'
)
as
f
:
texts
=
conn
.
lrange
(
vocab_key
,
0
,
-
1
)
texts
=
list
(
filter
(
lambda
x
:
x
!=
''
,
eval
(
texts
[
0
])))
print
(
'texts: '
,
len
(
texts
))
f
.
write
(
'
\n
'
.
join
(
texts
))
os
.
system
(
"hdfs dfs -getmerge /strategy/train_samples_tfrecord {save_dir}train_samples.tfrecord"
.
format
(
save_dir
=
save_dir
))
os
.
system
(
"hdfs dfs -getmerge /strategy/eval_samples_tfrecord {save_dir}eval_samples.tfrecord"
.
format
(
save_dir
=
save_dir
))
This diff is collapsed.
Click to expand it.
train/train_service_sk_tfrecord.py
0 → 100644
View file @
1a556d84
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment