text-generation-webui/modules/RoPE.py

19 lines
405 B
Python
Raw Normal View History

2023-08-25 16:10:26 +02:00
def get_alpha_value(alpha, base):
'''
Gets alpha_value from alpha_value and rope_freq_base
'''
if base > 0:
2024-01-10 01:27:50 +01:00
return (base / 10000.) ** (63 / 64.)
2023-08-25 16:10:26 +02:00
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:
2024-01-10 01:27:50 +01:00
return 10000 * alpha ** (64 / 63.)