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

one server, multiple sessions (users) ((feature request)) #58

Closed
ThatCoffeeGuy opened this issue Feb 5, 2023 · 24 comments
Closed

one server, multiple sessions (users) ((feature request)) #58

ThatCoffeeGuy opened this issue Feb 5, 2023 · 24 comments
Labels
enhancement New feature or request stale

Comments

@ThatCoffeeGuy
Copy link

Hey guys,

First of all, thanks a bunch for working on this project, I'm following closely. Hoping I can contribute with something one day.

My question is: Is there a way to run non-shared sessions using a single instance? When I shared my instance on the local network, chat-history was present on multiple computers at a point, they were both using the same character.

I suppose the most obvious technical challenge would be the fast-switch of context and history especially if two users are talking to two different characters.

Thank you!

@oobabooga
Copy link
Owner

This is related to #13 (who asked the opposite). As it is now, the state implementation is indeed poor, as it neither completely remembers or completely forgets the state when the web ui is opened in another tab.

@oobabooga oobabooga added the enhancement New feature or request label Feb 8, 2023
@github-actions github-actions bot added the stale label Mar 13, 2023
@github-actions
Copy link

This issue has been closed due to inactivity for 30 days. If you believe it is still relevant, you can reopen it (if you are the author) or leave a comment below.

@ThatCoffeeGuy
Copy link
Author

ThatCoffeeGuy commented Mar 14, 2023

I believe it is still a valid enhancement request. I am aware that I could try building my own platform and use textgen webui only as inference, but I'd love to see it as a built in feature as well.

Can @oobabooga reopen it? I might be blind but I can't see where to do it.

@oobabooga oobabooga reopened this Mar 14, 2023
@github-actions github-actions bot removed the stale label Mar 14, 2023
@tensiondriven
Copy link
Contributor

FWIW, I'm not able to run multiple instances on different ports; when I try, the second instance kills with no error message:

(with one instance already running)

$ python server.py --cai-chat --gptq-bits 4 --model llama-13b --listen-port 8002 --verbose
Loading llama-13b...
Loading model ...
Killed

Could it be as easy as changing some command line parameters, or somehow isolating the instances in Docker containers? (See #174)

@MarlinMr
Copy link
Contributor

I am perfectly able to run several instances using docker, so that is something you can try too.

@ThatCoffeeGuy
Copy link
Author

I am perfectly able to run several instances using docker, so that is something you can try too.

But wouldn't that result in multiple instance being loaded at the same time, therefore requiring more resources? What I'm asking here is the possibility for multiple users to interact with the same, loaded model.

@MarlinMr
Copy link
Contributor

Yes, it's not efficient for a multi user setup, I was just commenting on the general idea by the guy above me

@ktl014
Copy link

ktl014 commented May 1, 2023

I'm also interested in this enhancement - it seems like we need to apply a session state to the gradio-web ui according to gradio documentation

@flurb18
Copy link
Contributor

flurb18 commented May 11, 2023

I think this would also involve sending incoming generate_reply calls (requests for text generation) to a queue to be processed by a background worker, which can then schedule them for execution so no conflicts from multiple requests at the same time. Unless I'm reading the code wrong and it already works like that

@jinluyang
Copy link

forgive my boldness. Is it possible to just change shared.history to something like shared.history[user_id] to support this? So that the historys are seperate.

@thusinh1969
Copy link

I am about to write advanced API to process multi-users (not UI though). Will revert.

@flurb18
Copy link
Contributor

flurb18 commented May 24, 2023

Since the code uses gradio Blocks, what we want is this: https://gradio.app/state-in-blocks/

I'm taking a crack at it.

@mohdimran043
Copy link

Hi All,

I would like to know if there is any progress on this request. Would love to know if we have any parameter available for state management

@surak
Copy link

surak commented May 27, 2023

+1

@OrenRele
Copy link

Since the code uses gradio Blocks, what we want is this: https://gradio.app/state-in-blocks/

I'm taking a crack at it.

@flurb18 good luck! I think the difficulty here is there the shared parameters are all over the places. If you want to support multiple users, you need to give each of them a gradio State object for a history, but make sure that for each button press (generate, submit, w/e) you 1. pass your state to the callback and 2. follow the callback all the way down to see that the shared one is not used in any later point..

I tried something like this, with partial success and it is quite messy.. I'm hoping there's a simpler solution out there..

@ktl014
Copy link

ktl014 commented Jun 2, 2023

Could we put a little more priority on this feature? CC @oobabooga

@HyeongminMoon
Copy link

Hi, I made a draft PR here. I agree @OrenRele and @jinluyang's opinions cause the project is using shared object.
#2573

@oobabooga
Copy link
Owner

See here #2573 (comment), it seems to me that this should already work, but it would be good to have someone actually test it with multiple users

Just launch the ui in chat mode with --multi-user flag and see if anything weird happens

@sandwichdoge
Copy link

Anyone can confirm it works yet?

@sandwichdoge
Copy link

WebUI works, API works but only one user at a time due to no batched inferencing. Everybody has to queue.

@muhammad-asn
Copy link

See here #2573 (comment), it seems to me that this should already work, but it would be good to have someone actually test it with multiple users

Just launch the ui in chat mode with --multi-user flag and see if anything weird happens

This doesn't save the history right?

@muhammad-asn
Copy link

WebUI works, API works but only one user at a time due to no batched inferencing. Everybody has to queue.

How it works? I try in incognito and default still the Web UI shows the same prompt?

@github-actions github-actions bot added the stale label Dec 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

This issue has been closed due to inactivity for 6 weeks. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.

@github-actions github-actions bot closed this as completed Dec 8, 2023
@Kosyne
Copy link

Kosyne commented Feb 12, 2024

Chiming in that I'd be really interested to see this, even in a basic form so two or three people can use the service but only see their own prompts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests