-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Automatic docs for launcher #1044
Conversation
Tested on my local, will update credentials to run this here. |
Neat ! Super simple and efficient, I like it ! Don't know about our docs, but if we could include that in a code block would that make it more readable (I don't think the current output is valid markdown) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting! 🥳
|
||
git add launcher.md | ||
git commit -m "Update launcher.md" | ||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be doing a new push to main, but the workflow triggers with every new push. Wouldn't this trigger an infinite loop? (not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think it would be better to make this check that launcher.md
is up to date (as we do with black
or isort
, they just check but don't change files), and fail if running text-generation-launcher --help >> launcher.md
would change the contents of launcher.md
, hence forcing users to run this command locally.
(no strong opinion, I think @Narsil had suggested the approach of pushing post-merge)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I setup what you said of having a check instead of force-push, and it also works. Both are fine, but indeed it could trigger infinite loop I don't knwo how GH handles those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this always be up to date since it runs every time there's a change in main.rs
?
rm ../../docs/source/basic_tutorials/launcher.md
echo '```' >> ../../docs/source/basic_tutorials/launcher.md
echo $output >> ../../docs/source/basic_tutorials/launcher.md
echo '```' >> ../../docs/source/basic_tutorials/launcher.md
so whenever there's a change in the file it will always remove the launcher.md and then create new one and post output. Is this what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed git pushes and it will only update after merger to main (I think below is only way to do so? see https://github.com/orgs/community/discussions/26724#discussioncomment-3253093)
on:
push:
paths:
- "../../launcher/src/main.rs"
push:
branches:
- main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will think more on this, I can't push this way either :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion was to, rather than GA updating launcher.md
directly, just have GA check if the changes in main.rs
would trigger a change in launcher.md
. E.g. you can do this by checking if output == content in launcher.md. If it's the same, nothing happens. If it's different, then the GA workflow fails.
This means that users, not GA, will be forced to run the command to update the doc (it could be a bash script encapsulating everything as well). (again, no strong opinion, it has its pros and cons)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it like so: (also started working in another PR since in this fork the action is not triggered)
- name: Update Docs
run: |
output="${{ steps.run-launcher-help.outputs.output }}"
launcher_content=$(/docs/source/basic_tutorials/launcher.md)
if [ "$launcher_content" != "$output" ]; then
rm /docs/source/basic_tutorials/launcher.md
echo '```' >> /docs/source/basic_tutorials/launcher.md
echo $output >> /docs/source/basic_tutorials/launcher.md
echo '```' >> /docs/source/basic_tutorials/launcher.md
echo "Docs are updated!"
git add launcher.md
git commit -m "Update launcher.md"
git push
- name: Run TGI Launcher docs | ||
id: run-launcher-help | ||
run: | | ||
output=$(text-generation-launcher --help) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the GitHub Actions workflow has anything installed to run text-generation-launcher --help
. You will need to either install this in GH Actions or use a Docker GA that allows you to do docker run ghcr.io/huggingface/text-generation-inference:latest --help
(which I think has same output)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include it in the build
step too (because there it's available as the docker image)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@osanseviero @Narsil I feel like installing from docker doesn't make sense given text-generation-launcher --help
will not check main.rs
in that branch, does it? So is the output going to come from the source? I tested it and it was coming from docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized make install
works better for this case.
@Narsil just edited to add codeblock. |
By the way to test gh action, what I usually do is remove the filter so that it runs on the current PR |
Apparently if we do:
it should work. I will not add this now to test the action on this branch though:
|
continuing from this PR since GHA is not recognized in my fork (not even skipped) #1045 |
This PR includes a github action to have the
text-generation-launcher --help
output in the documentation.