Open elect86 opened 6 months ago
So, I quickly prototyped something like this:
plugins { bioimage.io.jdll }
setEngine {
engine = Framework.torchscript.`1,13,1`
}
setModel {
model = Models.EnhancerMitochondriaEM2D
}
execute = { model, inputsTensor, outputsTensor ->
inputsTensor += buildTensor<FloatType>()
outputsTensor += buildTensor<FloatType>(outputs = true)
println(Util.average(Util.asDoubleArray(outputsTensor.first().data)))
model.runModel(inputsTensor, outputsTensor)
println(Util.average(Util.asDoubleArray(outputsTensor.first().data)))
}
It's a little hacky to get something asap and it works just before the Model::createDeepLearningModel
is called, because then the classloader
concept has to be fixed/reworked, but the idea is that
You can go massively down with requested code (original) and make it truly script (now essentially it's running during Gradle configuration time, with manual caching engine and model)
So, I got pulled in JDLL by the spanish people on Prague
I was looking at the readme and the first thing I thought is that I might help you, folks, with some automatization/template ready to clone and start playing from there
It's based on Kotlin (and some or all in Gradle), I'm pretty confident I could provide something along these lines:
Following the Gradle philosophy of "convention over configuration", we could assume conventions over
framework
and have that step completely optional as well. Something similar forcpu/gpu=true