mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-22 14:53:56 +00:00
llama: add minimum memory for grammar (#10820)
This commit is contained in:
@@ -580,7 +580,7 @@ func SchemaToGrammar(schema []byte) []byte {
|
|||||||
defer C.free(unsafe.Pointer(cStr))
|
defer C.free(unsafe.Pointer(cStr))
|
||||||
|
|
||||||
// Allocate buffer for grammar based on schema length but with upper bound
|
// Allocate buffer for grammar based on schema length but with upper bound
|
||||||
maxLen := min(1024*1024, len(schema)*4)
|
maxLen := max(32768, min(1024*1024, len(schema)*4))
|
||||||
buf := make([]byte, maxLen)
|
buf := make([]byte, maxLen)
|
||||||
|
|
||||||
// Call C function to convert schema to grammar
|
// Call C function to convert schema to grammar
|
||||||
|
|||||||
Reference in New Issue
Block a user