mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-10 07:44:33 +00:00
add automatic layer window size assignment workflow
This commit is contained in:
parent
53cb3a6069
commit
2bd4d03aa8
6 changed files with 241 additions and 110 deletions
|
@ -142,21 +142,24 @@ int main(int argc, char ** argv) {
|
|||
if (!gpt_params_parse(argc, argv, params, LLAMA_EXAMPLE_MAIN, print_usage)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const uint32_t n_world = params.n_world;
|
||||
const uint32_t my_rank = params.rank;
|
||||
GGML_ASSERT(!(n_world == 1 && my_rank > 0));
|
||||
|
||||
// check if --n-layer-window and --world is matched
|
||||
uint32_t non_zero_count = 0;
|
||||
size_t size = sizeof(params.n_layer_window) / sizeof(params.n_layer_window[0]);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (params.n_layer_window[i] != 0) {
|
||||
++non_zero_count;
|
||||
if (my_rank == 0) {
|
||||
uint32_t non_zero_count = 0;
|
||||
size_t size = sizeof(params.n_layer_window) / sizeof(params.n_layer_window[0]);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (params.n_layer_window[i] != 0) {
|
||||
++non_zero_count;
|
||||
}
|
||||
}
|
||||
GGML_ASSERT((non_zero_count == 0 || non_zero_count == n_world) \
|
||||
&& "Number of non-zero values in --n-layer-window must equal --world");
|
||||
}
|
||||
|
||||
GGML_ASSERT(!(n_world == 1 && my_rank > 0));
|
||||
GGML_ASSERT(non_zero_count == n_world && "Number of non-zero values in --n-layer-window must equal --world");
|
||||
|
||||
gpt_init();
|
||||
|
||||
auto & sparams = params.sparams;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue