Skip to content

Commit

Permalink
修改一下调度
Browse files Browse the repository at this point in the history
  • Loading branch information
黄宇扬 committed Dec 13, 2024
1 parent 24d73d8 commit 2ed9993
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/models/basellm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ namespace fastllm {
currentActivate++;
}
}
std::vector <std::pair <int, int> > orders;
for (auto &it : model->responseContextDict.dicts) {
orders.push_back(std::make_pair(-(int)it.second->currentTokens.size(), it.first));
}
sort(orders.begin(), orders.end());

for (int isPrompt = 1; isPrompt >= 0; isPrompt--) {
int cnt = 0;
Expand All @@ -599,7 +604,12 @@ namespace fastllm {
continue;
}
*/
for (auto &it: model->responseContextDict.dicts) {

int currentMaxLen = 0;

// for (auto &it: model->responseContextDict.dicts) {
for (auto &ii : orders) {
auto &it = *model->responseContextDict.dicts.find(ii.second);
if (it.second->isEnding) {
continue;
}
Expand Down Expand Up @@ -640,6 +650,10 @@ namespace fastllm {
lenSum += predictLen;
}
} else {
if (it.second->currentTokens.size() * 2 < currentMaxLen) {
continue;
}
currentMaxLen = std::max(currentMaxLen, (int)it.second->currentTokens.size());
lenSum += it.second->currentTokens.size();
currentActivate++;
}
Expand Down

0 comments on commit 2ed9993

Please sign in to comment.