Skip to content

Commit

Permalink
修复内存溢出问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxlinkage committed Nov 7, 2023
1 parent ed338ee commit 8a9a8ff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/models/glm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace fastllm {
Data mlpOutput;
Data middle, middle2;
Data toSave;
Data mem2;
Data mem2,mem3;
std::vector<int> lastRet;
// GLMBlock
std::string weightPre, weightMiddle;
Expand Down Expand Up @@ -131,8 +131,8 @@ namespace fastllm {
Split(qkv, -1, per * 2, per * 3, v);
}else{
LayerNorm(mem, weight[inputLNWeightName], weight[inputLNBiasName], -1, mem2);
CatDirect(mem2,attenInput,1);
Linear(mem2, weight[qkvWeightName], weight[qkvBiasName], qkv);
Cat(mem2,attenInput,1,mem3);
Linear(mem3, weight[qkvWeightName], weight[qkvBiasName], qkv);
int per = qkv.dims.back() / 3;
Split(qkv, -1, 0, per, q0);
Split(qkv, -1, per, per * 2, k);
Expand Down Expand Up @@ -296,10 +296,8 @@ namespace fastllm {
for(unsigned int i=0;i<hexString.length();i+=2){
decoded.push_back(std::stoi(hexString.substr(i,2),nullptr,16));
}
printf("%lu\n",decoded.length());
weight.tokenizer.spProcessor=std::make_unique<sentencepiece::SentencePieceProcessor>();
weight.tokenizer.spProcessor->LoadFromSerializedProto(decoded);
printf("GetPieceSize=%d\n",weight.tokenizer.spProcessor->GetPieceSize());
}
}
#endif
Expand Down

0 comments on commit 8a9a8ff

Please sign in to comment.