Skip to content

Conversation

ericcurtin
Copy link
Collaborator

For llama-server pulling

For llama-server pulling

Signed-off-by: Eric Curtin <[email protected]>
@JohannesGaessler
Copy link
Collaborator

FYI if you want a smoother/more compact progress bar you can use fractional blocks. Example implementation for training:

// The progress bar consists of partially filled blocks, unicode has 8 separate fill levels.
constexpr int64_t bar_length = 8;
const int64_t ibatch8 = 8 * ibatch;
for (int64_t j = 0; j < bar_length; ++j) {
if (ibatch_max * (8*j + 8) / bar_length < ibatch8) {
fprintf(stderr, "\u2588"); // full block
} else if (ibatch_max * (8*j + 7) / bar_length < ibatch8) {
fprintf(stderr, "\u2589"); // 7/8 filled
} else if (ibatch_max * (8*j + 6) / bar_length < ibatch8) {
fprintf(stderr, "\u258A"); // 6/8 filled
} else if (ibatch_max * (8*j + 5) / bar_length < ibatch8) {
fprintf(stderr, "\u258B"); // 5/8 filled
} else if (ibatch_max * (8*j + 4) / bar_length < ibatch8) {
fprintf(stderr, "\u258C"); // 4/8 filled
} else if (ibatch_max * (8*j + 3) / bar_length < ibatch8) {
fprintf(stderr, "\u258D"); // 3/8 filled
} else if (ibatch_max * (8*j + 2) / bar_length < ibatch8) {
fprintf(stderr, "\u258E"); // 2/8 filled
} else if (ibatch_max * (8*j + 1) / bar_length < ibatch8) {
fprintf(stderr, "\u258F"); // 1/8 filled
} else {
fprintf(stderr, " ");
}
}

@ericcurtin
Copy link
Collaborator Author

@JohannesGaessler was thinking docker-style because of portability, do you know if this works on Windows?

@angt
Copy link
Collaborator

angt commented Sep 25, 2025

Hey :)

I'm currently in the middle of a larger rework of this exact section, with the goal of removing the cURL dependency completely. You can see the work in progress here: #16185

And also made a very simple progressbar 😆

static void print_progress(size_t current, size_t total) { // TODO isatty
    if (!total) {
        return;
    }

    size_t width = 50;
    size_t pct = (100 * current) / total;
    size_t pos = (width * current) / total;

    std::cout << "["
              << std::string(pos, '=')
              << (pos < width ? ">" : "")
              << std::string(width - pos, ' ')
              << "] " << std::setw(3) << pct << "%  ("
              << current / (1024 * 1024) << " MB / "
              << total / (1024 * 1024) << " MB)\r";
    std::cout.flush();
}

To avoid us getting tangled in merge conflicts, how about we get my refactor merged first to create a clean base, and then we can circle back to integrate the improvements from your patch?

Let me know what you think

@ericcurtin
Copy link
Collaborator Author

#16185

Let me know when the PR is ready for review, would like to test and review.

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