-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Nightly #3753
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
Nightly #3753
Changes from all commits
e53e185
150eadf
25a6250
6b908cf
f754bd2
30ade52
94bbcaa
30b78c5
f357fc5
cde2d42
a63a337
2c22ce6
449430d
b5f1a77
c94f595
01319d3
696a540
ac54d6e
9a98139
680f19f
fb763f3
f4f2a7f
e17b62f
f34eb0a
04ad21c
32b52a0
0c9288f
b5b57b3
efb5801
12ccc47
e3918e7
0cb9542
5540212
4c80b03
e57edc2
9bc1567
c22fbb7
d7482e8
ca77798
71c5938
2991a7d
7c10195
7f744d9
d96ac97
3738db7
fbaacce
6e5a561
3e6cfb5
30a454c
b58663a
7b61375
a2b5def
59a1fa5
5e33a07
1f1bf49
0ed6738
5d0286d
6346d17
1de77bf
4d99c57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -72,6 +72,7 @@ | |||||
| "patch_hf_quantizer", | ||||||
| "verify_fp8_support_if_applicable", | ||||||
| "_get_inference_mode_context_manager", | ||||||
| "hf_login", | ||||||
| ] | ||||||
|
|
||||||
| import torch | ||||||
|
|
@@ -2344,3 +2345,23 @@ def _get_inference_mode_context_manager(model: torch.nn.Module): | |||||
| return torch.no_grad() | ||||||
| else: | ||||||
| return torch.inference_mode() | ||||||
|
|
||||||
|
|
||||||
| def hf_login(token: Optional[str] = None) -> Optional[str]: | ||||||
| if token is None: | ||||||
| try: | ||||||
| from huggingface_hub import get_token | ||||||
|
|
||||||
| token = get_token() | ||||||
| if token is None: | ||||||
| return None | ||||||
| except: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a bare
Suggested change
|
||||||
| return None | ||||||
| try: | ||||||
| from huggingface_hub import login | ||||||
|
|
||||||
| login(token = token) | ||||||
| return token | ||||||
| except Exception as e: | ||||||
| logger.info(f"Failed to login to huggingface using token with error: {e}") | ||||||
| return token | ||||||
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.
The
__slots__attribute was removed from theHidePrintMessageclass. Using__slots__is a good practice for memory optimization, especially for classes that are instantiated many times. Since this class has a fixed set of attributes (_original_stream,_hidden_texts), reintroducing__slots__would be beneficial for performance by preventing the creation of__dict__for each instance.