tjake / Jlama

Jlama is a modern LLM inference engine for Java
Apache License 2.0
665 stars 62 forks source link

Error starting jlama #62

Closed AdamBien closed 1 month ago

AdamBien commented 1 month ago

After initial installation with jbang I get:

jlama

06:09:04.959 [main] WARN com.github.tjake.jlama.tensor.operations.TensorOperationsProvider -- Error loading native operations java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/github/tjake/jlama/tensor/operations/cnative/NativeSimd (class file version 65.65535). Try running with '--enable-preview' at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) at com.github.tjake.jlama.tensor.operations.NativeTensorOperations.(NativeTensorOperations.java:38) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:421) at java.base/java.lang.Class.forName(Class.java:412) at com.github.tjake.jlama.tensor.operations.TensorOperationsProvider.pickFastestImplementation(TensorOperationsProvider.java:55) at com.github.tjake.jlama.tensor.operations.TensorOperationsProvider.(TensorOperationsProvider.java:46) at com.github.tjake.jlama.tensor.operations.TensorOperationsProvider.get(TensorOperationsProvider.java:36) at com.github.tjake.jlama.cli.JlamaCli.(JlamaCli.java:31) at jlama.main(jlama.java:22) 06:09:04.963 [main] WARN com.github.tjake.jlama.util.MachineSpec -- Java SIMD Vector API not available. Add --add-modules=jdk.incubator.vector to your JVM options


I'm using:

java -version openjdk version "21" 2023-09-19 LTS

(Apple M3)

tjake commented 1 month ago

This shouldn’t be happening. @maxandersen could you take a look ?

maxandersen commented 1 month ago

@AdamBien can you paste the path of jlama and the contents of jlama ?

Then I can reproduce.

Also if you recall the exact command you used to install that could help.

maxandersen commented 1 month ago

never mind - figured what most likely is going on.

@AdamBien please check what jbang --version says - my guess is you are running a quite old jbang version. one released before preview support was added, i.e. in 2020 https://github.com/jbangdev/jbang/issues/31

you might even be running jbang older than when it could selfupdate.

try run jbang version --update and if updates it should fix it self; if not you'll want to remove that jbang and reinstall it to newer release.

AdamBien commented 1 month ago

@maxandersen I started using jbang with JDK 1.0 :-)

jbang --version 0.68.0

@tjake checkout the hint in the README / pull request: export JDK_JAVA_OPTIONS="--add-modules jdk.incubator.vector --enable-preview"

It's also useful in a maven projects - you don't have to configure plugins. It is just working.

tjake commented 1 month ago

Thanks for checking!