Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b33c447
updating code to match to match llamacpp tag b4689
Feb 12, 2025
a718e2e
replacing local model with modelWithUri
Feb 12, 2025
5745611
updating version and readme and parameter.
Feb 12, 2025
0913373
adding releaseTask and updated test to match workflow
Feb 13, 2025
7c54bd3
replacing the modelPath
Feb 13, 2025
d87a103
adding chat format and LLAMA_CURL=ON to build
Feb 13, 2025
b7962aa
updating version to latest.
Feb 14, 2025
dcb14ff
reverting to older version of llamacpp
Feb 14, 2025
e9b3d52
adding tool support
Feb 15, 2025
ea1327a
adding condition for Grammar
Feb 15, 2025
9fbebba
fixing code for apply template
Feb 15, 2025
22cefc5
install libcurl in github workflows
kherud Feb 16, 2025
60ab2f6
Merge branch 'b4689' of https://github.com/vaiju1981/java-llama.cpp i…
Feb 18, 2025
2f8d2b0
updating test case to make codellama model
Feb 21, 2025
54bf4bd
updating to add speculative execution.
Feb 21, 2025
15dbe68
updating dependency to latest llamacpp version
Mar 6, 2025
c00de24
removed releaseTask
Mar 6, 2025
7a3f672
updated to remove unused and duplicate imports
Mar 6, 2025
cc8f132
adding x64 arch for windows
Mar 7, 2025
27dacab
updating windows workflow to copy all the dlls
Mar 7, 2025
036e020
updating windows workflow.
Mar 7, 2025
aef5b69
validated yml file using lint
Mar 7, 2025
6ea33c3
trying few suggestion
Mar 7, 2025
230b72f
update the workflow path
Mar 7, 2025
746c31a
trying to find which library we are missing
Mar 7, 2025
8b5de74
update the workflow path
Mar 8, 2025
e0efe9f
update the workflow path
Mar 8, 2025
12220ea
update the workflow path
Mar 8, 2025
859844f
update the workflow path
Mar 8, 2025
ed2421c
update the workflow path
Mar 8, 2025
605c600
update the workflow path
Mar 8, 2025
d267776
update the workflow path
Mar 8, 2025
2e8be8a
update the workflow path
Mar 8, 2025
f7bc392
update the workflow path
Mar 8, 2025
932fac3
removing curl support from windows
Mar 8, 2025
8942628
adding copy and verify step
Mar 8, 2025
28c17b8
adding copy and verify step
Mar 8, 2025
0b304b8
statically link dependencies
kherud Mar 8, 2025
a93a79e
ci workflow disable curl build
kherud Mar 8, 2025
01c202b
ci workflow enable llama metal
kherud Mar 8, 2025
6c70a31
ignore logging test
kherud Mar 8, 2025
be6e34a
ci workflow disable native ggml windows build
kherud Mar 8, 2025
e9df628
ci workflow upload windows libraries
kherud Mar 8, 2025
20a7df4
ci workflow build windows in release-debug mode
kherud Mar 8, 2025
b9bc6f3
cmakelists add windows relwithdebinfo output path
kherud Mar 8, 2025
3c5b489
ci workflow build windows in debug mode
kherud Mar 8, 2025
50129c9
add debug statements to jni load
kherud Mar 8, 2025
4481c1c
ci workflow windows use zulu 17
kherud Mar 9, 2025
d549764
defer llama backend initialization
kherud Mar 9, 2025
66b31d9
statically link windows system libraries
kherud Mar 9, 2025
5e6c5c9
remove static linking and use older msvc in release workflow
kherud Mar 9, 2025
f6ca909
initialize llama backend on jni load and remove cmake debug statements
kherud Mar 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 20 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# This work flow runs all Java tests for continuous integration.
# Since it has to build llama.cpp first, for speed, it only runs / tests on the natively supported GitHub runners.

---
name: Continuous Integration
on: [ "pull_request", "workflow_dispatch" ]
on:
- pull_request
- workflow_dispatch
env:
MODEL_URL: "https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/resolve/main/codellama-7b.Q2_K.gguf"
MODEL_NAME: "codellama-7b.Q2_K.gguf"
MODEL_URL: https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/resolve/main/codellama-7b.Q2_K.gguf
MODEL_NAME: codellama-7b.Q2_K.gguf
jobs:

