Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PLSC
提交
55db5c62
P
PLSC
项目概览
PaddlePaddle
/
PLSC
通知
10
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PLSC
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
55db5c62
编写于
12月 19, 2019
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use local model
上级
76a8cc2b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
10 deletion
+16
-10
serving/server/plsc_serving/__init__.py
serving/server/plsc_serving/__init__.py
+1
-1
serving/server/plsc_serving/run/__init__.py
serving/server/plsc_serving/run/__init__.py
+15
-9
未找到文件。
serving/server/plsc_serving/__init__.py
浏览文件 @
55db5c62
...
...
@@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__
=
'0.1.
4
'
__version__
=
'0.1.
6
'
serving/server/plsc_serving/run/__init__.py
浏览文件 @
55db5c62
...
...
@@ -63,6 +63,9 @@ class PLSCServer():
def
modify_conf
(
self
,
gpu_index
=
0
):
os
.
chdir
(
self
.
get_path
())
engine_name
=
'name: "face_resnet50"'
if
self
.
model_path_str
==
''
:
print
(
'Please set model path using with_model.'
)
return
-
1
if
not
self
.
with_gpu_flag
:
with
open
(
'./conf/model_toolkit.prototxt'
,
'r'
)
as
f
:
conf_str
=
f
.
read
()
...
...
@@ -86,6 +89,8 @@ class PLSCServer():
'enable_memory_optimization: 1'
,
conf_str
)
open
(
conf_file
,
'w'
).
write
(
conf_str
)
return
0
def
hold
(
self
):
try
:
while
True
:
...
...
@@ -99,6 +104,10 @@ class PLSCServer():
os
.
chdir
(
self
.
get_path
())
self
.
modify_conf
(
gpu_index
)
if
self
.
modify_conf
(
gpu_index
)
!=
0
:
print
(
'Modify conf files failed'
)
return
-
1
if
self
.
with_gpu_flag
==
True
:
gpu_msg
=
'--gpuid='
+
str
(
gpu_index
)
+
' '
run_cmd
=
self
.
gpu_run_cmd
+
gpu_msg
...
...
@@ -150,16 +159,13 @@ class PLSCServer():
print(conf_str)
'''
def
with_model
(
self
,
model_name
=
None
,
model_url
=
None
):
'''
if model_url != None:
self.mode_url = model_url
self.use_other_model = True
'''
if
model_name
==
None
or
type
(
model_name
)
!=
str
:
print
(
'Please set model name string'
)
def
with_model
(
self
,
model_path
=
None
):
if
not
(
os
.
path
.
isabs
(
model_path
)
and
os
.
path
.
exists
(
model_path
)):
print
(
'Please set correct absolute path for model file'
)
return
-
1
self
.
model_path_str
=
r
'model_data_path: "'
+
model_path
+
r
'"'
os
.
chdir
(
self
.
get_path
())
self
.
get_model
(
model_name
)
def
get_path
(
self
):
py_path
=
os
.
path
.
dirname
(
plsc_serving
.
__file__
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录