Skip to content

Commit

Permalink
m8l4 ML in Kotlin project1
Browse files Browse the repository at this point in the history
  • Loading branch information
svok committed Jun 2, 2024
1 parent 1d86874 commit 6c602b7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ mkpl-cor = { module = "ru.otus.otuskotlin.marketplace.libs:ok-marketplace-lib-co
mkpl-state-common = { module = "ru.otus.otuskotlin.marketplace.state:ok-marketplace-states-common", version.ref = "mkpl" }
mkpl-state-biz = { module = "ru.otus.otuskotlin.marketplace.state:ok-marketplace-states-biz", version.ref = "mkpl" }

# Machine Learning
ml-tokenizer = "ai.djl.huggingface:tokenizers:0.25.0"
ml-onnx-runtime = "com.microsoft.onnxruntime:onnxruntime:1.16.3"

[bundles]
kotest = ["kotest-junit5", "kotest-core", "kotest-datatest", "kotest-property"]
Expand Down
25 changes: 9 additions & 16 deletions ok-marketplace-ml/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
plugins {
kotlin("jvm") version "1.9.21"
id("build-jvm")
}

group = "ru.otus.otuskotlin.ml"
version = "0.0."

repositories {
mavenCentral()
}
group = "ru.otus.otuskotlin.marketplace.ml"
version = "0.0.1"

dependencies {
implementation("com.microsoft.onnxruntime:onnxruntime:1.16.3")
implementation("ai.djl.huggingface:tokenizers:0.25.0")
implementation("org.slf4j:slf4j-api:2.0.9")
implementation(libs.ml.onnx.runtime)
implementation(libs.ml.tokenizer)
implementation(libs.logback)

testImplementation(kotlin("test-junit5"))
}
Expand All @@ -23,11 +19,8 @@ tasks {
}
}

kotlin {
javaToolchains {
javadocToolFor {
languageVersion.set(JavaLanguageVersion.of(17))
}

allprojects {
repositories {
mavenCentral()
}
}
21 changes: 21 additions & 0 deletions ok-marketplace-ml/onnx-model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Предобученная модель

*Внимание!* Эти файлы занимают очень много места. Поэтому их нужно помещать не в GIT, а в GIT-LFS.

Для этого у вас должен быть установлен пакет `git-lfs`.
```bash
sudo apt install git-lfs
```

В _корне проекта_ нужно отметить те файлы, которые будут попадать в `git-lfs`:
```bash
git lfs install
git lfs track *.onnx_data *.onnx
```
После этого у вас должен появиться файл `<root project dir>/.gitattributes` со следующим содержимым:
```
*.onnx_data filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
```

После этого файлы можно добавлять обычным способом, они не будут обрабатываться самим `git`, их будет обслуживать `git-lfs`.
5 changes: 1 addition & 4 deletions ok-marketplace-ml/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = "ok-marketplace-states"
rootProject.name = "ok-marketplace-ml"

dependencyResolutionManagement {
versionCatalogs {
Expand Down Expand Up @@ -27,6 +27,3 @@ plugins {
// Включает вот такую конструкцию
//implementation(projects.m2l5Gradle.sub1.ssub1)
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

include(":ok-marketplace-states-common")
include(":ok-marketplace-states-biz")
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ includeBuild("ok-marketplace-states")
includeBuild("ok-marketplace-libs")

includeBuild("ok-marketplace-tests")
includeBuild("ok-marketplace-ml")
includeBuild("pgkn")

0 comments on commit 6c602b7

Please sign in to comment.