MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / github_dl

Method github_dl

smallthinker/tools/run/run.cpp:763–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761 }
762
763 int github_dl(const std::string & model, const std::string & bn) {
764 std::string repository = model;
765 std::string branch = "main";
766 const size_t at_pos = model.find('@');
767 if (at_pos != std::string::npos) {
768 repository = model.substr(0, at_pos);
769 branch = model.substr(at_pos + 1);
770 }
771
772 const std::vector<std::string> repo_parts = string_split(repository, "/");
773 if (repo_parts.size() < 3) {
774 printe("Invalid GitHub repository format\n");
775 return 1;
776 }
777
778 const std::string & org = repo_parts[0];
779 const std::string & project = repo_parts[1];
780 std::string url = "https://raw.githubusercontent.com/" + org + "/" + project + "/" + branch;
781 for (size_t i = 2; i < repo_parts.size(); ++i) {
782 url += "/" + repo_parts[i];
783 }
784
785 return download(url, bn, true);
786 }
787
788 int s3_dl(const std::string & model, const std::string & bn) {
789 const size_t slash_pos = model.find('/');

Callers

nothing calls this directly

Calls 5

printeFunction · 0.85
findMethod · 0.80
substrMethod · 0.80
string_splitFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected