| 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('/'); |
nothing calls this directly
no test coverage detected