Skip to content

Commit 6f61000

Browse files
committed
Move djl-serving project from djl repo
1 parent f0f9eea commit 6f61000

File tree

145 files changed

+17979
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+17979
-16
lines changed

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.gradle
2+
.DS_Store
3+
.idea
4+
*.iml
5+
build
6+
libs
7+
*.gz
8+
*.params
9+
*.zip
10+
*.jar
11+
*.so
12+
*.dylib
13+
*.dll
14+
*.class
15+
16+
# Eclipse
17+
.settings
18+
.project
19+
.classpath
20+
bin/
21+
22+
#node
23+
node_modules/
24+
**/static/dist/
25+
26+
#vscode
27+
.vscode

CONTRIBUTING.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,26 @@ reported the issue. Please try to include as much information as you can. Detail
2323
## Contributing via Pull Requests
2424
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
2525

26-
1. You are working against the latest source on the *main* branch.
26+
1. You are working against the latest source on the *master* branch.
2727
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28-
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
28+
3. You open an issue to discuss any significant work - we would hate for your time to be wasted. If there is an existing issue your are interested in working on, you should comment on it so others don't start working on the same issue.
2929

3030
To send us a pull request, please:
3131

3232
1. Fork the repository.
3333
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34-
3. Ensure local tests pass.
35-
4. Commit to your fork using clear commit messages.
36-
5. Send us a pull request, answering any default questions in the pull request interface.
37-
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
34+
3. Look at the [contributor documentation](docs/development/README.md), especially the docs in bold, for help setting up your development environment and information about various conventions.
35+
4. Ensure local tests pass.
36+
5. Commit to your fork using clear commit messages.
37+
6. Send us a pull request, answering any default questions in the pull request interface.
38+
7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
3839

3940
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4041
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4142

4243

4344
## Finding contributions to work on
44-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
45+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'Call for Contribution' or 'good first issue' issues is a great place to start.
4546

4647

4748
## Code of Conduct
@@ -57,3 +58,5 @@ If you discover a potential security issue in this project we ask that you notif
5758
## Licensing
5859

5960
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
61+
62+
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

README.md

+146-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,154 @@
1-
## My Project
1+
# DJL Serving
22

3-
TODO: Fill this README out!
3+
## Overview
44

5-
Be sure to:
5+
DJL serving is a high performance universal model serving solution. You can use djl-serving serve the
6+
following models out of the box:
67

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
8+
- PyTorch TorchScript model
9+
- TensorFlow SavedModel bundle
10+
- Apache MXNet model
911

10-
## Security
12+
You can install extra extensions to enable the following models:
1113

12-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
14+
- ONNX model
15+
- PaddlePaddle model
16+
- TFLite model
17+
- Neo DLR (TVM) model
18+
- XGBoost model
19+
- Sentencepiece model
20+
- fastText/BlazingText model
1321

14-
## License
22+
## Architecture
1523

