explicit buffer allocation from python
This commit is contained in:
parent
356c1b87ba
commit
29054a2bee
3 changed files with 3 additions and 3 deletions
|
@ -33,7 +33,7 @@ extern "C" {
|
||||||
};
|
};
|
||||||
struct generation_outputs
|
struct generation_outputs
|
||||||
{
|
{
|
||||||
int status;
|
int status = -1;
|
||||||
char text[16384]; //16kb should be enough for any response
|
char text[16384]; //16kb should be enough for any response
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ extern "C" {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
generation_outputs generate(const generation_inputs inputs, generation_outputs output)
|
generation_outputs generate(const generation_inputs inputs, generation_outputs & output)
|
||||||
{
|
{
|
||||||
api_params.prompt = inputs.prompt;
|
api_params.prompt = inputs.prompt;
|
||||||
api_params.seed = inputs.seed;
|
api_params.seed = inputs.seed;
|
||||||
|
|
|
@ -48,7 +48,7 @@ def load_model(model_filename,batch_size=8,max_context_length=512,threads=4,n_pa
|
||||||
|
|
||||||
def generate(prompt,max_length=20,temperature=0.8,top_k=100,top_p=0.85,rep_pen=1.1,rep_pen_range=128,seed=-1,reset_state=True):
|
def generate(prompt,max_length=20,temperature=0.8,top_k=100,top_p=0.85,rep_pen=1.1,rep_pen_range=128,seed=-1,reset_state=True):
|
||||||
inputs = generation_inputs()
|
inputs = generation_inputs()
|
||||||
outputs = generation_outputs()
|
outputs = ctypes.create_unicode_buffer(ctypes.sizeof(generation_outputs))
|
||||||
inputs.prompt = prompt.encode("UTF-8")
|
inputs.prompt = prompt.encode("UTF-8")
|
||||||
inputs.max_length = max_length
|
inputs.max_length = max_length
|
||||||
inputs.temperature = temperature
|
inputs.temperature = temperature
|
||||||
|
|
BIN
llamacpp.dll
BIN
llamacpp.dll
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue