From 21058c37f789c241833c10144bed8c01af6c4ccd Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 25 Aug 2023 07:10:26 -0700 Subject: [PATCH] Add missing file --- modules/RoPE.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 modules/RoPE.py diff --git a/modules/RoPE.py b/modules/RoPE.py new file mode 100644 index 00000000..c15616c6 --- /dev/null +++ b/modules/RoPE.py @@ -0,0 +1,18 @@ +def get_alpha_value(alpha, base): + ''' + Gets alpha_value from alpha_value and rope_freq_base + ''' + if base > 0: + return (base/10000.) ** (63/64.) + else: + return alpha + + +def get_rope_freq_base(alpha, base): + ''' + Gets rope_freq_base from alpha_value and rope_freq_base + ''' + if base > 0: + return base + else: + return 10000 * alpha ** (64/63.)