| #pragma once |
|
|
| #include <string> |
| #include <vector> |
|
|
| struct common_params_model; |
|
|
| using common_header = std::pair<std::string, std::string>; |
| using common_header_list = std::vector<common_header>; |
|
|
| struct common_remote_params { |
| common_header_list headers; |
| long timeout = 0; |
| long max_size = 0; |
| }; |
|
|
| |
| std::pair<long, std::vector<char>> common_remote_get_content(const std::string & url, const common_remote_params & params); |
|
|
| |
| |
| |
| |
| std::pair<std::string, std::string> common_download_split_repo_tag(const std::string & hf_repo_with_tag); |
|
|
| struct common_cached_model_info { |
| std::string manifest_path; |
| std::string user; |
| std::string model; |
| std::string tag; |
| size_t size = 0; |
| |
| |
| std::string to_string() const { |
| return user + "/" + model + (tag == "latest" ? "" : ":" + tag); |
| } |
| }; |
|
|
| struct common_hf_file_res { |
| std::string repo; |
| std::string ggufFile; |
| std::string mmprojFile; |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| common_hf_file_res common_get_hf_file( |
| const std::string & hf_repo_with_tag, |
| const std::string & bearer_token, |
| bool offline, |
| const common_header_list & headers = {} |
| ); |
|
|
| |
| bool common_download_model( |
| const common_params_model & model, |
| const std::string & bearer_token, |
| bool offline, |
| const common_header_list & headers = {} |
| ); |
|
|
| |
| std::vector<common_cached_model_info> common_list_cached_models(); |
|
|
| |
| |
| int common_download_file_single(const std::string & url, |
| const std::string & path, |
| const std::string & bearer_token, |
| bool offline, |
| const common_header_list & headers = {}); |
|
|
| |
| |
| std::string common_docker_resolve_model(const std::string & docker); |
|
|