Skip to content

Commit d1a7eb7

Browse files
authored
Upgrade xgboost to 3.0.4 (#3788)
* Upgrade xgboost to 3.0.4 * Remove gpu build
1 parent 131dbad commit d1a7eb7

File tree

7 files changed

+32
-41
lines changed

7 files changed

+32
-41
lines changed

.github/workflows/native_s3_xgboost.yml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,24 @@ jobs:
3030

3131
build-xgboost-jni-aarch64:
3232
runs-on: [ self-hosted, aarch64 ]
33-
container: centos:7
3433
timeout-minutes: 30
3534
needs: create-aarch64-runner
35+
container:
36+
image: amazonlinux:2023
37+
env:
38+
JAVA_HOME: /usr/lib/jvm/java-17-amazon-corretto
3639
steps:
37-
- uses: actions/checkout@v3
3840
- name: Install Environment
3941
run: |
40-
yum -y update
41-
yum -y install centos-release-scl-rh epel-release
42-
yum -y install devtoolset-8 git patch libstdc++-static curl python3-devel
43-
curl -L -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.0-rc2/cmake-3.27.0-rc2-linux-aarch64.tar.gz
44-
tar xvfz cmake.tar.gz
45-
ln -sf $PWD/cmake-3.*/bin/cmake /usr/bin/cmake
46-
cmake --version
47-
pip3 install awscli --upgrade
42+
dnf -y group install "Development Tools"
43+
dnf -y install patch git cmake3 python3-devel python3-pip java-17-amazon-corretto-devel jq
44+
pip3 install awscli wheel build --upgrade
4845
- name: Set up JDK 17
4946
uses: actions/setup-java@v3
5047
with:
5148
distribution: 'corretto'
5249
java-version: 17
50+
- uses: actions/checkout@v4
5351
- name: Release JNI prep
5452
run: |
5553
XGBOOST_VERSION=${{ github.event.inputs.xgb_version }}
@@ -60,17 +58,29 @@ jobs:
6058
python3 create_jni.py
6159
cd ../..
6260
- name: Configure AWS Credentials
63-
uses: aws-actions/configure-aws-credentials@v4
64-
with:
65-
role-to-assume: arn:aws:iam::425969335547:role/djl-ci-publish-role
66-
aws-region: us-east-2
61+
run: |
62+
oidc_token=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
63+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com" | jq -r ".value")
64+
echo "::add-mask::$oidc_token"
65+
read -r AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<<"$(aws sts assume-role-with-web-identity \
66+
--region "us-east-2" \
67+
--role-arn "arn:aws:iam::425969335547:role/djl-ci-publish-role" \
68+
--role-session-name "build-tokenizer-jni-aarch64" \
69+
--web-identity-token "$oidc_token" \
70+
--query "[Credentials.AccessKeyId, Credentials.SecretAccessKey, Credentials.SessionToken]" \
71+
--output text)"
72+
echo "::add-mask::$AWS_ACCESS_KEY_ID"
73+
echo "::add-mask::$AWS_SECRET_ACCESS_KEY"
74+
echo "::add-mask::$AWS_SESSION_TOKEN"
75+
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
76+
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
77+
echo "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" >> "$GITHUB_ENV"
6778
- name: Copy files to S3 with the AWS CLI
6879
run: |
6980
XGBOOST_VERSION=${{ github.event.inputs.xgb_version }}
70-
XGBOOST_VERSION=${XGBOOST_VERSION:-$(awk -F '=' '/xgboost/ {gsub(/ ?"/, "", $2); print $2}' gradle/libs.versions.toml)')}
81+
XGBOOST_VERSION=${XGBOOST_VERSION:-$(awk -F '=' '/xgboost/ {gsub(/ ?"/, "", $2); print $2}' gradle/libs.versions.toml)}
7182
aws s3 cp xgboost/lib/libxgboost4j.so s3://djl-ai/publish/xgboost/${XGBOOST_VERSION}/jnilib/linux/aarch64/
7283
aws cloudfront create-invalidation --distribution-id E371VB8JQ6NRVY --paths "/xgboost/${XGBOOST_VERSION}/jnilib*"
73-
7484
stop-runners:
7585
if: ${{ github.repository == 'deepjavalibrary/djl' && always() }}
7686
runs-on: [ self-hosted, scheduler ]

.github/workflows/nightly_publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
run: |
8181
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=1.13.1 -Psnapshot
8282
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.5.1 -Psnapshot
83-
./gradlew clean engines:ml:xgboost:publish -Pgpu -Psnapshot
83+
./gradlew clean engines:ml:xgboost:publish -Psnapshot
8484
./gradlew clean publish -Psnapshot
8585
cd bom
8686
./gradlew publish -Psnapshot
@@ -94,7 +94,7 @@ jobs:
9494
run: |
9595
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=1.13.1 -P${{ github.event.inputs.mode }}
9696
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.5.1 -P${{ github.event.inputs.mode }}
97-
./gradlew clean engines:ml:xgboost:publish -Pgpu -P${{ github.event.inputs.mode }}
97+
./gradlew clean engines:ml:xgboost:publish -P${{ github.event.inputs.mode }}
9898
./gradlew clean publish -P${{ github.event.inputs.mode }}
9999
cd bom
100100
./gradlew publish -P${{ github.event.inputs.mode }}

engines/ml/xgboost/build.gradle.kts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ val xgbFlavor = if (isGpu) "-gpu" else ""
1111

1212
val exclusion by configurations.registering
1313

14-
@Suppress("UnstableApiUsage")
1514
dependencies {
1615
api(project(":api"))
1716
api(libs.commons.logging)
@@ -42,23 +41,6 @@ dependencies {
4241
tasks {
4342
compileJava { dependsOn(processResources) }
4443

45-
processResources {
46-
val jnilibDir = buildDirectory / "resources/main/lib/linux/aarch64/"
47-
inputs.properties(mapOf("xgboostVersion" to libs.versions.xgboost.get()))
48-
outputs.dir(jnilibDir)
49-
50-
val logger = project.logger
51-
doLast {
52-
val url =
53-
"https://publish.djl.ai/xgboost/${libs.versions.xgboost.get()}/jnilib/linux/aarch64/libxgboost4j.so"
54-
val file = jnilibDir / "libxgboost4j.so"
55-
if (!file.exists()) {
56-
logger.lifecycle("Downloading $url")
57-
url.url into file
58-
}
59-
}
60-
}
61-
6244
jar {
6345
val retained = configurations.compileClasspath.get() - exclusion.get()
6446
for (file in retained)

engines/ml/xgboost/src/main/java/ai/djl/ml/xgboost/XgbNDManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ public Engine getEngine() {
109109
* @return a new instance of {@link NDArray}
110110
*/
111111
public NDArray create(ColumnBatch columnBatch, float missing, int nthread) {
112-
columnBatch.getFeatureArrayInterface();
113-
String json = columnBatch.getFeatureArrayInterface();
112+
String json = columnBatch.toFeaturesJson();
114113
JsonArray array = JsonUtils.GSON.fromJson(json, JsonArray.class);
115114
JsonArray shapeJson = array.get(0).getAsJsonObject().get("shape").getAsJsonArray();
116115
long[] shapes = new long[shapeJson.size()];

engines/ml/xgboost/src/main/java/ml/dmlc/xgboost4j/java/JniUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static long createDMatrix(Buffer buf, Shape shape, float missing) {
5656

5757
public static long createDMatrix(ColumnBatch columnBatch, float missing, int nthread) {
5858
long[] handles = new long[1];
59-
String json = columnBatch.getFeatureArrayInterface();
59+
String json = columnBatch.toFeaturesJson();
6060
if (json == null || json.isEmpty()) {
6161
throw new IllegalArgumentException(
6262
"Expecting non-empty feature columns' array interface");

engines/ml/xgboost/src/test/java/ai/djl/ml/xgboost/XgbModelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void downloadXGBoostModel() throws IOException {
5353
@Test
5454
public void testVersion() {
5555
Engine engine = Engine.getEngine("XGBoost");
56-
Assert.assertEquals("2.0.3", engine.getVersion());
56+
Assert.assertEquals(engine.getVersion(), "3.0.4");
5757
}
5858

5959
/*

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tensorflowCore = "1.0.0-rc.1"
99
mxnet = "1.9.1"
1010
onnxruntime = "1.21.1"
1111
onnxruntimeExtensions = "0.13.0"
12-
xgboost = "2.0.3"
12+
xgboost = "3.0.4"
1313
lightgbm = "3.2.110"
1414
fasttext = "0.9.2"
1515
sentencepiece = "0.2.0"

0 commit comments

Comments
 (0)