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

Convert Trainer doc page to MarkDown #14753

Merged
merged 3 commits into from
Dec 13, 2021
Merged

Convert Trainer doc page to MarkDown #14753

merged 3 commits into from
Dec 13, 2021

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Dec 13, 2021

What does this PR do?

The doc-builder only resolves ref when they point to sections in the same page, so this PR fixes #14730 by converting the doc page to MarkDown and fixing all links. In passing, it removes mention of the TFTrainer which is now deprecated.

@sgugger sgugger requested a review from LysandreJik December 13, 2021 17:32


Moved to [Trainer DeepSpeed integration](deepspeed#trainer-deepspeed-integration).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kept everything as is @stas00 but maybe it's time to remove everything below and only leave this first line? The rendering on the doc is not super nice, as seen here

Copy link
Contributor

Choose a reason for hiding this comment

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

The intention was to preserve old links. so if someone on another site/forum linked to a specific section the user following this link will be able to find the new location after the move.

If you remove it, the anchor will fail and the user will get the top of the page and won't even know about that main: moved to ...

One easy way to fix this on the web server level is to create a redirect file which matches the old link with the anchor and redirects it to a new location, .e.g;

https://huggingface.co/docs/transformers/main_classes/trainer#deepspeed| https://huggingface.co/docs/transformers/master/en/main_classes/trainer#deepspeed-trainer-integration
... same for all other redirects ...

we already have a redirect rule from .html to non-html link, so these need to be added there.

It appears hf.co is running on nginx webserver, so need to look up the format for redirects on that server.

then we can nuke those "poor man's redirects" in the doc itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

should we discuss this on #doc-frontend?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Member

Choose a reason for hiding this comment

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

nginx does not see anchor links, this is a purely client-side element

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Too bad then. In this case, how about we just leave the HTML anchors and remove all visible content? A user that tries a "dead" link will then see "Moved to [Trainer DeepSpeed integration]" and can then easily find their way from there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, @julien-c, for sharing that. Indeed the browser doesn't send the anchor part to the server :(

That means we can't do the redirect in the rules file :(

It's your call Sylvain, if you prefer clean and neat over supporting existing links then please remove all but the first one.

Alternatively, we could discuss and agree on a general policy - when we rename headers or move content to a different file, do we support old links or not and at what cost. And depending on the outcome of that discussion then this decision about the current question can be made.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, how about we just leave the HTML anchors and remove all visible content? A user that tries a "dead" link will then see "Moved to [Trainer DeepSpeed integration]" and can then easily find their way from there.

If it works that would be great. Could you do a single link mockup to see what you mean exactly?

Something like:

<h3><a href="#deepspeed"></a>DeepSpeed</h3>
<p>Moved to <a href="/docs/transformers/master/en/main_classes/trainer#deepspeed-trainer-integration">deepspeed-trainer-integration</a>.</p>

but add it to a non-visible class?

Copy link
Collaborator Author

@sgugger sgugger Dec 13, 2021

Choose a reason for hiding this comment

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

I'll open a fresh PR with an example to discuss this and merge this one in the meantime to fix the related issue :-)

@@ -46,4 +46,4 @@ jobs:

- name: Make documentation
run: |
doc-builder build transformers ./transformers/docs/source
doc-builder build transformers ./docs/source
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

An error actually made me realize the path was wrong all along 🤦

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Thanks for showing the way with the conversion!

@sgugger sgugger merged commit 7533d30 into master Dec 13, 2021
@sgugger sgugger deleted the convert_trainer_doc branch December 13, 2021 18:09
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.

Fix docs pointers for DeepSpeed
4 participants