Closed skanga closed 7 months ago
Feel free to incorporate this a "DownloadCommand" within JlamaCli, etc or leave it as a standalone CLI program
Also for the run-cli.sh stuff I just created a run-cli.bat file like this:
java -server -Dstdout.encoding=UTF-8 -Xmx12g -Djdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK=0 --add-modules=jdk.incubator.vector --add-exports java.base/sun.nio.ch=ALL-UNNAMED --enable-preview --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions -XX:CompilerDirectivesFile=./inlinerules.json -XX:+AlignVector -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -Dlogback.configurationFile=./conf/logback.xml -jar ./jlama-cli/target/jlama-cli.jar %*
Ah! Looks like it uses some native library and won't work anyways on Windows :-(
14:47:34.937 [main] WARN c.g.t.j.t.o.TensorOperationsProvider - Error loading native operations
java.lang.UnsatisfiedLinkError: no jlama in java.library.path: c:\java\jdk-21.0.1\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;c:\java\jdk-21.0.1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;.
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
at java.base/java.lang.System.loadLibrary(System.java:2059)
at com.github.tjake.jlama.tensor.operations.cnative.RuntimeHelper.<clinit>(RuntimeHelper.java:43)
at com.github.tjake.jlama.tensor.operations.cnative.NativeSimd.<clinit>(NativeSimd.java:19)
at com.github.tjake.jlama.tensor.operations.NativeTensorOperations.<clinit>(NativeTensorOperations.java:13)
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:39)
at com.github.tjake.jlama.tensor.operations.TensorOperationsProvider.<init>(TensorOperationsProvider.java:31)
at com.github.tjake.jlama.tensor.operations.TensorOperationsProvider.get(TensorOperationsProvider.java:22)
at com.github.tjake.jlama.cli.JlamaCli.<clinit>(JlamaCli.java:26)
14:47:34.944 [main] INFO c.g.tjake.jlama.util.MachineSpec - Machine Vector Spec: AVX_256
14:47:34.945 [main] INFO c.g.tjake.jlama.util.MachineSpec - Byte Order: LITTLE_ENDIAN
14:47:34.957 [main] INFO c.g.t.j.t.o.TensorOperationsProvider - Using Panama Vector Operations
14:47:35.982 [main] INFO c.g.tjake.jlama.model.AbstractModel - Working memory type = F32, Quantized memory type = I8
14:47:37.495 [main] INFO c.g.t.jlama.model.llama.LlamaModel - Model loaded!
14:47:37.701 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n - RESTEASY002225: Deploying javax.ws.rs.core.Application: class com.github.tjake.jlama.cli.serve.JlamaRestApi
14:47:37.704 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n - RESTEASY002205: Adding provider class org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider from Application class com.github.tjake.jlama.cli.serve.JlamaRestApi
Very cool thank you @skanga I'll add this to the cli as you suggest
Ah! Looks like it uses some native library and won't work anyways on Windows :-(
Maybe you can try with Windows WSL. Good work @skanga!
R
Hey @skanga I added a modified version of this to the cli. Thanks for the help!
Hey @skanga I added a modified version of this to the cli. Thanks for the help!
Hey thanks @tjake
I have figured out how to build Jlama easily on Windows (natively without WSL). Do you want me to add instructions somewhere? In the readme? Here?
I will just mention here anyway ...
:: Install w64devkit & add to path - https://github.com/skeeto/w64devkit/releases
wget https://github.com/skeeto/w64devkit/releases/download/v1.21.0/w64devkit-fortran-1.21.0.zip
unzip w64devkit-fortran-1.21.0.zip
set PATH=<wherever-you-installed-it>\w64devkit\bin;%PATH%
mvn clean package
run-cli download tjake/llama2-7b-chat-hf-jlama-Q4
run-cli serve models/llama2-7b-chat-hf-jlama-Q4
Writing it in Java itself will solve that. So I did. Happy to contribute it so here you go FWIW