Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
ce8f5d6a
S
Serving
项目概览
PaddlePaddle
/
Serving
1 年多 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ce8f5d6a
编写于
4月 03, 2021
作者:
T
TeslaZhao
提交者:
GitHub
4月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1112 from TeslaZhao/develop
fix bugs for importing cpu/gpu server in examples
上级
07ef9374
afb6ef13
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
55 addition
and
34 deletion
+55
-34
python/examples/bert/bert_gpu_server.py
python/examples/bert/bert_gpu_server.py
+3
-3
python/examples/bert/bert_web_service_gpu.py
python/examples/bert/bert_web_service_gpu.py
+1
-1
python/examples/fit_a_line/test_server.py
python/examples/fit_a_line/test_server.py
+4
-1
python/examples/grpc_impl_example/fit_a_line/test_server_gpu.py
.../examples/grpc_impl_example/fit_a_line/test_server_gpu.py
+3
-3
python/examples/imagenet/resnet50_web_service.py
python/examples/imagenet/resnet50_web_service.py
+1
-1
python/examples/imdb/text_classify_service.py
python/examples/imdb/text_classify_service.py
+5
-1
python/examples/lac/lac_web_service.py
python/examples/lac/lac_web_service.py
+4
-1
python/examples/ocr/det_debugger_server.py
python/examples/ocr/det_debugger_server.py
+1
-1
python/examples/ocr/det_web_server.py
python/examples/ocr/det_web_server.py
+1
-1
python/examples/ocr/ocr_debugger_server.py
python/examples/ocr/ocr_debugger_server.py
+2
-2
python/examples/ocr/rec_debugger_server.py
python/examples/ocr/rec_debugger_server.py
+3
-2
python/examples/ocr/rec_web_server.py
python/examples/ocr/rec_web_server.py
+1
-1
python/examples/pipeline/bert/web_service.py
python/examples/pipeline/bert/web_service.py
+3
-2
python/examples/pipeline/imagenet/resnet50_web_service.py
python/examples/pipeline/imagenet/resnet50_web_service.py
+1
-1
python/examples/pipeline/imdb_model_ensemble/test_pipeline_server.py
...ples/pipeline/imdb_model_ensemble/test_pipeline_server.py
+9
-5
python/examples/pipeline/simple_web_service/web_service_java.py
.../examples/pipeline/simple_web_service/web_service_java.py
+1
-1
python/examples/senta/senta_web_service.py
python/examples/senta/senta_web_service.py
+5
-5
python/examples/xpu/fit_a_line_xpu/test_server.py
python/examples/xpu/fit_a_line_xpu/test_server.py
+7
-2
未找到文件。
python/examples/bert/bert_gpu_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -14,9 +14,9 @@
import
os
import
sys
from
paddle_serving_server
import
OpMaker
from
paddle_serving_server
import
OpSeqMaker
from
paddle_serving_server
import
Server
from
paddle_serving_server
_gpu
import
OpMaker
from
paddle_serving_server
_gpu
import
OpSeqMaker
from
paddle_serving_server
_gpu
import
Server
op_maker
=
OpMaker
()
read_op
=
op_maker
.
create
(
'general_reader'
)
...
...
python/examples/bert/bert_web_service_gpu.py
浏览文件 @
ce8f5d6a
...
...
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# pylint: disable=doc-string-missing
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
from
paddle_serving_app.reader
import
ChineseBertReader
import
sys
import
os
...
...
python/examples/fit_a_line/test_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -13,7 +13,10 @@
# limitations under the License.
# pylint: disable=doc-string-missing
from
paddle_serving_server.web_service
import
WebService
try
:
from
paddle_serving_server_gpu.web_service
import
WebService
except
ImportError
:
from
paddle_serving_server.web_service
import
WebService
import
numpy
as
np
...
...
python/examples/grpc_impl_example/fit_a_line/test_server_gpu.py
浏览文件 @
ce8f5d6a
...
...
@@ -15,9 +15,9 @@
import
os
import
sys
from
paddle_serving_server
import
OpMaker
from
paddle_serving_server
import
OpSeqMaker
from
paddle_serving_server
import
MultiLangServer
as
Server
from
paddle_serving_server
_gpu
import
OpMaker
from
paddle_serving_server
_gpu
import
OpSeqMaker
from
paddle_serving_server
_gpu
import
MultiLangServer
as
Server
op_maker
=
OpMaker
()
read_op
=
op_maker
.
create
(
'general_reader'
)
...
...
python/examples/imagenet/resnet50_web_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -25,7 +25,7 @@ device = sys.argv[2]
if
device
==
"cpu"
:
from
paddle_serving_server.web_service
import
WebService
else
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
class
ImageService
(
WebService
):
...
...
python/examples/imdb/text_classify_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -13,7 +13,11 @@
# limitations under the License.
# pylint: disable=doc-string-missing
from
paddle_serving_server.web_service
import
WebService
try
:
from
paddle_serving_server.web_service
import
WebService
except
ImportError
:
from
paddle_serving_server_gpu.web_service
import
WebService
from
paddle_serving_app.reader.imdb_reader
import
IMDBDataset
import
sys
import
numpy
as
np
...
...
python/examples/lac/lac_web_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle_serving_server.web_service
import
WebService
try
:
from
paddle_serving_server.web_service
import
WebService
except
ImportError
:
from
paddle_serving_server_gpu.web_service
import
WebService
import
sys
from
paddle_serving_app.reader
import
LACReader
import
numpy
as
np
...
...
python/examples/ocr/det_debugger_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -22,7 +22,7 @@ from paddle_serving_app.reader import Sequential, ResizeByFactor
from
paddle_serving_app.reader
import
Div
,
Normalize
,
Transpose
from
paddle_serving_app.reader
import
DBPostProcess
,
FilterBoxes
if
sys
.
argv
[
1
]
==
'gpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
elif
sys
.
argv
[
1
]
==
'cpu'
:
from
paddle_serving_server.web_service
import
WebService
import
time
...
...
python/examples/ocr/det_web_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -22,7 +22,7 @@ from paddle_serving_app.reader import Sequential, ResizeByFactor
from
paddle_serving_app.reader
import
Div
,
Normalize
,
Transpose
from
paddle_serving_app.reader
import
DBPostProcess
,
FilterBoxes
if
sys
.
argv
[
1
]
==
'gpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
elif
sys
.
argv
[
1
]
==
'cpu'
:
from
paddle_serving_server.web_service
import
WebService
import
time
...
...
python/examples/ocr/ocr_debugger_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -23,7 +23,7 @@ from paddle_serving_app.reader import Sequential, URL2Image, ResizeByFactor
from
paddle_serving_app.reader
import
Div
,
Normalize
,
Transpose
from
paddle_serving_app.reader
import
DBPostProcess
,
FilterBoxes
,
GetRotateCropImage
,
SortedBoxes
if
sys
.
argv
[
1
]
==
'gpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
elif
sys
.
argv
[
1
]
==
'cpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_app.local_predict
import
LocalPredictor
...
...
@@ -107,7 +107,7 @@ ocr_service.prepare_server(workdir="workdir", port=9292)
ocr_service
.
init_det_debugger
(
det_model_config
=
"ocr_det_model"
)
if
sys
.
argv
[
1
]
==
'gpu'
:
ocr_service
.
set_gpus
(
"2"
)
ocr_service
.
run_debugger_service
(
gpu
=
True
)
ocr_service
.
run_debugger_service
(
gpu
=
True
)
elif
sys
.
argv
[
1
]
==
'cpu'
:
ocr_service
.
run_debugger_service
()
ocr_service
.
run_web_service
()
python/examples/ocr/rec_debugger_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -23,7 +23,7 @@ from paddle_serving_app.reader import Sequential, URL2Image, ResizeByFactor
from
paddle_serving_app.reader
import
Div
,
Normalize
,
Transpose
from
paddle_serving_app.reader
import
DBPostProcess
,
FilterBoxes
,
GetRotateCropImage
,
SortedBoxes
if
sys
.
argv
[
1
]
==
'gpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
elif
sys
.
argv
[
1
]
==
'cpu'
:
from
paddle_serving_server.web_service
import
WebService
import
time
...
...
@@ -71,7 +71,8 @@ ocr_service.load_model_config("ocr_rec_model")
if
sys
.
argv
[
1
]
==
'gpu'
:
ocr_service
.
set_gpus
(
"0"
)
ocr_service
.
init_rec
()
ocr_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9292
,
device
=
"gpu"
,
gpuid
=
0
)
ocr_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9292
,
device
=
"gpu"
,
gpuid
=
0
)
elif
sys
.
argv
[
1
]
==
'cpu'
:
ocr_service
.
init_rec
()
ocr_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9292
,
device
=
"cpu"
)
...
...
python/examples/ocr/rec_web_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -23,7 +23,7 @@ from paddle_serving_app.reader import Sequential, URL2Image, ResizeByFactor
from
paddle_serving_app.reader
import
Div
,
Normalize
,
Transpose
from
paddle_serving_app.reader
import
DBPostProcess
,
FilterBoxes
,
GetRotateCropImage
,
SortedBoxes
if
sys
.
argv
[
1
]
==
'gpu'
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server
_gpu
.web_service
import
WebService
elif
sys
.
argv
[
1
]
==
'cpu'
:
from
paddle_serving_server.web_service
import
WebService
import
time
...
...
python/examples/pipeline/bert/web_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -37,7 +37,8 @@ class BertOp(Op):
for
i
in
range
(
batch_size
):
feed_dict
=
self
.
reader
.
process
(
input_dict
[
str
(
i
)].
encode
(
"utf-8"
))
for
key
in
feed_dict
.
keys
():
feed_dict
[
key
]
=
np
.
array
(
feed_dict
[
key
]).
reshape
((
1
,
len
(
feed_dict
[
key
]),
1
))
feed_dict
[
key
]
=
np
.
array
(
feed_dict
[
key
]).
reshape
(
(
1
,
len
(
feed_dict
[
key
]),
1
))
feed_res
.
append
(
feed_dict
)
feed_dict
=
{}
for
key
in
feed_res
[
0
].
keys
():
...
...
@@ -57,5 +58,5 @@ class BertService(WebService):
bert_service
=
BertService
(
name
=
"bert"
)
bert_service
.
prepare_pipeline_config
(
"config
2
.yml"
)
bert_service
.
prepare_pipeline_config
(
"config.yml"
)
bert_service
.
run_service
()
python/examples/pipeline/imagenet/resnet50_web_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -16,7 +16,7 @@ from paddle_serving_app.reader import Sequential, URL2Image, Resize, CenterCrop,
try
:
from
paddle_serving_server.web_service
import
WebService
,
Op
except
ImportError
:
from
paddle_serving_server.web_service
import
WebService
,
Op
from
paddle_serving_server
_gpu
.web_service
import
WebService
,
Op
import
logging
import
numpy
as
np
import
base64
,
cv2
...
...
python/examples/pipeline/imdb_model_ensemble/test_pipeline_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -12,17 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# pylint: disable=doc-string-missing
from
paddle_serving_server.pipeline
import
Op
,
RequestOp
,
ResponseOp
from
paddle_serving_server.pipeline
import
PipelineServer
from
paddle_serving_server.pipeline.proto
import
pipeline_service_pb2
from
paddle_serving_server.pipeline.channel
import
ChannelDataErrcode
import
numpy
as
np
from
paddle_serving_app.reader.imdb_reader
import
IMDBDataset
import
logging
try
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server.pipeline
import
Op
,
RequestOp
,
ResponseOp
from
paddle_serving_server.pipeline
import
PipelineServer
from
paddle_serving_server.pipeline.proto
import
pipeline_service_pb2
from
paddle_serving_server.pipeline.channel
import
ChannelDataErrcode
except
ImportError
:
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_server_gpu.web_service
import
WebService
from
paddle_serving_server_gpu.pipeline
import
Op
,
RequestOp
,
ResponseOp
from
paddle_serving_server_gpu.pipeline
import
PipelineServer
from
paddle_serving_server_gpu.pipeline.proto
import
pipeline_service_pb2
from
paddle_serving_server_gpu.pipeline.channel
import
ChannelDataErrcode
_LOGGER
=
logging
.
getLogger
()
user_handler
=
logging
.
StreamHandler
()
...
...
python/examples/pipeline/simple_web_service/web_service_java.py
浏览文件 @
ce8f5d6a
...
...
@@ -14,7 +14,7 @@
try
:
from
paddle_serving_server.web_service
import
WebService
,
Op
except
ImportError
:
from
paddle_serving_server.web_service
import
WebService
,
Op
from
paddle_serving_server
_gpu
.web_service
import
WebService
,
Op
import
logging
import
numpy
as
np
from
numpy
import
array
...
...
python/examples/senta/senta_web_service.py
浏览文件 @
ce8f5d6a
...
...
@@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle_serving_server.web_service
import
WebService
from
paddle_serving_client
import
Client
from
paddle_serving_app.reader
import
LACReader
,
SentaReader
import
os
import
sys
import
numpy
as
np
#senta_web_service.py
from
paddle_serving_server.web_service
import
WebService
try
:
from
paddle_serving_server.web_service
import
WebService
except
ImportError
:
from
paddle_serving_server_gpu.web_service
import
WebService
from
paddle_serving_client
import
Client
from
paddle_serving_app.reader
import
LACReader
,
SentaReader
...
...
python/examples/xpu/fit_a_line_xpu/test_server.py
浏览文件 @
ce8f5d6a
...
...
@@ -13,7 +13,11 @@
# limitations under the License.
# pylint: disable=doc-string-missing
from
paddle_serving_server.web_service
import
WebService
try
:
from
paddle_serving_server.web_service
import
WebService
except
ImportError
:
from
paddle_serving_server_gpu.web_service
import
WebService
import
numpy
as
np
...
...
@@ -31,6 +35,7 @@ class UciService(WebService):
uci_service
=
UciService
(
name
=
"uci"
)
uci_service
.
load_model_config
(
"uci_housing_model"
)
uci_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9393
,
use_lite
=
True
,
use_xpu
=
True
,
ir_optim
=
True
)
uci_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9393
,
use_lite
=
True
,
use_xpu
=
True
,
ir_optim
=
True
)
uci_service
.
run_rpc_service
()
uci_service
.
run_web_service
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录