File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 88#pragma warning(disable: 4244 4267) // possible loss of data
99#endif
1010
11- static const float rms_norm_eps = 1e-6f ;
11+ #ifdef LLAMA_DEFAULT_RMS_EPS
12+ static const float rms_norm_eps = LLAMA_DEFAULT_RMS_EPS;
13+ #else
14+ static const float rms_norm_eps = 5e-6f ;
15+ #endif
1216
1317float frand () {
1418 return (float )rand ()/(float )RAND_MAX;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ struct gpt_params {
3434 int32_t main_gpu = 0 ; // the GPU that is used for scratch and small tensors
3535 float tensor_split[LLAMA_MAX_DEVICES] = {0 }; // how split tensors should be distributed across GPUs
3636 int32_t n_probs = 0 ; // if greater than 0, output the probabilities of top n_probs tokens.
37- float rms_norm_eps = 1e-6 ; // rms norm epsilon
37+ float rms_norm_eps = LLAMA_DEFAULT_RMS_EPS ; // rms norm epsilon
3838 float rope_freq_base = 10000 .0f ; // RoPE base frequency
3939 float rope_freq_scale = 1 .0f ; // RoPE frequency scaling factor
4040
Original file line number Diff line number Diff line change 1616#pragma warning(disable: 4244 4267) // possible loss of data
1717#endif
1818
19- static const float rms_norm_eps = 1e- 6f ;
19+ static const float rms_norm_eps = LLAMA_DEFAULT_RMS_EPS ;
2020
2121struct random_normal_distribution {
2222 std::mt19937 gen;
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ struct llama_hparams {
186186 // LLaMAv2
187187 // TODO: load from model data hparams
188188 float f_ffn_mult = 1 .0f ;
189- float f_rms_norm_eps = 1e- 6f ;
189+ float f_rms_norm_eps = LLAMA_DEFAULT_RMS_EPS ;
190190
191191 float rope_freq_base = 10000 .0f ;
192192 float rope_freq_scale = 1 .0f ;
@@ -870,7 +870,7 @@ struct llama_context_params llama_context_default_params() {
870870 /* .n_ctx =*/ 512 ,
871871 /* .n_batch =*/ 512 ,
872872 /* .n_gqa =*/ 1 ,
873- /* .rms_norm_eps =*/ 1e- 6f ,
873+ /* .rms_norm_eps =*/ LLAMA_DEFAULT_RMS_EPS ,
874874 /* .gpu_layers =*/ 0 ,
875875 /* .main_gpu =*/ 0 ,
876876 /* .tensor_split =*/ nullptr ,
Original file line number Diff line number Diff line change 5353#define LLAMA_SUPPORTS_GPU_OFFLOAD
5454#endif
5555
56+ #ifndef LLAMA_DEFAULT_RMS_EPS
57+ #define LLAMA_DEFAULT_RMS_EPS 5e-6f
58+ #endif
59+
5660#ifdef __cplusplus
5761extern " C" {
5862#endif
You can’t perform that action at this time.
0 commit comments