Skip to content

Commit

Permalink
fix a compilation bug in dataset.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhengxiang authored Dec 13, 2024
1 parent 3612945 commit 47027e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions transformers/llm/engine/src/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ std::vector<std::vector<std::vector<PromptItem>>> shareGPT(std::string prompt_fi
parse_jsonl(prompt_file, dialogs);
// randomly sample a subset
if (sample_size > 0 && sample_size < dialogs.size()){
std::random_device rd;
std::mt19937 g(rd());
std::sample(dialogs.begin(), dialogs.end(), std::back_inserter(dataset),
sample_size, std::mt19937 {std::random_device{}()});
sample_size, g);
dialogs = dataset;
// store dialogs to file
write_jsonl(genSampleName(prompt_file, sample_size), dialogs);
Expand All @@ -218,4 +220,4 @@ std::vector<std::vector<std::vector<PromptItem>>> shareGPT(std::string prompt_fi


} // Transformer
} // MNN
} // MNN

0 comments on commit 47027e1

Please sign in to comment.