Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-vulkan/vulkan-shaders/opt_step_adamw.comp # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-vulkan / vulkan-shaders / opt_step_adamw.comp` 42 lines ยท 1200 bytes Raw Blame History 1 #version 450 2 3 #include "generic_head.glsl" 4 #include "types.glsl" 5 6 #extension GL_EXT_control_flow_attributes : enable 7 8 layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in; 9 10 layout (binding = 0) buffer X {A_TYPE x[];}; 11 layout (binding = 1) readonly buffer G {A_TYPE grad[];}; 12 layout (binding = 2) buffer GM {A_TYPE gradm[];}; 13 layout (binding = 3) buffer GV {A_TYPE gradv[];}; 14 layout (binding = 4) readonly buffer P {float params[7];}; 15 16 void main() { 17 const uint i = gl_GlobalInvocationID.z * 262144 + gl_GlobalInvocationID.y * 512 + gl_GlobalInvocationID.x; 18 19 if (i >= p.KX) { 20 return; 21 } 22 23 const float alpha = params[0]; 24 const float beta1 = params[1]; 25 const float beta2 = params[2]; 26 const float eps = params[3]; 27 const float wd = params[4]; 28 const float beta1h = params[5]; 29 const float beta2h = params[6]; 30 31 const float gi = grad[i]; 32 const float gmi = gradm[i]*beta1 + gi*(1.0f - beta1); 33 const float gvi = gradv[i]*beta2 + gi*gi*(1.0f - beta2); 34 35 gradm[i] = gmi; 36 gradv[i] = gvi; 37 38 const float mh = gmi*beta1h; 39 const float vh = sqrt(gvi*beta2h) + eps; 40 41 x[i] = x[i]*(1.0f - alpha*wd) - alpha*mh/vh; 42 }