alpaca.cpp icon indicating copy to clipboard operation
alpaca.cpp copied to clipboard

John Smith

Open betolley opened this issue 2 years ago • 6 comments

Why does the chat say its name is "John Smith"?

Is there a way to change it?

betolley avatar Apr 02 '23 03:04 betolley

I asked ALPACA: "Why did you choose this name?"

Answer: John Smith was a popular choice for spies during World War II as it could be easily changed to fit any identity. It also has the advantage of being easy to remember and pronounce in many different languages.

I call him Johnny (https://www.youtube.com/watch?v=S1i5coU-0_Q) :D

multimediaconverter avatar Apr 02 '23 04:04 multimediaconverter

Is there a way to change it?

betolley avatar Apr 02 '23 05:04 betolley

You can start your prompts with something like "Your name is Adam." etc.

multimediaconverter avatar Apr 02 '23 05:04 multimediaconverter

When I do that it works for 1 responce. Is there a way to have it remember? I saw something about puting previous prompts in. Is there a specific format for that?

betolley avatar Apr 02 '23 20:04 betolley

~~The prompt is hard-coded unfortunately. In llama.cpp, you can load arbitrary prompt from a file.~~

~~Sorry I was so stupid that I haven't looked at the condition if(!params.prompt.empty()). Seems like you can modify the prompt with --prompt " Your name is Alpaca. Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n"~~

~~(There's a space in the beginning of string for some reason)~~

https://github.com/antimatter15/alpaca.cpp/blob/master/chat.cpp#L864

ngxson avatar Apr 04 '23 06:04 ngxson

Update: I found a way to control the personality of the bot. The idea is to add prefix to instruction: https://github.com/ngxson/alpaca.cpp/commit/d0b10221a9caad88a28caade75362685594e7c8c#diff-1182fd4edd862ddea695b9781940bb03c02f72172beefe185487e72af5b62f24R959

if (!params.prompt.empty())
    {
        fprintf(stderr, "prompt: %s\n", params.prompt.c_str());
        prompt_inp = ::llama_tokenize(vocab, "### Instruction:\n\n" + params.prompt + ". ", true);
    }

Demo using https://github.com/ngxson/alpaca.cpp-webui image

ngxson avatar Apr 05 '23 08:04 ngxson