Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Add basic alpaca REPL mode #29

Merged
merged 11 commits into from
Mar 21, 2023
Merged

Add basic alpaca REPL mode #29

merged 11 commits into from
Mar 21, 2023

Conversation

darthdeus
Copy link
Contributor

A working REPL prototype with the alpaca prompt. Not sure if we want the alpaca there 🤔

@setzer22
Copy link
Collaborator

Thanks a lot! 😄

I took the liberty to cleanup things a bit since we've been merging some breaking changes.

I think having the alpaca prompt is great, but we should make this configurable, so I changed a bit how the command works:

Instead of ignoring the prompt, we take any prompt string using the usual args (-p, -f). And replace the string $PROMPT inside the given prompt, with whatever is read from the line.

Then, I added an examples/alpaca_prompt.txt with the following:

Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:

$PROMPT

### Response:

I also made it so that the original prompt isn't spit back to you, and instead a little spinner is shown while the prompt is being parsed.

Here's a demo
alpaca_repl_screencap

Copy link
Collaborator

@philpax philpax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@setzer22 setzer22 merged commit 6403f09 into rustformers:main Mar 21, 2023
@darthdeus darthdeus deleted the repl branch March 21, 2023 22:31
@RCasatta
Copy link

Sorry for the noob question, empty prompt (hitting return at >>) returns different casual answers, so is there randomness in the process?

@philpax
Copy link
Collaborator

philpax commented Mar 22, 2023

Yup - at each step of the LLM, it produces a list of probabilities, and it will sample from that list to produce different outputs. If you'd like to fix the results, you can use a specific --seed (it will always deterministically sample according to that seed (with the caveat that it's only for your machine)) or --top-k 1 (which will always pick the most probable word).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants