Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c89c6de

Browse files
committed
Merge branch 'main' into generic-vlm-chat-format
2 parents 22c55cd + 97fb860 commit c89c6de

12 files changed

+140
-127
lines changed

.github/workflows/build-and-release.yaml

+10-11
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
os: [ubuntu-20.04, windows-2019, macos-11]
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
with:
1919
submodules: "recursive"
2020

2121
# Used to host cibuildwheel
22-
- uses: actions/setup-python@v3
22+
- uses: actions/setup-python@v5
2323
with:
2424
python-version: "3.8"
2525

@@ -37,7 +37,7 @@ jobs:
3737
package-dir: .
3838
output-dir: wheelhouse
3939

40-
- uses: actions/upload-artifact@v3
40+
- uses: actions/upload-artifact@v4
4141
with:
4242
path: ./wheelhouse/*.whl
4343

@@ -62,23 +62,22 @@ jobs:
6262
CIBW_ARCHS: "aarch64"
6363
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
6464
with:
65-
output-dir: wheelhouse/
65+
output-dir: wheelhouse
6666

6767
- name: Upload wheels as artifacts
6868
uses: actions/upload-artifact@v4
6969
with:
70-
name: wheels-${{ matrix.version }}
71-
path: wheelhouse/*.whl
70+
path: ./wheelhouse/*.whl
7271

7372
build_sdist:
7473
name: Build source distribution
7574
runs-on: ubuntu-latest
7675

7776
steps:
78-
- uses: actions/checkout@v3
77+
- uses: actions/checkout@v4
7978
with:
8079
submodules: "recursive"
81-
- uses: actions/setup-python@v3
80+
- uses: actions/setup-python@v5
8281
with:
8382
python-version: "3.8"
8483
- name: Install dependencies
@@ -88,7 +87,7 @@ jobs:
8887
- name: Build source distribution
8988
run: |
9089
python -m build --sdist
91-
- uses: actions/upload-artifact@v3
90+
- uses: actions/upload-artifact@v4
9291
with:
9392
path: ./dist/*.tar.gz
9493

@@ -102,8 +101,8 @@ jobs:
102101
with:
103102
name: artifact
104103
path: dist
105-
- uses: softprops/action-gh-release@v1
104+
- uses: softprops/action-gh-release@v2
106105
with:
107106
files: dist/*
108107
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-docker.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
submodules: "recursive"
1818

1919
- name: Set up QEMU
20-
uses: docker/setup-qemu-action@v2
20+
uses: docker/setup-qemu-action@v3
2121

2222
- name: Set up Docker Buildx
23-
uses: docker/setup-buildx-action@v2
23+
uses: docker/setup-buildx-action@v3
2424

2525
- name: Login to GitHub Container Registry
2626
uses: docker/login-action@v3

.github/workflows/build-wheels-cuda.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
$matrix = @{
2323
'os' = @('ubuntu-20.04', 'windows-latest')
2424
'pyver' = @("3.10", "3.11", "3.12")
25-
'cuda' = @("12.1.1", "12.2.2", "12.3.2")
25+
'cuda' = @("12.1.1", "12.2.2", "12.3.2", "12.4.1")
2626
'releasetag' = @("basic")
2727
}
2828
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
submodules: "recursive"
4949

50-
- uses: actions/setup-python@v4
50+
- uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ matrix.pyver }}
5353

@@ -74,7 +74,7 @@ jobs:
7474
if: runner.os == 'Windows' && steps.vs-integration-cache.outputs.cache-hit != 'true'
7575
run: |
7676
if ($env:CUDAVER -eq '12.1.1') {$x = '12.1.0'} else {$x = $env:CUDAVER}
77-
$links = (Invoke-RestMethod 'https://github.com/Jimver/cuda-toolkit/raw/dc0ca7bb29c5a92f7a963d3d5c93f8d59765136a/src/links/windows-links.ts').Trim().split().where({$_ -ne ''})
77+
$links = (Invoke-RestMethod 'https://raw.githubusercontent.com/Jimver/cuda-toolkit/master/src/links/windows-links.ts').Trim().split().where({$_ -ne ''})
7878
for ($i=$q=0;$i -lt $links.count -and $q -lt 2;$i++) {if ($links[$i] -eq "'$x',") {$q++}}
7979
Invoke-RestMethod $links[$i].Trim("'") -OutFile 'cudainstaller.zip'
8080
& 'C:\Program Files\7-Zip\7z.exe' e cudainstaller.zip -oMSBuildExtensions -r *\MSBuildExtensions\* > $null
@@ -122,7 +122,7 @@ jobs:
122122
# write the build tag to the output
123123
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
124124
125-
- uses: softprops/action-gh-release@v1
125+
- uses: softprops/action-gh-release@v2
126126
with:
127127
files: dist/*
128128
# Set tag_name to <tag>-cu<cuda_version>

.github/workflows/generate-index-from-release.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@v4
3333
- name: Setup Pages
34-
uses: actions/configure-pages@v4
34+
uses: actions/configure-pages@v5
3535
- name: Build
3636
run: |
3737
./scripts/releases-to-pep-503.sh index/whl/cpu '^[v]?[0-9]+\.[0-9]+\.[0-9]+$'
3838
./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu121$'
3939
./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu122$'
40+
./scripts/releases-to-pep-503.sh index/whl/cu123 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu123$'
41+
./scripts/releases-to-pep-503.sh index/whl/cu124 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$'
4042
./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+-metal$'
4143
- name: Upload artifact
4244
uses: actions/upload-pages-artifact@v3

.github/workflows/publish-to-test.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
with:
2121
submodules: "recursive"
2222
- name: Set up Python
23-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.8"
2626
- name: Append Dev Version to __version__
@@ -40,4 +40,4 @@ jobs:
4040
uses: pypa/gh-action-pypi-publish@release/v1
4141
with:
4242
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
43-
repository-url: https://test.pypi.org/legacy/
43+
repository-url: https://test.pypi.org/legacy/

.github/workflows/publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
submodules: "recursive"
1616
- name: Set up Python
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.8"
2020
- name: Install dependencies

.github/workflows/test-pypi.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1212

1313
steps:
1414
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@v5
1616
with:
1717
python-version: ${{ matrix.python-version }}
1818
- name: Install dependencies
@@ -28,11 +28,11 @@ jobs:
2828
runs-on: windows-latest
2929
strategy:
3030
matrix:
31-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
31+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
3232

3333
steps:
3434
- name: Set up Python ${{ matrix.python-version }}
35-
uses: actions/setup-python@v4
35+
uses: actions/setup-python@v5
3636
with:
3737
python-version: ${{ matrix.python-version }}
3838
- name: Install dependencies
@@ -48,11 +48,11 @@ jobs:
4848
runs-on: macos-latest
4949
strategy:
5050
matrix:
51-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
51+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
5252

5353
steps:
5454
- name: Set up Python ${{ matrix.python-version }}
55-
uses: actions/setup-python@v4
55+
uses: actions/setup-python@v5
5656
with:
5757
python-version: ${{ matrix.python-version }}
5858
- name: Install dependencies
@@ -61,4 +61,4 @@ jobs:
6161
python3 -m pip install --verbose llama-cpp-python[all]
6262
- name: Test with pytest
6363
run: |
64-
python3 -c "import llama_cpp"
64+
python3 -c "import llama_cpp"

.github/workflows/test.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
submodules: "recursive"
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install dependencies
@@ -40,11 +40,11 @@ jobs:
4040
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4141

4242
steps:
43-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@v4
4444
with:
4545
submodules: "recursive"
4646
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v4
47+
uses: actions/setup-python@v5
4848
with:
4949
python-version: ${{ matrix.python-version }}
5050
- name: Install dependencies
@@ -63,11 +63,11 @@ jobs:
6363
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
6464

6565
steps:
66-
- uses: actions/checkout@v3
66+
- uses: actions/checkout@v4
6767
with:
6868
submodules: "recursive"
6969
- name: Set up Python ${{ matrix.python-version }}
70-
uses: actions/setup-python@v4
70+
uses: actions/setup-python@v5
7171
with:
7272
python-version: ${{ matrix.python-version }}
7373
- name: Install dependencies
@@ -83,11 +83,11 @@ jobs:
8383
# runs-on: ubuntu-latest
8484

8585
# steps:
86-
# - uses: actions/checkout@v3
86+
# - uses: actions/checkout@v4
8787
# with:
8888
# submodules: "recursive"
8989
# - name: Set up Python 3.8
90-
# uses: actions/setup-python@v4
90+
# uses: actions/setup-python@v5
9191
# with:
9292
# python-version: "3.8"
9393
# - name: Set up OpenCL & CLBlast
@@ -110,11 +110,11 @@ jobs:
110110
runs-on: macos-13
111111

112112
steps:
113-
- uses: actions/checkout@v3
113+
- uses: actions/checkout@v4
114114
with:
115115
submodules: "recursive"
116116
- name: Set up Python 3.8
117-
uses: actions/setup-python@v4
117+
uses: actions/setup-python@v5
118118
with:
119119
python-version: "3.8"
120120
- name: Install dependencies

llama_cpp/llama.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
vocab_only: bool = False,
7474
use_mmap: bool = True,
7575
use_mlock: bool = False,
76-
kv_overrides: Optional[Dict[str, Union[bool, int, float]]] = None,
76+
kv_overrides: Optional[Dict[str, Union[bool, int, float, str]]] = None,
7777
# Context Params
7878
seed: int = llama_cpp.LLAMA_DEFAULT_SEED,
7979
n_ctx: int = 512,
@@ -254,6 +254,13 @@ def __init__(
254254
elif isinstance(v, float):
255255
self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_TYPE_FLOAT
256256
self._kv_overrides_array[i].value.float_value = v
257+
elif isinstance(v, str): # type: ignore
258+
v_bytes = v.encode("utf-8")
259+
if len(v_bytes) > 128: # TODO: Make this a constant
260+
raise ValueError(f"Value for {k} is too long: {v}")
261+
v_bytes = v_bytes.ljust(128, b"\0")
262+
self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_TYPE_STR
263+
self._kv_overrides_array[i].value.str_value[:128] = v_bytes
257264
else:
258265
raise ValueError(f"Unknown value type for {k}: {v}")
259266

0 commit comments

Comments
 (0)