new
This commit is contained in:
parent
9e0b8f1fe2
commit
542134bf50
19
llm/llm.go
19
llm/llm.go
@ -49,17 +49,26 @@ func Quantize(infile, outfile string, ftype fileType, fn func(resp api.ProgressR
|
|||||||
params.quantize_callback_data = store
|
params.quantize_callback_data = store
|
||||||
params.quantize_callback = (C.llama_progress_callback)(C.update_quantize_progress)
|
params.quantize_callback = (C.llama_progress_callback)(C.update_quantize_progress)
|
||||||
|
|
||||||
go func () {
|
ticker := time.NewTicker(60 * time.Millisecond)
|
||||||
|
done := make(chan struct{})
|
||||||
|
defer close(done)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
time.Sleep(60 * time.Millisecond)
|
select {
|
||||||
if params.quantize_callback_data == nil {
|
case <-ticker.C:
|
||||||
return
|
|
||||||
} else {
|
|
||||||
progress := *((*C.float)(store))
|
progress := *((*C.float)(store))
|
||||||
fn(api.ProgressResponse{
|
fn(api.ProgressResponse{
|
||||||
Status: fmt.Sprintf("quantizing model %d%%", int(progress*100)),
|
Status: fmt.Sprintf("quantizing model %d%%", int(progress*100)),
|
||||||
Quantize: "quant",
|
Quantize: "quant",
|
||||||
|
})
|
||||||
|
case <-done:
|
||||||
|
fn(api.ProgressResponse{
|
||||||
|
Status: "quantizing model",
|
||||||
|
Quantize: "quant",
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user