Jesse Gross eccd4dd8d2 runner.go: Use correct JSON field names for runners
The fields for inference parameters are very similar between the
Ollama API and Ollama/runners. However, some of the names are
slightly different. For these fields (such as NumKeep and
NumPredict), the values from Ollama were never read properly and
defaults were always used.

In the future, we can share a single interface rather than duplicating
structs. However, this keeps the interface consistent with minimal
changes in Ollama as long as we continue to use server.cpp
2024-09-03 21:15:14 -04:00
..
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:13 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00
2024-09-03 21:15:14 -04:00

llama

Note: this package is not used in Ollama yet. For now, see the llm package.

This package integrates the llama.cpp library as a Go package and makes it easy to build it with tags for different CPU and GPU processors.

Supported:

  • CPU
  • avx, avx2
  • macOS Metal
  • Windows CUDA
  • Windows ROCm
  • Linux CUDA
  • Linux ROCm
  • Llava

Extra build steps are required for CUDA and ROCm on Windows since nvcc and hipcc both require using msvc as the host compiler. For these shared libraries are created:

  • ggml_cuda.dll on Windows or ggml_cuda.so on Linux
  • ggml_hipblas.dll on Windows or ggml_hipblas.so on Linux

Note: it's important that memory is allocated and freed by the same compiler (e.g. entirely by code compiled with msvc or mingw). Issues from this should be rare, but there are some places where pointers are returned by the CUDA or HIP runtimes and freed elsewhere, causing a a crash. In a future change the same runtime should be used in both cases to avoid crashes.

Building

go build .

AVX

go build -tags avx .

AVX2

# go doesn't recognize `-mfma` as a valid compiler flag
# see https://github.com/golang/go/issues/17895
go env -w "CGO_CFLAGS_ALLOW=-mfma|-mf16c"
go env -w "CGO_CXXFLAGS_ALLOW=-mfma|-mf16c"
go build -tags=avx,avx2 .

Linux

CUDA

Install the CUDA toolkit v11.3.1:

make ggml_cuda.so
go build -tags avx,cuda .

ROCm

Install the CUDA toolkit v11.3.1:

make ggml_hipblas.so
go build -tags avx,rocm .

Windows

Download w64devkit for a simple MinGW development environment.

CUDA

Install the CUDA toolkit v11.3.1 then build the cuda code:

make ggml_cuda.dll
go build -tags avx,cuda .

ROCm

Install ROCm 5.7.1.

make ggml_hipblas.dll
go build -tags avx,rocm .

Building runners

# build all runners for this platform
make -j

Syncing with llama.cpp

To update this package to the latest llama.cpp code, use the sync.sh script:

./sync.sh ../../llama.cpp