Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b0b241e
add attention lstm rnn gru and dataloader and so on and push the jav…
Apr 3, 2025
132916e
add attention lstm rnn gru and dataloader and so on and push the jav…
Apr 3, 2025
f1d9750
add sparse module
mullerhai Apr 10, 2025
351c710
add sparse module test
mullerhai Apr 11, 2025
7e3ca01
add sparse module test 2
mullerhai Apr 11, 2025
e3f03b4
add jit module
mullerhai Apr 21, 2025
e7130e3
add jit module 2
mullerhai Apr 22, 2025
d948d5e
add RMSNorm and testcase
mullerhai Apr 22, 2025
9912bdb
add lerp hardswish Hardsigmoid activation layer
mullerhai Apr 22, 2025
d43c855
add geglu activation and tensor.chunk
mullerhai Apr 22, 2025
22f7c0a
add norm clip clamp for tensor
mullerhai Apr 22, 2025
85f7392
add release maven config
mullerhai Apr 23, 2025
e8373af
add topk and paramdict paramlist
mullerhai May 4, 2025
02bd2bd
add topk and paramdict paramlist
mullerhai May 4, 2025
e07df0c
add tensor all functions
mullerhai May 5, 2025
36a2935
add tensor all functions2 raw not format
mullerhai May 5, 2025
62fa3f3
add tensor all functions2 raw not format register_module register_p…
mullerhai May 5, 2025
ea99309
add tensor all functions2 raw not format register_module register_p…
mullerhai May 5, 2025
0580090
add tensor all functions2 raw not format register_module register_p…
mullerhai May 6, 2025
d27fd24
add tensor grad_fn and fixup backward() bug ,fix some nn class cann…
mullerhai May 15, 2025
c930d4b
add backward with parameter and device tensor and slice with option…
mullerhai May 15, 2025
dad60c4
add backward with parameter and device tensor fix require_grad para…
mullerhai May 15, 2025
92c3a97
add backward with parameter and device tensor fix require_grad para…
mullerhai May 16, 2025
7a8d52f
fix up Tensor[Int64]|Tensor[Int32]
mullerhai May 16, 2025
8ea9daf
add some indexing opreate
mullerhai May 17, 2025
ae4c6c1
fixup some history not graceful code
mullerhai May 18, 2025
ad16bde
fixup some history not graceful code2
mullerhai May 18, 2025
1e74acc
fixup some history not graceful code3
mullerhai May 18, 2025
261bdbd
fixup some history not graceful code3 and scala format code
mullerhai May 18, 2025
ba87371
fixup some history not graceful code3 and scala format code3
mullerhai May 18, 2025
f46a581
fixup some history not graceful code3 and scala format code add logo …
mullerhai May 19, 2025
206711a
fixup some history not graceful code3 and scala format code add logo 2
mullerhai May 19, 2025
e27679d
update readme
mullerhai May 19, 2025
3b5016c
update readme2
mullerhai May 19, 2025
4830adb
update jitmodule and fixup moduleList append method
mullerhai Jun 13, 2025
3cdbaad
update jitmodule and fixup moduleList append method add numpy pickl…
mullerhai Jun 13, 2025
04e4e72
upgrade version suit with pytorch 2.7.1 !!!
mullerhai Jul 1, 2025
355feaa
support read numpy data NDArray to Tensor, upgrade version !!! "0.3.…
mullerhai Jul 11, 2025
8926aa4
support read numpy data NDArray to Tensor dataloader and Tensorboa…
mullerhai Jul 12, 2025
f448655
fixup some bug,support read numpy data NDArray to Tensor , rename da…
mullerhai Jul 12, 2025
a1a28b6
add pandas Tensorboard, upgrade version !!! "0.4.1-1.15.2"
mullerhai Jul 21, 2025
b66294c
add tensor numpy NDArray convert
mullerhai Aug 1, 2025
db4e54c
add tensor numpy NDArray convert 2
mullerhai Aug 20, 2025
8f879e4
add tensor numpy NDArray convert 3 for torchvision and torchaudio
mullerhai Aug 20, 2025
36474a4
add tensor numpy NDArray convert 4 for torchvision and torchaudio
mullerhai Aug 20, 2025
3ba54f5
add tensor numpy NDArray convert 5 for torchvision and torchaudio
mullerhai Aug 20, 2025
c405025
add tensor numpy NDArray convert 6for torchvision and torchaudio
mullerhai Aug 23, 2025
4159cf9
support Distribute Cuda Gpu training
mullerhai Aug 23, 2025
c5c5bfb
support lr_scheduler
mullerhai Sep 4, 2025
8be3545
support lr_scheduler 2 add set_lr update lr
mullerhai Sep 4, 2025
b50e656
support lr_scheduler 2 add set_lr update functional method
mullerhai Sep 5, 2025
8e48365
support lr_scheduler 2 add set_lr update functional method 3
mullerhai Sep 5, 2025
e1f915d
update nn module && loss method support forward
mullerhai Sep 6, 2025
a1b1fb0
update nn module && loss method support forward3
mullerhai Sep 6, 2025
2a72b38
update data package logit
mullerhai Sep 6, 2025
9e68dfb
update data package logit
mullerhai Sep 6, 2025
5e8a5a1
update data package logit3
mullerhai Sep 6, 2025
327d214
update data package logit4
mullerhai Sep 6, 2025
4a349c8
update optimizer logit
mullerhai Sep 7, 2025
70b6b2a
update activation layer logit
mullerhai Sep 7, 2025
6dcb964
update activation layer logit
mullerhai Sep 7, 2025
9268fe0
update activation layer logit2
mullerhai Sep 7, 2025
923db31
update activation layer logit3
mullerhai Sep 7, 2025
36b70f0
update activation layer logit4 and tensor to numpy NDArray
mullerhai Sep 8, 2025
00acc19
update functional layer
mullerhai Sep 9, 2025
800a06b
update functional layer method with layout scalar
mullerhai Sep 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
78 changes: 70 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,77 @@
# Storch - GPU Accelerated Deep Learning for Scala 3
# AI Infra 3.0: Build Powerful AI Infrastructure for Scala 3
# STorch AI - GPU Accelerated Distributeed Deep Learning && LLM && RL for Scala 3

Storch is a Scala library for fast tensor computations and deep learning, based on PyTorch.

Like PyTorch, Storch provides
* A NumPy like API for working with tensors
* GPU support
* Automatic differentiation
## STorch is a Scala library for fast tensor computations and deep learning, same as PyTorch.

### Like PyTorch, STorch provides
* Both Compile from Cpp LibTorch, STorch has Same Equal Position with Pytorch
* A NumPy like API for working with tensors
* GPU support [Future will support HuaWei CANN NPU]
* Automatic differentiation on Linux | Mac | Windows | IOS | Andriod
* A neural network API for building and training neural networks.
* What All you need Pytorch features could find in STorch !!!
* Minimal time and learning cost migrate from python pytorch developer
* Maximal ROI for Big Data developer and Data Scientist
* Support LLM | Recommend System | Compute Vision | NLP | Financial Tech | RL |Big Data | Data Science Research
* Big Deep Learning Environment Chains boost you concentrate on development
* Support Java SMID Vector API, Please use JDK Version >= 17
* Could Use NCCL | GLOO | RAY | SPARK | FLINK for DISTRIBUTE TRAINING and inference [Future will support UCC | MPI]
* Best Data Driven Process and Monad Feature Engineer Model Pipeline Partner for Apache Spark | Flink | Polar

STorch aims to close to the Python API to make porting existing models and the life of people already familiar with PyTorch easier.

STorch Tutorial ,see here -> https://github.com/mullerhai/storch-tutorial

### STorch LLM -> Scala3gpt-llm is ready to use Pure Pytorch Neural Network for Scala 3 ON LLM
How to fetch STorch Library
```scala 3

libraryDependencies += "io.github.mullerhai" % "storch_core_3" % "0.4.7-1.15.2"

```

# STorch AI Family:
## STorch Numpy
## STorch Pandas
## STorch Tensorboard
## STorch OpenCV
## STorch Ffmpeg
## STorch Librosa
## STorch Spark
## STorch Flink
## STroch Cuda
## STorch TensorRT
## STorch Triton
## STorch Transformers
## Storch Multinmodel
## STorch RL
## STorch Data
## STorch Graph
## STorch Geometric
## STorch Peft
## STorch Vision
## STorch Text
## STorch Audio
## STorch Jieba
## STorch Recommend
## STorch Finance
## STorch Drug
## STorch LLM
## STorch Faiss
## STorch Milvus
## STorch CSV | Pickle | Hdf5 | Parquet | Orc | Avro | Json | Xml | Sql | Hive | Kafka | Redis | Mysql | Postgres | Sqlite | Clickhouse | MongoDB | Cassandra | Redis | Kafka | RabbitMQ | Celery | Polars | Scikit-learn | TensorRT | Triton | Transformers | NLP | Computer Vision | Recommend System | Financial Tech | RL | Big Data | Data Science Research


Storch aims to close to the Python API to make porting existing models and the life of people already familiar with PyTorch easier.
### How to learn STorch
## STorch Tutorial

![storch-1](./docs/images/storch-1.png)
![storch-2](./docs/images/storch-2.png)
![storch-3](./docs/images/storch-3.png)
![storch-4](./docs/images/storch-4.png)
![storch-5](./docs/images/storch-5.png)
![storch-6](./docs/images/storch-6.png)
![storch-7](./docs/images/storch-7.png)
For documentation, see https://storch.dev

## Example:
Expand Down
170 changes: 141 additions & 29 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import sbt._

import Keys._
import MdocPlugin.autoImport._
import LaikaPlugin.autoImport._
import Keys.*
import MdocPlugin.autoImport.*
import LaikaPlugin.autoImport.*
import sbt.Def.settings
import sbtassembly.AssemblyPlugin.assemblySettings

ThisBuild / tlBaseVersion := "0.0" // your current series x.y

ThisBuild / organization := "dev.storch"
ThisBuild / organization := "io.github.mullerhai" //"dev.storch"
ThisBuild / organizationName := "storch.dev"
ThisBuild / startYear := Some(2022)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
// your GitHub handle and name
tlGitHubDev("sbrunk", "Sören Brunk")
tlGitHubDev("sbrunk", "Sören Brunk"),
tlGitHubDev("mullerhai", "mullerhai")
)

// publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead)
Expand All @@ -23,13 +26,13 @@ ThisBuild / tlSitePublishBranch := Some("main")

ThisBuild / apiURL := Some(new URL("https://storch.dev/api/"))

val scrImageVersion = "4.0.34"
val pytorchVersion = "2.1.2"
val cudaVersion = "12.3-8.9"
val openblasVersion = "0.3.26"
val mklVersion = "2024.0"
ThisBuild / scalaVersion := "3.3.1"
ThisBuild / javaCppVersion := "1.5.10"
val scrImageVersion = "4.3.0"
val pytorchVersion = "2.7.1" // "2.5.1"
val cudaVersion = "12.9-9.10" //"12.6-9.5"
val openblasVersion ="0.3.30" //"0.3.28"
val mklVersion = "2025.0"
ThisBuild / scalaVersion := "3.7.2"
ThisBuild / javaCppVersion := "1.5.12" //"1.5.11"
ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("snapshots")

ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
Expand All @@ -39,10 +42,11 @@ val enableGPU = settingKey[Boolean]("enable or disable GPU support")

ThisBuild / enableGPU := false

val hasMKL = {
val firstPlatform = org.bytedeco.sbt.javacpp.Platform.current.head
firstPlatform == "linux-x86_64" || firstPlatform == "windows-x86_64"
}
val hasMKL = false
//val hasMKL = {
// val firstPlatform = org.bytedeco.sbt.javacpp.Platform.current.head
// firstPlatform == "linux-x86_64" || firstPlatform == "windows-x86_64"
//}

lazy val commonSettings = Seq(
Compile / doc / scalacOptions ++= Seq("-groups", "-snippet-compiler:compile"),
Expand Down Expand Up @@ -73,9 +77,43 @@ lazy val commonSettings = Seq(
"tlSonatypeBundleReleaseIfRelevant"
).mkString("; ", "; ", "")
)
publishTo := sonatypePublishToBundle.value
// For all Sonatype accounts created on or after February 2021
//import xerial.sbt.Sonatype.sonatype01

//ThisBuild / sonatypeCredentialHost := sonatype01
import xerial.sbt.Sonatype.sonatypeCentralHost
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost

lazy val core = project
.in(file("core"))
import ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommandAndRemaining("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
libraryDependencies += "io.github.mullerhai" % "storch-scikit-learn_3" % "0.1.1" % Test exclude("org.scala-lang.modules","scala-collection-compat_2.13") exclude("org.typelevel","algebra_2.13")exclude("org.typelevel","cats-kernel_2.13")
// https://mvnrepository.com/artifact/org.bytedeco/cuda
libraryDependencies += "org.bytedeco" % "cuda" % "12.9-9.10-1.5.12"
// https://mvnrepository.com/artifact/org.bytedeco/cuda-platform
libraryDependencies += "org.bytedeco" % "cuda-platform" % "12.9-9.10-1.5.12"
libraryDependencies += "io.github.mullerhai" % "storch-numpy_3" % "0.1.7"
libraryDependencies += "io.github.mullerhai" % "storch-pickle_3" % "0.1.4"
libraryDependencies += "io.github.mullerhai" % "storch-tensorboard-proto_3" % "0.1.1"
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13" ,
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
)
lazy val storch_core = project
.in(file("storch_core"))
.settings(commonSettings)
.settings(
javaCppPresetLibs ++= Seq(
Expand All @@ -93,25 +131,61 @@ lazy val core = project
"com.lihaoyi" %% "os-lib" % "0.9.1",
"com.lihaoyi" %% "sourcecode" % "0.3.0",
"dev.dirs" % "directories" % "26",
"io.github.mullerhai" % "storch-numpy_3" % "0.1.7",
"io.github.mullerhai" % "storch-pandas_3" % "0.1.5",
"io.github.mullerhai" % "storch-pickle_3" % "0.1.4",
"io.github.mullerhai" % "storch-tensorboard-proto_3" % "0.1.1",

// "io.github.mullerhai" % "storch-pickle_3" % "0.1.0",
"org.scalameta" %% "munit" % "0.7.29" % Test,
"org.scalameta" %% "munit-scalacheck" % "0.7.29" % Test
),
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13" ,
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
),
javaOptions ++= Seq(
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-modules=jdk.incubator.vector",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.cs=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.util.calendar=ALL-UNNAMED",
"-Djdk.reflect.useDirectMethodHandle=false",
"-Dio.netty.tryReflectionSetAccessible=true"
)
)

