Skip to content

Update to use only summary bars for uploads when in notebooks #3243

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hoytak
Copy link
Contributor

@hoytak hoytak commented Jul 21, 2025

Currently, the progress of uploading files to a Xet enabled repo does both per-file and summary reporting of the progress. However, the per-file progress may not be communicated to gui or notebook environments in a useful way as different bars are repurposed for different files to display a scrolling list of in-progress files with completed files removed. This PR disables the scrolling per-file reporting for gui and notebook environments, showing only the two summary bars.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Hey @hoytak , thanks for working on that. I left a few comments as I think we should still display per-file progress in google colabs (I tried it before and it works correctly)

(x-posting internal convo)

the summary version is shown in notebooks and guis and the detailed file progress is shown in consoles.
"""

def __init__(self, n_lines: int = 10, description_width: int = 30, per_file_progress=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def __init__(self, n_lines: int = 10, description_width: int = 30, per_file_progress=None):
def __init__(self, n_lines: int = 10, description_width: int = 30):

Let's remove the argument here since it's not used anywhere. Given that XetProgressReporter is used only internally, we don't need flexibility

Comment on lines +13 to +15
If per_file_progress is True, then per-file progress is shown in a scrolling list. Otherwise,
only the summary bars showing file processing progress and data upload are shown. By default,
the summary version is shown in notebooks and guis and the detailed file progress is shown in consoles.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If per_file_progress is True, then per-file progress is shown in a scrolling list. Otherwise,
only the summary bars showing file processing progress and data upload are shown. By default,
the summary version is shown in notebooks and guis and the detailed file progress is shown in consoles.
Shows summary progress bars when running in notebooks or GUIs, and detailed per-file progress in console environments.

Rephrase for when per_file_progress is not an option anymore

Comment on lines +236 to +243
@classmethod
def in_console(cls) -> bool:
"""Returns true if running in a standard console environment and false if running in a notebook or gui."""

# Returns true if the current display method is the one in the standard tqdm class, or false if it's been
# overwritten by the gui, notebook, keras, etc. subclassing it.
return cls.display is std_tqdm.display

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd remove this method and use a combination of is_notebook and is_google_colab.

  • if is_google_colab => per-file progress (as colab is quite good with this)
  • else if is_notebook => summary only
  • else => per-file progress

(you can import them like this from huggingface_hub.utils import is_google_colab)

Comment on lines +22 to +25
if per_file_progress is None:
self.per_file_progress = tqdm.in_console()
else:
self.per_file_progress = per_file_progress
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if per_file_progress is None:
self.per_file_progress = tqdm.in_console()
else:
self.per_file_progress = per_file_progress
self.per_file_progress = is_google_colab() or not is_notebook()

(given the above)

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