# don't split build and test jobs to keep the workflow simple
build-and-test-linux:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
distribution: zulu
java-version: "11"
- name: Build libraries
# cmake should figure out OS and ARCH automatically when running build.sh (but we need mvn compile for it)
run: |
mvn compile
.github/build.sh -DLLAMA_VERBOSE=ON
Expand All @@ -41,20 +39,16 @@ jobs:
fail-fast: false
matrix:
target:
- {
runner: macos-13,
cmake: '-DLLAMA_METAL=OFF -DLLAMA_VERBOSE=ON'
}
- {
runner: macos-14,
cmake: '-DLLAMA_METAL_EMBED_LIBRARY=ON -DLLAMA_METAL=OFF -DLLAMA_VERBOSE=ON'
}
- runner: macos-13
cmake: -DLLAMA_METAL=OFF -DLLAMA_VERBOSE=ON
- runner: macos-14
cmake: -DLLAMA_METAL_EMBED_LIBRARY=ON -DLLAMA_VERBOSE=ON
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
distribution: zulu
java-version: "11"
- name: Build libraries
run: |
mvn compile
Expand All @@ -71,8 +65,8 @@ jobs:
if-no-files-found: warn

build-and-test-windows:
name: windows-latest
runs-on: windows-latest
name: windows-2019
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -90,6 +84,8 @@ jobs:
- if: failure()
uses: actions/upload-artifact@v4
with:
name: error-log-windows
path: ${{ github.workspace }}\hs_err_pid*.log
name: windows-output
path: |
${{ github.workspace }}\hs_err_pid*.log
${{ github.workspace }}/src/main/resources/de/kherud/llama/**/*
if-no-files-found: warn
6 changes: 5 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install libcurl
run: sudo apt-get install -y libcurl4-openssl-dev
- name: Build libraries
shell: bash
run: |
Expand Down Expand Up @@ -121,10 +123,12 @@ jobs:
}
steps:
- uses: actions/checkout@v4
- name: Install curl
run: vcpkg install curl
- name: Build libraries
shell: cmd
run: |
.github\build.bat ${{ matrix.target.cmake }} -DOS_NAME=${{ matrix.target.os }} -DOS_ARCH=${{ matrix.target.arch }}
.github\build.bat ${{ matrix.target.cmake }} -DOS_NAME=${{ matrix.target.os }} -DOS_ARCH=${{ matrix.target.arch }} -DCURL_LIBRARY=C:/vcpkg/packages/curl_x64-windows/lib/libcurl.lib -DCURL_INCLUDE_DIR=C:/vcpkg/packages/curl_x64-windows/include
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea
target
build
cmake-build-*
.DS_Store
.directory
.vscode
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include(FetchContent)

set(BUILD_SHARED_LIBS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_SHARED_LIBS OFF)

option(LLAMA_VERBOSE "llama: verbose output" OFF)

Expand All @@ -20,10 +21,11 @@ FetchContent_MakeAvailable(json)

#################### llama.cpp ####################

set(LLAMA_BUILD_COMMON ON)
FetchContent_Declare(
llama.cpp
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
GIT_TAG b3534
GIT_TAG b4831
)
FetchContent_MakeAvailable(llama.cpp)

Expand Down Expand Up @@ -102,9 +104,10 @@ target_compile_definitions(jllama PRIVATE
)

if(OS_NAME STREQUAL "Windows")
set_target_properties(jllama llama ggml PROPERTIES
set_target_properties(jllama llama ggml PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${JLLAMA_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${JLLAMA_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${JLLAMA_DIR}
)
else()
set_target_properties(jllama llama ggml PROPERTIES
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Access this library via Maven:
<dependency>
<groupId>de.kherud</groupId>
<artifactId>llama</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</dependency>
```

Expand All @@ -37,7 +37,7 @@ Bu default the default library artifact is built only with CPU inference support
<dependency>
<groupId>de.kherud</groupId>
<artifactId>llama</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<classifier>cuda12-linux-x86-64</classifier>
</dependency>
```
Expand Down Expand Up @@ -78,7 +78,7 @@ cmake --build build --config Release
```

> [!TIP]
> Use `-DGGML_CURL=ON` to download models via Java code using `ModelParameters#setModelUrl(String)`.
> Use `-DLLAMA_CURL=ON` to download models via Java code using `ModelParameters#setModelUrl(String)`.

All compiled libraries will be put in a resources directory matching your platform, which will appear in the cmake output. For example something like:

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>de.kherud</groupId>
<artifactId>llama</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
Loading