Skip to content

Commit

Permalink
Fix 3
Browse files Browse the repository at this point in the history
  • Loading branch information
changqi1 committed Jun 13, 2024
1 parent 6a85769 commit f6e6e64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/layers/rms_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ void RmsNormImp<T>::setWeight(const float *w, const float *, int cols) {
template <typename T>
void RmsNormImp<T>::setWeight(const std::string &modelPath, const std::string &, int cols) {
float weightBuf[cols];
loadWeight(modelPath, weightBuf, cols);
float *weiBuf = &weightBuf[0];
loadWeight(modelPath, weiBuf, cols);
this->normSize = cols;
this->setWeight(weightBuf, nullptr, cols);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/weight_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int loadWeightWithConvert(T *ptr, int size, const std::string &filename, bool re
}

template <typename T>
int loadWeight(std::string filename, T *ptr, int size, DataType w_type = DataType::unknown, bool required = true) {
int loadWeight(std::string filename, T *&ptr, int size, DataType w_type = DataType::unknown, bool required = true) {

// By default, read the config.ini configuration file
// in the same directory as the model file to determine the data type of the file.
Expand Down

0 comments on commit f6e6e64

Please sign in to comment.