MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_control_vector_load

Function common_control_vector_load

common/common.cpp:1798–1830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1796}
1797
1798common_control_vector_data common_control_vector_load(const std::vector<common_control_vector_load_info> & load_infos) {
1799 common_control_vector_data result = { -1, {} };
1800
1801 for (const auto & info : load_infos) {
1802 auto cur = common_control_vector_load_one(info);
1803
1804 if (cur.n_embd == -1) {
1805 result.n_embd = -1;
1806 break;
1807 }
1808 if (result.n_embd != -1 && result.n_embd != cur.n_embd) {
1809 LOG_ERR("%s: control vectors in %s does not match previous dimensions\n", __func__, info.fname.c_str());
1810 result.n_embd = -1;
1811 break;
1812 }
1813
1814 if (result.n_embd == -1) {
1815 result = std::move(cur);
1816 } else {
1817 result.data.resize(std::max(result.data.size(), cur.data.size()), 0.0f); // extend if necessary
1818 for (size_t i = 0; i < cur.data.size(); i++) {
1819 result.data[i] += cur.data[i];
1820 }
1821 }
1822 }
1823
1824 if (result.n_embd == -1) {
1825 LOG_ERR("%s: no valid control vector files passed\n", __func__);
1826 result.data.clear();
1827 }
1828
1829 return result;
1830}
1831
1832ggml_opt_dataset_t common_opt_dataset_init(struct llama_context * ctx, const std::vector<llama_token> & tokens, int64_t stride) {
1833 const int64_t ne_datapoint = llama_n_ctx(ctx);

Callers 1

common_init_from_paramsFunction · 0.85

Calls 5

maxFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected