https://kotlinlang.org logo
Join SlackCommunities
Powered by
# kotlindl
  • a

    Alex

    02/19/2023, 3:16 AM
    Are there any guides how to use the following library(indicated below), i was trying import the following library and it did not work
    Copy code
    kotlin-deeplearning-visualization
    j
    • 2
    • 2
  • a

    Alexandre Brown

    02/22/2023, 1:46 AM
    Hello, does KotlinDL have something similar to PyTorch funftional API for stateless operations (eg: Softmax, Sigmoid)? Would be nice to have it expect a Multik ndarray
    z
    • 2
    • 4
  • z

    zt

    02/23/2023, 10:57 PM
    Could I use KotlinDL to get basic text generation going, and how?
  • a

    Alex

    02/24/2023, 6:25 AM
    I was playing around with Kotlin dataframes and came across this example called Titanic. https://github.com/Kotlin/dataframe/blob/master/examples/idea-examples/titanic/src[…]/org/jetbrains/kotlinx/dataframe/examples/titanic/ml/titanic.kt While trying to run it on my IDE i noticed this entry, where do i get this titanic.ml from so i can run it and see what it does
    Copy code
    package <http://org.jetbrains.kotlinx.dataframe.examples.titanic.ml|org.jetbrains.kotlinx.dataframe.examples.titanic.ml>
    n
    • 2
    • 3
  • l

    Luc Girardin

    03/03/2023, 10:54 PM
    Hello everyone! I am wondering whether KotlinDL supports multi-output regressions, where one predict more than one numerical value? I had a look at OnHeapDataset.create() but it seems to only accept one-dimensional FloatArray as labels. However, predictSoftly() seems to support such output so I am a bit confused!
    j
    • 2
    • 3
  • d

    darkmoon_uk

    03/22/2023, 11:06 AM
    Topical: what would it take to have KotlinDL drive the inference for Metas recently released LLaMA language model? ...and thereby integrate its abilities into Kotlin Apps. We can observe that the pytorch based source for llama.cpp and vanilla-llama is not so huge, can we expect to achieve similar via KotlinDL ONNX integration? Or can someone tell me I'm barking up the wrong tree?
    h
    • 2
    • 6
  • s

    spierce7

    03/27/2023, 6:49 PM
    How difficult would it be to use something like kotlindl to recognize objects in a video game screen shot?
    z
    • 2
    • 2
  • g

    Giraudon

    04/03/2023, 2:19 PM
    *Julia Beliaeva*  [21 h 06]
    Hi, no, it's not possible right now. You'll need to train your model elsewhere and convert it to onnx format to use with KotlinDL in Android.
    Was an answer provided 3 months ago ... is it still current ? I mean : will it be a version of Kotlin DL allowing you to train a model, from scratch, within an Android phone , using local data,? because in fact, i believe .. this is the “graal”, most of us are waiting for ! then the next question is : can we write code using current kotlin-DL .. that will run calculations used in a training process ? by advance thanks a lot for your help Vinz
    z
    • 2
    • 3
  • z

    zaleslaw

    04/13/2023, 7:52 AM
    If someone joined KotlinConf and interested to share his experience with KotlinDL or another Science/ML libraries or ask any questions, feel free DM me
    h
    • 2
    • 1
  • s

    Stefan Oltmann

    04/14/2023, 4:58 AM
    Looking forward your talk today. I just wait for support of the ArcFace face recognition model until I can add KotlinDL to my production app Ashampoo Photos for person smart albums. Hope this is on your roadmap. 🙂
    👌 1
    metal 2
  • z

    zaleslaw

    05/22/2023, 2:31 PM
    We released the bug fix release 0.5.2. It includes some fixes for hot user requests for their needs and an upgrade of the ONNX version to run all the ONNX models on M1/M2 Mac machines https://github.com/Kotlin/kotlindl/releases/tag/v0.5.2
    🥳 6
    r
    • 2
    • 2
  • z

    zaleslaw

    05/22/2023, 2:33 PM
    If somebody of you're are in Berlin, join the talk about KotlinDL/Kotlin Notebooks and other DS-related topics on the KUG Berlin on 25th May https://www.meetup.com/kotlin-berlin/events/293449017/
  • s

    spierce7

    08/26/2023, 2:45 PM
    Is it possible to access the facebook m4t model in Kotlin? I don't know much about machine learning models https://github.com/facebookresearch/seamless_communication
    z
    • 2
    • 1
  • m

    Marcus Cvjeticanin

    08/31/2023, 12:32 PM
    Hi folks, I'm not sure I'm allowed to share this here. But just remove it if that's the case. However I created a Machine Learning community on Twitter (X) if anyone interested would like to join: https://twitter.com/i/communities/1696789306960932967
  • j

    James Yox

    09/05/2023, 1:00 AM
    Has anyone managed to use the yolov4 model from the onnx model zoo in KotlinDL? I have been trying to get it to work similar to this PR https://github.com/Kotlin/kotlindl/pull/253 I think this PR is also pretty out of date at this point but it helped direct me a bit. I am struggling with post processing (I think?). The model documentation contains a lot of python code that I am pretty unfamiliar with. The Kotlin code in that PR makes it look pretty simple but they didn't seem to get usable results and that's exactly where I am stuck. I am not sure if this PR is even correct. I have stuff coming out of the model but it just seems like random gibberish. Lots of negative values, etc... AFAIK I should be getting relative coordinates that are between 0 and 1. I understand generally what I need to do. Structure the flat data into an appropriately shaped tensor
    (1, 52, 52, 3, 85)
    then parse the bounding boxes... I can create a tensor from the data of that shape but when I try to grab the info out It doesn't seem to be a valid representation of bounding boxes... I could be missing many things though since this is my first foray into trying to use anything beyond a super high level library for ML so I could be missing something very obvious. Model Documentation: https://github.com/onnx/models/tree/main/vision/object_detection_segmentation/yolov4
    r
    z
    a
    • 4
    • 7
  • p

    Peter

    10/02/2023, 6:20 AM
    When I add the Multik core and default to my POM file, IntelliJ doesn’t see the packages. I already reset the cache, rebuilt indexes and refresh the projects, but that didn’t fix it. So I cannot use/compile Multik related code. When I try to compile the same file with plain Maven outside IntelliJ, it works fine. So Maven sees the packages and classes inside the modules. I guess this is more an IntelliJ issue than Multik. But on the off-change that other people encountered this problem, anyone knows what might be causing this?
    p
    r
    • 3
    • 7
  • s

    Saher Al-Sous

    10/18/2023, 3:08 PM
    I'm trying to find a way to use `tensorflow`model in
    Spring Boot
    , I loaded the model successfully, and created the needed tensor, but I can't make a call to get the result from the model because of this error:
    Caused by: org.tensorflow.exceptions.TFInvalidArgumentException: Expects arg[0] to be float but uint8 is provided
    I checked the model signature and it was like this:
    Copy code
    Signature for "serving_default":
        Method: "tensorflow/serving/predict"
        Inputs:
            "input_1": dtype=DT_FLOAT, shape=(-1, 299, 299, 3)
        Outputs:
            "dense_3": dtype=DT_FLOAT, shape=(-1, 41)
    
    Signature for "__saved_model_init_op":
        Outputs:
            "__saved_model_init_op": dtype=DT_INVALID, shape=()
    my tensor details are
    DT_UINT8 tensor with shape [299, 299, 3]
    . When I changed my tensor data type into float like this:
    Copy code
    val imageShape = TFloat32.tensorOf(runner.fetch(decodeImage).run()[0].shape())
            val reshape = tf.reshape(
                decodeImage,
                tf.array(
                    -1.0f,
                    imageShape[0].getFloat(),
                    imageShape[1].getFloat(),
                    imageShape[2].getFloat())
                )
    I got this error:
    org.tensorflow.exceptions.TFInvalidArgumentException: Value for attr 'Tshape' of float is not in the list of allowed values: int32, int64
    if someone is curious how I loaded the model, created the tensor and called it, here is the code below Loading the model in `TFServices`:
    Copy code
    fun model(): SavedModelBundle  {
            return SavedModelBundle
                .loader("/home/***/src/main/resources/pd/")
                .withRunOptions(RunOptions.getDefaultInstance())
                .load()
        }
    Building the Tensor and calling the model
    Copy code
    val graph = Graph()
            val session = Session(graph)
            val tf = Ops.create(graph)
            val fileName = tf.constant("/home/***/src/main/resources/keyframe_1294.jpg")
            val readFile = tf.io.readFile(fileName)
            val runner = session.runner()
            val decodingOptions = DecodeJpeg.channels(3)
            val decodeImage = tf.image.decodeJpeg(readFile.contents(), decodingOptions)
            val imageShape = runner.fetch(decodeImage).run()[0].shape()
            val reshape = tf.reshape(
                decodeImage,
                tf.array(
                    -1,
                    imageShape.asArray()[0],
                    imageShape.asArray()[1],
                    imageShape.asArray()[2])
                )
            val tensor = runner.fetch(reshape).run()[0]
            val inputMap = mutableMapOf("input_tensor" to tensor)
            println(tensor.shape())
            println(tensor.dataType())
            println(tensor.asRawTensor())
            val result = tfService.model().function("serving_default").call(inputMap)
    and i used this dependency:
    Copy code
    implementation("org.tensorflow:tensorflow-core-platform:0.5.0")
    Then i changed the whole code, and used the Kotlin Tensorflow dependencies
    Copy code
    implementation("org.jetbrains.kotlinx:kotlin-deeplearning-api:0.5.2")
    implementation("org.jetbrains.kotlinx:kotlin-deeplearning-tensorflow:0.5.2")
    I loaded the model:
    Copy code
    fun myModel(): SavedModel {
            return SavedModel.load("/home/***/src/main/resources/pd/")
        }
    and called for the prediction:
    Copy code
    val file = File("/home/***/src/main/resources/keyframe_1294.jpg")
    val byteArray = ImageIO.read(file)
    val floatArray = ImageConverter.toRawFloatArray(byteArray)
    val myResult = tfService.myModel().predictSoftly(floatArray, "dense_3")
    println(myResult)
    but i got this error:
    Caused by: org.tensorflow.TensorFlowException: Op type not registered 'DisableCopyOnRead' in binary running on My Computer. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)
    tf.contrib.resampler
    should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
    is there a fix for this or a ready example I can learn from? all i want to do is to use my model that i generated using Tensorflow 2 in spring boot application. thank you
    z
    • 2
    • 20
  • a

    Akram Bensalem

    11/08/2023, 11:48 AM
    Is there a possibility to refer a name to a library. For example:
    %use dataframe
    To something similar to this:
    %use dataframe as df
    p
    • 2
    • 1
  • a

    Aaron Vontell

    11/26/2023, 3:58 PM
    Been thinking about playing around with kotlindl - has anyone tried to fine tune llama-2 using kotlin? Thought it would be a fun project
    p
    • 2
    • 2
  • j

    Javokhir Savriev

    12/11/2023, 3:27 AM
    Hi all, I’ve got ONNX model and some Python scripts doing post-processing to give me segmented bounding boxes. Wondering if I can pull off the same thing with KotlinDL. Anyone tried this before? If so, how’d you go about it? Any tips or code snippets would be awesome!
    n
    • 2
    • 1
  • s

    Stefan Oltmann

    01/10/2024, 8:37 PM
    Is KotlinDL still actively in development? Its GitHub repository appears to have limited recent activity, and there are open pull requests awaiting review. Despite its association with the official Kotlin space, does it function more as a side project? 🤔 I'm interested in Face detection & recognition, so UltraFace & ArcFace... what do you use for that in production? Target platforms are JVM, Android & iOS.
    z
    • 2
    • 2
  • j

    Javokhir Savriev

    03/15/2024, 5:23 AM
    Hi, throwing OutOfMemoryError FATAL EXCEPTION for bigger ONNX/ORT models on Android
    n
    • 2
    • 3
  • a

    adambrangenberg

    03/20/2024, 9:21 PM
    I've been following that tutorial to get Gemma running in KotlinDL, however I'm unsure how to parse in the prompt. Could anyone help me with that? https://github.com/Kotlin/kotlindl/blob/master/docs/importing_keras_model.md
    n
    • 2
    • 2
  • c

    Colton Idle

    04/10/2024, 11:40 PM
    Hello! I'm working on a pet project and this is my first time touching ai/ml/llm at all I think my first project is to create a local "RAG" using compose for desktop. I was planning on doing this with ollama with gemma, but would kotlindl help me in my situation? essentially all i want to do is build a compose desktop app that takes in a markdown file, and then have a chat bot where you can chat about the txt file that's passed in.
    a
    z
    • 3
    • 8
  • j

    Javokhir Savriev

    04/22/2024, 3:15 AM
    Hello everyone, I’m working on an Android app that uses KotlinDL. I recently got a YOLOv8 model in ONNX format, and here’s the metadata for the model’s output: • Name: output0 • Type: float32[1,11,8400] How can I extract bounding boxes, confidence scores, and class labels from a YOLOv8 ONNX model output in KotlinDL? Thank you for any guidance you can provide!
    z
    • 2
    • 1
  • m

    Michal Harakal

    05/31/2024, 12:32 PM
    Since april we have tensorflow/java releases moving towards 1.0.0. Are there any plans to move kotlindl to this newer TensorFlow versions. https://github.com/tensorflow/java
    ❤️ 2
    z
    • 2
    • 2
  • s

    Slackbot

    10/03/2024, 7:08 AM
    This message was deleted.
    z
    • 2
    • 1
  • s

    Sanjay

    11/12/2024, 5:15 AM
    Is Kotlindl just a wrapper abound tensorflow-lite for like suing trained models or can I create a model like tensorflow/pytorch? #C01DZU7PW73
    z
    s
    • 3
    • 3
  • u

    [Alpha]-0mega-

    11/18/2024, 9:07 AM
    I see this is not currently actively being developed as much, but I'd just like to express my interest for this library as well. (I use a m1 mac which doesn't support 1.15) I've been experimenting with SMILE and DJL as alternatives so far (which do work) but they are quite a bit more verbose.
    👍 2
    z
    r
    a
    • 4
    • 4
  • d

    darkmoon_uk

    03/08/2025, 9:50 PM
    I want to use the CLIP model to extract feature embeddings from images, then cluster those embeddings, then map those to english descriptions. I understand this to be within the capabilities of the CLIP model, but I'm an ML beginner despite being a seasoned Mobile App Dev. Can anyone give me a sanity check on whether it's feasible to drive this kind of model and process from Kotlin/DL? ...or maybe this would be better suited to TensorFlow/Java lib, albeit driven by Kotlin.
    g
    • 2
    • 5