File tree 5 files changed +13
-5
lines changed 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 8
8
#pragma warning(disable: 4244 4267) // possible loss of data
9
9
#endif
10
10
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
12
16
13
17
float frand () {
14
18
return (float )rand ()/(float )RAND_MAX;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ struct gpt_params {
34
34
int32_t main_gpu = 0 ; // the GPU that is used for scratch and small tensors
35
35
float tensor_split[LLAMA_MAX_DEVICES] = {0 }; // how split tensors should be distributed across GPUs
36
36
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
38
38
float rope_freq_base = 10000 .0f ; // RoPE base frequency
39
39
float rope_freq_scale = 1 .0f ; // RoPE frequency scaling factor
40
40
Original file line number Diff line number Diff line change 16
16
#pragma warning(disable: 4244 4267) // possible loss of data
17
17
#endif
18
18
19
- static const float rms_norm_eps = 1e- 6f ;
19
+ static const float rms_norm_eps = LLAMA_DEFAULT_RMS_EPS ;
20
20
21
21
struct random_normal_distribution {
22
22
std::mt19937 gen;
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ struct llama_hparams {
186
186
// LLaMAv2
187
187
// TODO: load from model data hparams
188
188
float f_ffn_mult = 1 .0f ;
189
- float f_rms_norm_eps = 1e- 6f ;
189
+ float f_rms_norm_eps = LLAMA_DEFAULT_RMS_EPS ;
190
190
191
191
float rope_freq_base = 10000 .0f ;
192
192
float rope_freq_scale = 1 .0f ;
@@ -870,7 +870,7 @@ struct llama_context_params llama_context_default_params() {
870
870
/* .n_ctx =*/ 512 ,
871
871
/* .n_batch =*/ 512 ,
872
872
/* .n_gqa =*/ 1 ,
873
- /* .rms_norm_eps =*/ 1e- 6f ,
873
+ /* .rms_norm_eps =*/ LLAMA_DEFAULT_RMS_EPS ,
874
874
/* .gpu_layers =*/ 0 ,
875
875
/* .main_gpu =*/ 0 ,
876
876
/* .tensor_split =*/ nullptr ,
Original file line number Diff line number Diff line change 53
53
#define LLAMA_SUPPORTS_GPU_OFFLOAD
54
54
#endif
55
55
56
+ #ifndef LLAMA_DEFAULT_RMS_EPS
57
+ #define LLAMA_DEFAULT_RMS_EPS 5e-6f
58
+ #endif
59
+
56
60
#ifdef __cplusplus
57
61
extern " C" {
58
62
#endif
You can’t perform that action at this time.
0 commit comments