16-
This project is licensed under the Apache-2.0 License.
24+
DJL serving is built on top of [Deep Java Library](https://djl.ai). You can visit
25+
[DJL github repository](https://github.com/deepjavalibrary/djl) to learn more about DJL.
1726

27+
![Architecture Diagram](https://resources.djl.ai/images/djl-serving/architecture.png)
28+
29+
## Key features
30+
31+
- Performance, DJL serving running multithreading inference in a single JVM. Our benchmark shows
32+
DJL serving has higher throughput than most of C++ based model server on the market.
33+
- Ease of use, DJL serving can serve most of the models out of box.
34+
- Easy to extend, DJL serving plugins make it easy for user to add their own extensions.
35+
- Auto-scale, DJL serving automatically scales up/down worker threads based on the load.
36+
- Dynamic batching, DJL serving supports dynamic batching to increase throughput.
37+
- Model versioning, DJL allows user to load different version of a model on a single endpoint.
38+
- Multi-engine support, DJL allows user to serve models from different engines at the same time.
39+
40+
## Installation
41+
42+
For macOS
43+
44+
```
45+
brew cask install djl-serving
46+
47+
# Start djl-serving as service:
48+
brew services start djl-serving
49+
50+
# Stop djl-serving service
51+
brew services stop djl-serving
52+
```
53+
54+
For Ubuntu
55+
56+
```
57+
curl -O https://publish.djl.ai/djl-serving/djl-serving_0.12.0-1_all.deb
58+
sudo dpkg -i djl-serving_0.12.0-1_all.deb
59+
```
60+
61+
For Windows
62+
63+
We are considering to create a `chocolatey` package for Windows. For the time being, you can
64+
download djl-serving zip file from [here](https://publish.djl.ai/djl-serving/serving-0.12.0.zip).
65+
66+
### Docker
67+
68+
You can also use docker to run DJL Serving:
69+
70+
```
71+
docker run -itd -p 8080:8080 deepjavalibrary/djl-serving
72+
```
73+
74+
## Run DJL Serving
75+
76+
Use the following command to start model server locally:
77+
78+
```sh
79+
djl-serving
80+
```
81+
82+
The model server will be listening on port 8080. You can also load a model for serving on start up:
83+
84+
```sh
85+
djl-serving -m "https://resources.djl.ai/demo/mxnet/resnet18_v1.zip"
86+
```
87+
88+
Open another terminal, and type the following command to test the inference REST API:
89+
90+
```sh
91+
curl -O https://resources.djl.ai/images/kitten.jpg
92+
curl -X POST http://localhost:8080/predictions/resnet18_v1 -T kitten.jpg
93+
94+
or:
95+
96+
curl -X POST http://localhost:8080/predictions/resnet18_v1 -F "[email protected]"
97+
98+
[
99+
{
100+
"className": "n02123045 tabby, tabby cat",
101+
"probability": 0.4838452935218811
102+
},
103+
{
104+
"className": "n02123159 tiger cat",
105+
"probability": 0.20599420368671417
106+
},
107+
{
108+
"className": "n02124075 Egyptian cat",
109+
"probability": 0.18810515105724335
110+
},
111+
{
112+
"className": "n02123394 Persian cat",
113+
"probability": 0.06411745399236679
114+
},
115+
{
116+
"className": "n02127052 lynx, catamount",
117+
"probability": 0.010215568356215954
118+
}
119+
]
120+
```
121+
122+
For more command line options:
123+
124+
```sh
125+
djl-serving --help
126+
usage: djl-serving [OPTIONS]
127+
-f,--config-file <CONFIG-FILE> Path to the configuration properties file.
128+
-h,--help Print this help.
129+
-m,--models <MODELS> Models to be loaded at startup.
130+
-s,--model-store <MODELS-STORE> Model store location where models can be loaded.
131+
```
132+
133+
## REST API
134+
135+
DJL Serving use RESTful API for both inference and management calls.
136+
137+
When DJL Serving startup, it starts two web services:
138+
* [Inference API](docs/inference_api.md)
139+
* [Management API](docs/management_api.md)
140+
141+
By default, DJL Serving listening on 8080 port and only accessible from localhost.
142+
Please see [DJL Serving Configuration](docs/configuration.md) for how to enable access from remote host.
143+
144+
# Plugin management
145+
146+
DJL Serving supports plugins, user can implement their own plugins to enrich DJL Serving features.
147+
See [DJL Plugin Management](docs/plugin_management.md) for how to install plugins to DJL Serving.
148+
149+
## Logging
150+
you can set the logging level on the command-line adding a parameter for the JVM
151+
152+
```sh
153+
-Dai.djl.logging.level={FATAL|ERROR|WARN|INFO|DEBUG|TRACE}
154+
```

build.gradle

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
plugins {
2+
id "com.github.spotbugs" version "4.7.1" apply false
3+
}
4+
5+
defaultTasks 'build'
6+
7+
def djl_version = System.getenv("DJL_VERSION")
8+
djl_version = (djl_version == null) ? "0.13.0-SNAPSHOT" : djl_version
9+
10+
allprojects {
11+
group 'ai.djl'
12+
version "${djl_version}"
13+
14+
repositories {
15+
mavenCentral()
16+
maven {
17+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
18+
}
19+
}
20+
21+
apply plugin: 'idea'
22+
idea {
23+
module {
24+
outputDir = file('build/classes/java/main')
25+
testOutputDir = file('build/classes/java/test')
26+
// inheritOutputDirs = true
27+
}
28+
}
29+
}
30+
31+
def javaProjects() {
32+
return subprojects.findAll { new File(it.projectDir, "src/main").exists() }
33+
}
34+
35+
configure(javaProjects()) {
36+
apply plugin: 'java-library'
37+
sourceCompatibility = 1.8
38+
targetCompatibility = 1.8
39+
compileJava.options.encoding = "UTF-8"
40+
compileTestJava.options.encoding = "UTF-8"
41+
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
42+
compileJava.options.compilerArgs.addAll(["--release", "8"])
43+
}
44+
45+
apply plugin: 'eclipse'
46+
47+
eclipse {
48+
jdt.file.withProperties { props ->
49+
props.setProperty "org.eclipse.jdt.core.circularClasspath", "warning"
50+
}
51+
classpath {
52+
sourceSets.test.java {
53+
srcDirs = ["src/test/java"]
54+
exclude "**/package-info.java"
55+
}
56+
}
57+
}
58+
59+
apply from: file("${rootProject.projectDir}/tools/gradle/java-formatter.gradle")
60+
apply from: file("${rootProject.projectDir}/tools/gradle/check.gradle")
61+
62+
test {
63+
// tensorflow mobilenet and resnet require more cpu memory
64+
maxHeapSize = "4096m"
65+
doFirst {
66+
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
67+
jvmArgs = [
68+
'--add-opens', "java.base/jdk.internal.loader=ALL-UNNAMED"
69+
]
70+
}
71+
}
72+
73+
useTestNG() {
74+
// suiteXmlFiles << new File(rootDir, "testng.xml") //This is how to add custom testng.xml
75+
}
76+
77+
testLogging {
78+
showStandardStreams = true
79+
events "passed", "skipped", "failed", "standardOut", "standardError"
80+
}
81+
82+
doFirst {
83+
systemProperties System.getProperties()
84+
systemProperties.remove("user.dir")
85+
// systemProperty "ai.djl.logging.level", "debug"
86+
systemProperty "org.slf4j.simpleLogger.defaultLogLevel", "debug"
87+
systemProperty "org.slf4j.simpleLogger.log.org.mortbay.log", "warn"
88+
systemProperty "disableProgressBar", "true"
89+
systemProperty "nightly", System.getProperty("nightly", "false")
90+
if (gradle.startParameter.offline) {
91+
systemProperty "offline", "true"
92+
}
93+
// This is used to avoid overriding on default engine for modules:
94+
// mxnet-engine, mxnet-model-zoo, api (MockEngine), basicdataset, fasttext, etc
95+
if (project.name != "integration" && project.name != "examples") {
96+
systemProperties.remove("ai.djl.default_engine")
97+
}
98+
}
99+
}
100+
101+
compileJava {
102+
options.compilerArgs << "-proc:none" << "-Xlint:all,-options,-static" << "-Werror"
103+
}
104+
105+
compileTestJava {
106+
options.compilerArgs << "-proc:none" << "-Xlint:all,-options,-static" << "-Werror"
107+
}
108+
109+
jar {
110+
manifest {
111+
attributes("Automatic-Module-Name": "ai.djl.${project.name.replace('-', '_')}")
112+
}
113+
}
114+
}
115+
116+
apply from: file("${rootProject.projectDir}/tools/gradle/jacoco.gradle")

0 commit comments

Comments
 (0)