Skip to content

Commit

Permalink
Fix path to gguf_dump.py
Browse files Browse the repository at this point in the history
  • Loading branch information
countzero committed Jan 9, 2025
2 parents 1c07628 + 44c688d commit c0325d2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.23.0] - 2024-11-26

### Added
- [Server] Add -additionalArguments option

## [1.22.0] - 2024-10-14

### Removed
Expand Down
38 changes: 36 additions & 2 deletions examples/server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Increases the verbosity of the llama.cpp server.
.PARAMETER help
Shows the manual on how to use this script.
.PARAMETER additionalArguments
Adds additional arguments to the llama.cpp server that are not handled by this script.
.EXAMPLE
.\server.ps1 -model "..\vendor\llama.cpp\models\gemma-2-9b-it-IQ4_XS.gguf"
Expand All @@ -48,6 +51,9 @@ Shows the manual on how to use this script.
.EXAMPLE
.\server.ps1 -model "..\vendor\llama.cpp\models\gemma-2-9b-it-IQ4_XS.gguf" -verbose
.EXAMPLE
.\server.ps1 -model "..\vendor\llama.cpp\models\gemma-2-9b-it-IQ4_XS.gguf" -additionalArguments "--no-slots"
#>

Param (
Expand Down Expand Up @@ -117,7 +123,11 @@ Param (
$kvCacheDataType="f16",

[switch]
$help
$help,

[Parameter()]
[String]
$additionalArguments
)

if ($help) {
Expand Down Expand Up @@ -302,7 +312,6 @@ Write-Host "Starting llama.cpp server with custom options at http://127.0.0.1:${
$commandBinary = "${llamaCppPath}\build\bin\Release\llama-server"

$commandArguments = @(
"--n-predict 1024",
"--port '${port}'",
"--model '${model}'",
"--alias '${alias}'",
Expand All @@ -326,7 +335,32 @@ if ($verbose) {
$commandArguments += "--verbose"
}

# Include additional arguments if they are provided via the -additionalArguments parameter.
$additionalArgumentParts = $additionalArguments -split '\s+'
$index = 0
while ($index -lt $additionalArgumentParts.Count) {

$argument = $additionalArgumentParts[$index]

$hasNextArgument = $index + 1 -lt $additionalArgumentParts.Count
$nextArgumentIsValue = ($additionalArgumentParts[$index + 1] -notmatch '^-{1,2}')

if ($hasNextArgument -and $nextArgumentIsValue) {

# It's a key-value pair.
$commandArguments += "$argument $($additionalArgumentParts[$index + 1])"
$index += 2

} else {

# It's a standalone flag.
$commandArguments += "$argument"
$index += 1
}
}

$commandArguments = $commandArguments | ForEach-Object {

if ($commandArguments.IndexOf($_) -ne $commandArguments.Count - 1) {
" $_ ```n"
} else {
Expand Down

0 comments on commit c0325d2

Please sign in to comment.