lazy val vision = project
.in(file("vision"))
lazy val storch_vision = project
.in(file("storch_vision"))
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"com.sksamuel.scrimage" % "scrimage-core" % scrImageVersion,
"com.sksamuel.scrimage" % "scrimage-webp" % scrImageVersion,
("com.sksamuel.scrimage" %% "scrimage-scala" % scrImageVersion)
.cross(CrossVersion.for3Use2_13),
"org.scalameta" %% "munit" % "0.7.29" % Test
),
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13",
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
)
)
.dependsOn(core)
.dependsOn(storch_core)

lazy val examples = project
.in(file("examples"))
lazy val storch_examples = project
.in(file("storch_examples"))
.enablePlugins(NoPublishPlugin)
.settings(
commonSettings,
Expand All @@ -124,9 +198,13 @@ lazy val examples = project
"me.tongfei" % "progressbar" % "0.9.5",
"com.github.alexarchambault" %% "case-app" % "2.1.0-M24",
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4"
),
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13",
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
)
)
.dependsOn(vision)
.dependsOn(storch_vision)

lazy val docs = project
.in(file("site"))
Expand All @@ -140,17 +218,51 @@ lazy val docs = project
"MKL_VERSION" -> mklVersion,
"CUDA_VERSION" -> cudaVersion
),
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(examples),
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13",
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
),
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(storch_examples),
Laika / sourceDirectories ++= Seq(sourceDirectory.value),
laikaIncludeAPI := true,
laikaGenerateAPI / mappings := (ScalaUnidoc / packageDoc / mappings).value
)
.dependsOn(vision)
.dependsOn(storch_vision)

lazy val root = project
lazy val storch_root = project
.enablePlugins(NoPublishPlugin)
.in(file("."))
.aggregate(core, vision, examples, docs)
.aggregate(storch_core, storch_vision, storch_examples, docs)
.settings(
javaCppVersion := (ThisBuild / javaCppVersion).value
javaCppVersion := (ThisBuild / javaCppVersion).value,
excludeDependencies ++= Seq(
"com.thesamet.scalapb" % "lenses_2.13",
"com.thesamet.scalapb" % "scalapb-runtime_2.13"
)
)

ThisBuild / assemblyMergeStrategy := {
case v if v.contains("main$package$.class") => MergeStrategy.first
case v if v.contains("main.class") => MergeStrategy.first
case v if v.contains("main$package.class") => MergeStrategy.first
case v if v.contains("main$package.tasty") => MergeStrategy.first
case v if v.contains("main.tasty") => MergeStrategy.first
case v if v.contains("main.class") => MergeStrategy.discard
case v if v.contains("module-info.class") => MergeStrategy.discard
case v if v.contains("UnusedStub") => MergeStrategy.first
case v if v.contains("aopalliance") => MergeStrategy.first
case v if v.contains("inject") => MergeStrategy.first
case v if v.contains("jline") => MergeStrategy.discard
case v if v.contains("scala-asm") => MergeStrategy.discard
case v if v.contains("asm") => MergeStrategy.discard
case v if v.contains("scala-compiler") => MergeStrategy.deduplicate
case v if v.contains("reflect-config.json") => MergeStrategy.discard
case v if v.contains("jni-config.json") => MergeStrategy.discard
case v if v.contains("git.properties") => MergeStrategy.discard
case v if v.contains("reflect.properties") => MergeStrategy.discard
case v if v.contains("compiler.properties") => MergeStrategy.discard
case v if v.contains("scala-collection-compat.properties") => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
Loading