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

1173 Add dump env helper #1177

Merged
merged 4 commits into from
Nov 10, 2022
Merged

1173 Add dump env helper #1177

merged 4 commits into from
Nov 10, 2022

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Nov 9, 2022

Resolve #1173. Should ease some debugging of issues from users.

TODO:

  • update issue template ?
  • is there any other relevant information to paste ?

Inspired by existing work in transformers diffusers (thanks @mariosasko)

In terminal

➜  huggingface-cli env

Copy-and-paste the text below in your GitHub issue.

- huggingface_hub version: 0.11.0.dev0
- Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.35
- Python version: 3.10.6
- Running in iPython ?: No
- Running in notebook ?: False
- Running in Google Colab ?: False
- Token path ?: /home/wauplin/.huggingface/token
- Has saved token ?: True
- Token type: Personal token
- Who am I ?: Wauplin
- Configured git credential helpers: 
- FastAI: N/A
- Tensorflow: 2.9.1
- Torch: 1.12.1
- Jinja2: 3.1.2
- Graphviz: 0.20.1
- Pydot: 1.4.2

From python

from huggingface_hub import dump_environment_info

dump_environment_info()

Output from ipython in terminal:


Copy-and-paste the text below in your GitHub issue.

- huggingface_hub version: 0.11.0.dev0
- Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.35
- Python version: 3.10.6
- Running in iPython ?: Yes
- iPython shell: TerminalInteractiveShell
- Running in notebook ?: False
- Running in Google Colab ?: False
- Token path ?: /home/wauplin/.huggingface/token
- Has saved token ?: True
- Token type: Personal token
- Who am I ?: Wauplin
- Configured git credential helpers: 
- FastAI: N/A
- Tensorflow: 2.9.1
- Torch: 1.12.1
- Jinja2: 3.1.2
- Graphviz: 0.20.1
- Pydot: 1.4.2

@HuggingFaceDocBuilder
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@codecov
Copy link

codecov bot commented Nov 9, 2022

Codecov Report

Base: 84.82% // Head: 83.87% // Decreases project coverage by -0.94% ⚠️

Coverage data is based on head (1716d88) compared to base (fb3f9cb).
Patch coverage: 5.88% of modified lines in pull request are covered.

❗ Current head 1716d88 differs from pull request most recent head 4de6884. Consider uploading reports for the commit 4de6884 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1177      +/-   ##
==========================================
- Coverage   84.82%   83.87%   -0.95%     
==========================================
  Files          42       43       +1     
  Lines        4210     4261      +51     
==========================================
+ Hits         3571     3574       +3     
- Misses        639      687      +48     
Impacted Files Coverage Δ
src/huggingface_hub/commands/env.py 0.00% <0.00%> (ø)
src/huggingface_hub/commands/huggingface_cli.py 0.00% <0.00%> (ø)
src/huggingface_hub/utils/__init__.py 100.00% <ø> (ø)
src/huggingface_hub/utils/_runtime.py 61.90% <8.33%> (-27.96%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

LGTM! You could also edit the issue templates to request the command to be run before opening an issue. Right now it asks for the versions, but it would be simpler to just point to the command

Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

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

Thanks! Agree on changing the templates

info["Has saved token ?"] = token is not None
if token is not None:
info["Token type"] = (
"Organization token" if token.startswith("hf_org") else "Personal token"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can ever have an organization token saved right? The login fails for those (see https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/_login.py#L225 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep true, I'll remove it. Thanks :)

Copy link
Member

Choose a reason for hiding this comment

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

yes i was going to comment the same. Org tokens are on their way to deprecation anyways

@HuggingFaceDocBuilder
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@Wauplin
Copy link
Contributor Author

Wauplin commented Nov 10, 2022

Thanks both for the review !

You could also edit the issue templates to request the command to be run before opening an issue.

Yes that's what I meant by " update issue template ?" in the todo list of the PR but it wasn't so clear 😄

Anyway, I updated it and will merge when CI is green. Hope it will prove to be useful in the future :)

@HuggingFaceDocBuilder
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@Wauplin Wauplin merged commit 587eea0 into main Nov 10, 2022
@Wauplin Wauplin deleted the 1173-add-dump-env-helper branch November 10, 2022 08:18
huggingface-cli env
```

If your are working in a notebook, please run it in a code cell:
Copy link
Member

Choose a reason for hiding this comment

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

*you

@@ -177,3 +179,53 @@ def is_google_colab() -> bool:
Taken from https://stackoverflow.com/a/63519730.
"""
return _is_google_colab


def dump_environment_info() -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

(nit) maybe link to transformers diffusers implementations for reference

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

lgtm!

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.

Add a helper to print setup/machine details
5 participants