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

[Feature] Add option to run llamafactory-cli webui in background #6644

Open
steveepreston opened this issue Jan 14, 2025 · 7 comments
Open
Labels
enhancement New feature or request pending This problem is yet to be addressed

Comments

@steveepreston
Copy link
Contributor

steveepreston commented Jan 14, 2025

Problem:

Running llamafactory-cli webui forces the notebook to keep cell running and then we can't interact with notebook anymore until we stop the cell from running. another problem is when we stop / re-run this cell is the share url changes.

Note:

one common solution is:

os.system(f'GRADIO_SHARE=1 llamafactory-cli webui &')

but in this way, we can't see logs any more, and the most important is that we can't see gradio public url also.

@steveepreston steveepreston added enhancement New feature or request pending This problem is yet to be addressed labels Jan 14, 2025
@hiyouga
Copy link
Owner

hiyouga commented Jan 14, 2025

try os.system(f'GRADIO_SHARE=1 llamafactory-cli webui > log.txt &')?

@steveepreston
Copy link
Contributor Author

steveepreston commented Jan 14, 2025

Hey @hiyouga

I tried, it creates the log.txt file but the file is empty.
The main challenge of this way is that we should download the log file sec by sec to see logs. I mean there is no stream.

@hiyouga
Copy link
Owner

hiyouga commented Jan 14, 2025

Sorry i am not very familiar with this... Maybe you can try nohup or other linux commands

@steveepreston
Copy link
Contributor Author

steveepreston commented Jan 14, 2025

@hiyouga No problem! I will try! I hope guys coming and share ideas about this.

@BUAADreamer
Copy link
Collaborator

You can try this command, a common command when you want to run some process in background:

GRADIO_SHARE=1 llamafactory-cli webui >log.txt 2>&1 &

@steveepreston
Copy link
Contributor Author

@BUAADreamer Thanks for note

Code 1:

!GRADIO_SHARE=1 llamafactory-cli webui >log.txt 2>&1 &

-> OSError: Background processes not supported. (by ipykernel)

Code 2:

os.system("GRADIO_SHARE=1 llamafactory-cli webui >log.txt 2>&1 &")

-> There is no log for gradio local/public url, seems broken

@steveepreston
Copy link
Contributor Author

Proposal:

from llamafactory import webui

# start the webui service and prints urls of gradio.
webui.start()


# user now is able to intract with notebook
...


# end the webui service
webui.end()

Problem of Proposal:

we can not prints the llamafactory-cli webui logs in notebook cell output anymore, because cell started the llamafactory-cli webui in background and finished and is ready to run next cell.

Idea for this problem:

i think we can create a new element in gradio dashboard and show llamafactory-cli webui logs there if possible.

example image of gradio_log pip package:

Image

Related:

gradio-app/gradio#2362

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

No branches or pull requests

3 participants