google-research
160 строк · 2.4 Кб
1load("@rules_python//python:defs.bzl", "py_binary", "py_library")
2
3package(
4default_visibility = ["//visibility:public"],
5licenses = ["notice"],
6)
7
8cc_library(
9name = "tf_dependency",
10tags = ["local"],
11deps = [
12"@local_config_tf//:libtensorflow_framework",
13"@local_config_tf//:tf_header_lib",
14],
15)
16
17cc_binary(
18name = "_custom_ops.so",
19srcs = [
20"custom_ops.cc",
21],
22copts = [
23"-pthread",
24"-std=c++11",
25"-D_GLIBCXX_USE_CXX11_ABI=0",
26],
27linkshared = 1,
28deps = [
29":tf_dependency",
30],
31)
32
33py_library(
34name = "custom_ops_py",
35srcs = [
36"custom_ops.py",
37],
38data = [
39":_custom_ops.so",
40"@rules_python//python/runfiles",
41],
42srcs_version = "PY3",
43)
44
45py_library(
46name = "model",
47srcs = ["model.py"],
48srcs_version = "PY3",
49deps = [
50":custom_ops_py",
51":encoding",
52":env",
53],
54)
55
56py_library(
57name = "bert_client",
58srcs = [
59"bert_client.py",
60],
61deps = [
62],
63)
64
65py_library(
66name = "word2vec_client",
67srcs = ["word2vec_client.py"],
68deps = [
69],
70)
71
72py_library(
73name = "encoding",
74srcs = ["encoding.py"],
75deps = [
76],
77)
78
79py_library(
80name = "env",
81srcs = ["env.py"],
82deps = [
83":encoding",
84],
85)
86
87filegroup(
88name = "contrack_people_names",
89srcs = [
90"data/female_names.txt",
91"data/male_names.txt",
92],
93)
94
95py_library(
96name = "signals",
97srcs = ["signals.py"],
98data = [
99":contrack_people_names",
100],
101deps = [
102"@bazel_tools//tools/python/runfiles",
103],
104)
105
106py_library(
107name = "data",
108srcs = ["data.py"],
109deps = [
110":encoding",
111":env",
112],
113)
114
115py_library(
116name = "train_lib",
117srcs = ["train.py"],
118deps = [
119":data",
120":encoding",
121":env",
122":model",
123],
124)
125
126py_binary(
127name = "train",
128srcs = ["train.py"],
129srcs_version = "PY3",
130deps = [
131":train_lib",
132],
133)
134
135py_binary(
136name = "preprocess",
137srcs = [
138"preprocess.py",
139],
140srcs_version = "PY3",
141deps = [
142":bert_client",
143":encoding",
144":signals",
145":word2vec_client",
146],
147)
148
149py_binary(
150name = "predict",
151srcs = ["predict.py"],
152srcs_version = "PY3",
153deps = [
154":data",
155":encoding",
156":env",
157":model",
158":signals",
159],
160)
161