|
| 1 | +diff --git a/engines/pytorch/pytorch-jni/build.gradle.kts b/engines/pytorch/pytorch-jni/build.gradle.kts |
| 2 | +index c2c0c0c84..72c08b62a 100644 |
| 3 | +--- a/engines/pytorch/pytorch-jni/build.gradle.kts |
| 4 | ++++ b/engines/pytorch/pytorch-jni/build.gradle.kts |
| 5 | +@@ -29,33 +29,47 @@ tasks { |
| 6 | + val hasJni = project.hasProperty("jni") |
| 7 | + |
| 8 | + doFirst { |
| 9 | +- val url = "https://publish.djl.ai/pytorch/$ptVersion/jnilib/${libs.versions.djl.get()}" |
| 10 | +- val files = listOf( |
| 11 | +- "linux-x86_64/cpu/libdjl_torch.so", |
| 12 | +- "linux-x86_64/cpu-precxx11/libdjl_torch.so", |
| 13 | +- "linux-aarch64/cpu-precxx11/libdjl_torch.so", |
| 14 | +- "osx-aarch64/cpu/libdjl_torch.dylib", |
| 15 | +- "win-x86_64/cpu/djl_torch.dll" |
| 16 | +- ) + when { |
| 17 | +- ptVersion.matches(Regex("2.[4-5].\\d")) -> listOf( |
| 18 | +- "linux-x86_64/cu124/libdjl_torch.so", |
| 19 | +- "linux-x86_64/cu124-precxx11/libdjl_torch.so", |
| 20 | +- "win-x86_64/cu124/djl_torch.dll" |
| 21 | +- ) |
| 22 | +- |
| 23 | +- ptVersion.matches(Regex("2.[1-3].\\d")) -> listOf( |
| 24 | +- "linux-x86_64/cu121/libdjl_torch.so", |
| 25 | +- "linux-x86_64/cu121-precxx11/libdjl_torch.so", |
| 26 | +- "win-x86_64/cu121/djl_torch.dll", |
| 27 | +- ) |
| 28 | +- |
| 29 | +- ptVersion.startsWith("1.13.") -> listOf( |
| 30 | +- "linux-x86_64/cu117/libdjl_torch.so", |
| 31 | +- "win-x86_64/cu117/djl_torch.dll", |
| 32 | +- ) |
| 33 | +- |
| 34 | +- else -> throw GradleException("Unsupported version: $ptVersion.") |
| 35 | +- } |
| 36 | ++ val url = "https://publish.djl.ai/pytorch/$ptVersion/jnilib/${libs.versions.djl.get()}" |
| 37 | ++ val arch = System.getProperty("os.arch") |
| 38 | ++ |
| 39 | ++ val files = when (arch) { |
| 40 | ++ "ppc64le" -> listOf( |
| 41 | ++ "linux-ppc64le/cpu/libdjl_torch.so" |
| 42 | ++ ) |
| 43 | ++ |
| 44 | ++ "x86_64", "amd64" -> listOf( |
| 45 | ++ "linux-x86_64/cpu/libdjl_torch.so", |
| 46 | ++ "linux-x86_64/cpu-precxx11/libdjl_torch.so" |
| 47 | ++ ) + when { |
| 48 | ++ ptVersion.matches(Regex("2.[4-9].\\d")) -> listOf( |
| 49 | ++ "linux-x86_64/cu124/libdjl_torch.so", |
| 50 | ++ "linux-x86_64/cu124-precxx11/libdjl_torch.so", |
| 51 | ++ "win-x86_64/cu124/djl_torch.dll" |
| 52 | ++ ) |
| 53 | ++ |
| 54 | ++ ptVersion.matches(Regex("2.[1-3].\\d")) -> listOf( |
| 55 | ++ "linux-x86_64/cu121/libdjl_torch.so", |
| 56 | ++ "linux-x86_64/cu121-precxx11/libdjl_torch.so", |
| 57 | ++ "win-x86_64/cu121/djl_torch.dll" |
| 58 | ++ ) |
| 59 | ++ |
| 60 | ++ ptVersion.startsWith("1.13.") -> listOf( |
| 61 | ++ "linux-x86_64/cu117/libdjl_torch.so", |
| 62 | ++ "win-x86_64/cu117/djl_torch.dll" |
| 63 | ++ ) |
| 64 | ++ |
| 65 | ++ else -> emptyList() |
| 66 | ++ } |
| 67 | ++ |
| 68 | ++ "aarch64" -> listOf( |
| 69 | ++ "linux-aarch64/cpu-precxx11/libdjl_torch.so", |
| 70 | ++ "osx-aarch64/cpu/libdjl_torch.dylib" |
| 71 | ++ ) |
| 72 | ++ |
| 73 | ++ else -> throw GradleException("Unsupported arch: $arch") |
| 74 | ++ |
| 75 | ++ } |
| 76 | ++ |
| 77 | + val jnilibDir = dir / "jnilib" / libs.versions.djl.get() |
| 78 | + for (entry in files) { |
| 79 | + val file = jnilibDir / entry |
| 80 | +diff --git a/engines/pytorch/pytorch-native/build.gradle.kts b/engines/pytorch/pytorch-native/build.gradle.kts |
| 81 | +index e5f002961..7d877e93a 100644 |
| 82 | +--- a/engines/pytorch/pytorch-native/build.gradle.kts |
| 83 | ++++ b/engines/pytorch/pytorch-native/build.gradle.kts |
| 84 | +@@ -33,7 +33,7 @@ fun downloadBuild( |
| 85 | + isPrecxx11: Boolean = false, |
| 86 | + isAarch64: Boolean = false |
| 87 | + ) { |
| 88 | +- val arch = if (isAarch64) "aarch64" else "x86_64" |
| 89 | ++ val arch = if (isAarch64) "aarch64" else "ppc64le" |
| 90 | + execOperations.exec { |
| 91 | + workingDir = project.projectDir |
| 92 | + if (os == "win") |
| 93 | +@@ -92,6 +92,7 @@ fun prepareNativeLib(execOperations: ExecOperations, binaryRoot: String, ver: St |
| 94 | + } else { |
| 95 | + // @formatter:off |
| 96 | + val files = mapOf( |
| 97 | ++ "cpu/libtorch-cxx11-abi-shared-with-deps-$ver%2Bcpu.zip" to "cpu/linux-ppc64le", |
| 98 | + "cpu/libtorch-cxx11-abi-shared-with-deps-$ver%2Bcpu.zip" to "cpu/linux-x86_64", |
| 99 | + "cpu/libtorch-macos-arm64-$ver.zip" to "cpu/osx-aarch64", |
| 100 | + "cpu/libtorch-win-shared-with-deps-$ver%2Bcpu.zip" to "cpu/win-x86_64", |
| 101 | +@@ -256,6 +257,7 @@ tasks { |
| 102 | + |
| 103 | + (binaryRoot / "files.txt").text = buildString { |
| 104 | + val uploadDirs = listOf( |
| 105 | ++ binaryRoot / "cpu/linux-ppc64le/native/lib/", |
| 106 | + binaryRoot / "cpu/linux-x86_64/native/lib/", |
| 107 | + binaryRoot / "cpu/osx-aarch64/native/lib/", |
| 108 | + binaryRoot / "cpu/win-x86_64/native/lib/", |
| 109 | +diff --git a/extensions/tokenizers/build.gradle.kts b/extensions/tokenizers/build.gradle.kts |
| 110 | +index 8108d174d..05adfb973 100644 |
| 111 | +--- a/extensions/tokenizers/build.gradle.kts |
| 112 | ++++ b/extensions/tokenizers/build.gradle.kts |
| 113 | +@@ -52,6 +52,7 @@ tasks { |
| 114 | + "win-x86_64/cpu/libgcc_s_seh-1.dll" to "extra/win-x86_64/libgcc_s_seh-1.dll", |
| 115 | + "win-x86_64/cpu/libstdc%2B%2B-6.dll" to "extra/win-x86_64/libstdc%2B%2B-6.dll", |
| 116 | + "win-x86_64/cpu/tokenizers.dll" to "$tokenizers/jnilib/$djl", |
| 117 | ++ "linux-ppc64le/cpu/libtokenizers.so" to "$tokenizers/jnilib/$djl", |
| 118 | + "linux-x86_64/cpu/libtokenizers.so" to "$tokenizers/jnilib/$djl", |
| 119 | + "linux-aarch64/cpu/libtokenizers.so" to "$tokenizers/jnilib/$djl", |
| 120 | + "osx-aarch64/cpu/libtokenizers.dylib" to "$tokenizers/jnilib/$djl" |
| 121 | +diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml |
| 122 | +index fcb16e641..d6db2877b 100644 |
| 123 | +--- a/gradle/libs.versions.toml |
| 124 | ++++ b/gradle/libs.versions.toml |
| 125 | +@@ -3,7 +3,7 @@ format.version = "1.1" |
| 126 | + |
| 127 | + [versions] |
| 128 | + djl = "0.33.0" |
| 129 | +-pytorch = "2.5.1" |
| 130 | ++pytorch = "2.9.1" |
| 131 | + tensorflow = "2.16.1" |
| 132 | + tensorflowCore = "1.0.0-rc.1" |
| 133 | + mxnet = "1.9.1" |
0 commit comments