Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow custom stopping strings #903

Merged
merged 9 commits into from Apr 11, 2023
Merged

allow custom stopping strings #903

merged 9 commits into from Apr 11, 2023

Conversation

catalpaaa
Copy link
Contributor

a better #823

@catalpaaa
Copy link
Contributor Author

image

@oobabooga
Copy link
Owner

It now works in notebook mode too

@oobabooga oobabooga merged commit 78bbc66 into oobabooga:main Apr 11, 2023
@ShaneTRS
Copy link

I've just done git pull and updated all the requirements via pip, and I can't seem to verify that this is functioning. I'm using the api-example.py script, with custom_stopping_strings set to ["\n"] (as well as early_stopping set to True, though I'm not sure that's necessary). I also changed the prompt to "test", just because I know it often creates new lines.

I'm still getting responses that are multiple lines long, such as:

test_2.csv"
    train_df = pd.read_csv(train_csv)
    test_df = pd.read_csv(test_csv)
    # preprocessing

I've tried other strings (and other amounts of strings), such as first names and what-not, but none seem to have an effect.

@ShaneTRS
Copy link

ShaneTRS commented Apr 12, 2023

After some extra testing, I think it may be related to the fact that I run a RWKV model.
Here are my typical launch arguments:
--model RWKV-4-Raven-3B-v8-EngAndMore-ctx4096.pth --rwkv-strategy 'cuda fp16' --rwkv-cuda-on --listen --no-stream --notebook

I tried running with these instead:
--model llama-7b --load-in-8bit --listen --no-stream --notebook --lora alpaca-lora-7b

I seem to get proper stopping, though I didn't do a lot of testing.

I'm not familiar with proper etiquette, so I haven't created a separate issue regarding this.

@oobabooga
Copy link
Owner

@ShaneTRS the stopping criteria stuff is a part of transformers, and RWKV uses a custom implementation that is not part of transformers, so it doesn't work for this model (and also for llama.cpp)

See https://github.com/oobabooga/text-generation-webui/blob/main/modules/text_generation.py#L139

@catalpaaa catalpaaa deleted the custom-stopping-strings branch April 12, 2023 08:00
ClayShoaf pushed a commit to ClayShoaf/text-generation-webui that referenced this pull request Apr 13, 2023
Ph0rk0z pushed a commit to Ph0rk0z/text-generation-webui-testing that referenced this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants