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

Fixed typos in InferenceClient hyperlinks #1491

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

sergiopaniego
Copy link
Contributor

I reviewed the newly added Image-Text to Text task and identified some typos in the hyperlinks. This PR fixes those typos.

@merveenoyan

@@ -64,7 +64,7 @@ def query(filename):
output = query("sample1.flac")
```

To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.automatic_speech-recognition).
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.automatic_speech_recognition).
Copy link
Member

Choose a reason for hiding this comment

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

Ah, anchors were wrong!

@@ -86,7 +86,7 @@ for chunk in stream:
print(chunk.choices[0].delta.content, end="")
```

To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.image_text-to-text).
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.image_text_to_text).
Copy link
Member

Choose a reason for hiding this comment

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

For some reason I'm not seeing this one yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that the functionality is still not developed but the pointer is there 😄

Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

Hi @sergiopaniego thanks a lot for your PR!
the docs/api-inference/tasks/*.md files are auto-generated by running the generate.ts script in scripts/api-inference, so we should update the script instead of modifying the .md files directly.

the issue comes from these lines:
scripts/api-inference/scripts/generate.ts#L443-L444
scripts/api-inference/scripts/generate.ts#L514-L515
the current replace() method only replaces the first occurrence of the pattern (that's why "image-text-to-text" becomes "image_text-to-text" instead of "image_text_to_text"). to fix this, we can use replaceAll() instead:

- taskSnakeCase: baseName.replace("-", "_"),
- taskAttached: baseName.replace("-", ""),
+ taskSnakeCase: baseName.replaceAll("-", "_"),
+ taskAttached: baseName.replaceAll("-", ""),

this change will also ensure all huggingface.js package reference links are properly formatted!
could you update the script with these changes instead? No need to run the generate script yourself as we have an automated PR that regenerates the documentation every day. Let me know if you need any help with this! 🤗

@pcuenca
Copy link
Member

pcuenca commented Nov 18, 2024

Ah missed that, thank you @hanouticelina!

@sergiopaniego
Copy link
Contributor Author

Hi @sergiopaniego thanks a lot for your PR! the docs/api-inference/tasks/*.md files are auto-generated by running the generate.ts script in scripts/api-inference, so we should update the script instead of modifying the .md files directly.

the issue comes from these lines: scripts/api-inference/scripts/generate.ts#L443-L444 scripts/api-inference/scripts/generate.ts#L514-L515 the current replace() method only replaces the first occurrence of the pattern (that's why "image-text-to-text" becomes "image_text-to-text" instead of "image_text_to_text"). to fix this, we can use replaceAll() instead:

- taskSnakeCase: baseName.replace("-", "_"),
- taskAttached: baseName.replace("-", ""),
+ taskSnakeCase: baseName.replaceAll("-", "_"),
+ taskAttached: baseName.replaceAll("-", ""),

this change will also ensure all huggingface.js package reference links are properly formatted! could you update the script with these changes instead? No need to run the generate script yourself as we have an automated PR that regenerates the documentation every day. Let me know if you need any help with this! 🤗

Wow 😮, thanks a lot for the in-depth explanation @hanouticelina!!!
I've made the updates following your advice. I hope they meet the requirements 🤗
Thanks, @pcuenca too!!

Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

all good! thanks a lot @sergiopaniego for this PR 🤗

@hanouticelina hanouticelina merged commit 38e089b into huggingface:main Nov 20, 2024
@sergiopaniego sergiopaniego deleted the inferenceclient-typos branch November 20, 2024 11:15
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.

3 participants