This commit is contained in:
Josh Yan 2024-07-09 17:12:02 -07:00
parent 369113970a
commit e59453982d

View File

@ -11,7 +11,7 @@ package llm
// #include <stdlib.h> // #include <stdlib.h>
// #include "llama.h" // #include "llama.h"
// bool update_quantize_progress(float progress, void* data) { // bool update_quantize_progress(float progress, void* data) {
// *((float*)data) = 5; // *((float*)data) = progress;
// return true; // return true;
// } // }
import "C" import "C"
@ -58,12 +58,11 @@ func Quantize(infile, outfile string, ftype fileType, fn func(resp api.ProgressR
for { for {
select { select {
case <-ticker.C: case <-ticker.C:
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(*((*C.float)(store))*100)),
Quantize: "quant", Quantize: "quant",
}) })
fmt.Println("Progress: ", progress) fmt.Println("Progress: ", *((*C.float)(store)))
case <-done: case <-done:
fn(api.ProgressResponse{ fn(api.ProgressResponse{
Status: "quantizing model", Status: "quantizing model",