Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
0e7587a9
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看板
提交
0e7587a9
编写于
7月 14, 2020
作者:
B
barrierye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update code structure
上级
3461602f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
129 addition
and
22 deletion
+129
-22
java/examples/pom.xml
java/examples/pom.xml
+96
-0
java/examples/src/main/java/PaddleServingClientExample.java
java/examples/src/main/java/PaddleServingClientExample.java
+11
-0
java/pom.xml
java/pom.xml
+0
-0
java/src/main/java/io/paddle/serving/client/Client.java
java/src/main/java/io/paddle/serving/client/Client.java
+22
-22
java/src/main/proto/general_model_config.proto
java/src/main/proto/general_model_config.proto
+0
-0
java/src/main/proto/multi_lang_general_model_service.proto
java/src/main/proto/multi_lang_general_model_service.proto
+0
-0
java/src/test/java/io/paddle/serving/client/AppTest.java
java/src/test/java/io/paddle/serving/client/AppTest.java
+0
-0
未找到文件。
java/examples/pom.xml
0 → 100644
浏览文件 @
0e7587a9
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
io.paddle.serving.client
</groupId>
<artifactId>
paddle-serving-sdk-java-examples
</artifactId>
<version>
0.0.1
</version>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
8
</source>
<target>
8
</target>
</configuration>
<version>
3.8.1
</version>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>
true
</addClasspath>
<mainClass>
my.fully.qualified.class.Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>
make-my-jar-with-dependencies
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<nd4j.backend>
nd4j-native
</nd4j.backend>
<nd4j.version>
1.0.0-beta7
</nd4j.version>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<!-- For development use -->
<!-- Include this if you want to try the latest SNAPSHOT version -->
<repositories>
<repository>
<id>
oss.sonatype.org-snapshot
</id>
<url>
http://oss.sonatype.org/content/repositories/snapshots
</url>
<releases>
<enabled>
false
</enabled>
</releases>
<snapshots>
<enabled>
true
</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>
io.paddle.serving.client
</groupId>
<artifactId>
paddle-serving-sdk-java
</artifactId>
<version>
0.0.1
</version>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.30
</version>
</dependency>
<dependency>
<groupId>
org.nd4j
</groupId>
<artifactId>
${nd4j.backend}
</artifactId>
<version>
${nd4j.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
java/examples/src/main/java/PaddleServingClientExample.java
0 → 100644
浏览文件 @
0e7587a9
import
io.paddle.serving.client.Client
;
/**
* Hello world!
*
*/
public
class
PaddleServingClientExample
{
public
static
void
main
(
String
[]
args
)
{
Client
client
=
new
Client
();
System
.
out
.
println
(
"Hello World!"
);
}
}
java/p
addle-serving-sdk-java/p
om.xml
→
java/pom.xml
浏览文件 @
0e7587a9
文件已移动
java/
paddle-serving-sdk-java/
src/main/java/io/paddle/serving/client/Client.java
→
java/src/main/java/io/paddle/serving/client/Client.java
浏览文件 @
0e7587a9
...
...
@@ -31,7 +31,7 @@ public class Client {
private
Set
<
String
>
lodTensorSet_
;
private
Map
<
String
,
Integer
>
feedTensorLen_
;
Client
()
{
public
Client
()
{
channel_
=
null
;
blockingStub_
=
null
;
futureStub_
=
null
;
...
...
@@ -45,7 +45,7 @@ public class Client {
lodTensorSet_
=
null
;
feedTensorLen_
=
null
;
}
public
Boolean
setRpcTimeoutMs
(
int
rpc_timeout
)
throws
NullPointerException
{
if
(
futureStub_
==
null
||
blockingStub_
==
null
)
{
throw
new
NullPointerException
(
"set timeout must be set after connect."
);
...
...
@@ -164,7 +164,6 @@ public class Client {
long
[]
flattened_shape
=
{-
1
};
INDArray
flattened_list
=
variable
.
reshape
(
flattened_shape
);
int
v_type
=
feedTypes_
.
get
(
name
);
System
.
out
.
println
(
flattened_list
);
NdIndexIterator
iter
=
new
NdIndexIterator
(
flattened_list
.
shape
());
//System.out.format("name: %s, type: %d\n", name, v_type);
if
(
v_type
==
0
)
{
// int64
...
...
@@ -406,26 +405,27 @@ public class Client {
return
predict_future
;
}
public
static
void
main
(
String
[]
args
)
{
/*
float[] data = {0.0137f, -0.1136f, 0.2553f, -0.0692f,
0.0582f, -0.0727f, -0.1583f, -0.0584f,
0.6283f, 0.4919f, 0.1856f, 0.0795f, -0.0332f};
INDArray npdata = Nd4j.createFromArray(data);
HashMap<String, INDArray> feed_data
= new HashMap<String, INDArray>() {{
put("x", npdata);
}};
List<String> fetch = Arrays.asList("price");
*/
/*
Map<String, INDArray> fetch_map = client.predict(feed_data, fetch);
for (Map.Entry<String, INDArray> e : fetch_map.entrySet()) {
System.out.println("Key = " + e.getKey() + ", Value = " + e.getValue());
}
*/
// DL4J(Deep Learning for Java)Document:
// https://www.bookstack.cn/read/deeplearning4j/bcb48e8eeb38b0c6.md
//float[] data = {0.0137f, -0.1136f, 0.2553f, -0.0692f,
// 0.0582f, -0.0727f, -0.1583f, -0.0584f,
// 0.6283f, 0.4919f, 0.1856f, 0.0795f, -0.0332f};
//INDArray npdata = Nd4j.createFromArray(data);
//HashMap<String, INDArray> feed_data
// = new HashMap<String, INDArray>() {{
// put("x", npdata);
//}};
//List<String> fetch = Arrays.asList("price");
//Map<String, INDArray> fetch_map = client.predict(feed_data, fetch);
//for (Map.Entry<String, INDArray> e : fetch_map.entrySet()) {
// System.out.println("Key = " + e.getKey() + ", Value = " + e.getValue());
//}
//int[] data = {8, 233, 52, 601};
long
[]
data
=
{
8
,
233
,
52
,
601
};
INDArray
npdata
=
Nd4j
.
createFromArray
(
data
);
//System.out.println(npdata);
...
...
@@ -452,8 +452,8 @@ public class Client {
System
.
out
.
println
(
"Key = "
+
e
.
getKey
()
+
", Value = "
+
e
.
getValue
());
}
}
}
}
class
PredictFuture
{
...
...
java/
paddle-serving-sdk-java/
src/main/proto/general_model_config.proto
→
java/src/main/proto/general_model_config.proto
浏览文件 @
0e7587a9
文件已移动
java/
paddle-serving-sdk-java/
src/main/proto/multi_lang_general_model_service.proto
→
java/src/main/proto/multi_lang_general_model_service.proto
浏览文件 @
0e7587a9
文件已移动
java/
paddle-serving-sdk-java/
src/test/java/io/paddle/serving/client/AppTest.java
→
java/src/test/java/io/paddle/serving/client/AppTest.java
浏览文件 @
0e7587a9
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录