robinzixuan
commited on
Commit
•
4386742
1
Parent(s):
fb34b67
Upload modeling_opt.py
Browse files- modeling_opt.py +3 -0
modeling_opt.py
CHANGED
@@ -46,6 +46,9 @@ from transformers.utils import (
|
|
46 |
)
|
47 |
from .configuration_opt import OPTConfig
|
48 |
|
|
|
|
|
|
|
49 |
|
50 |
class BaseEnumOptions(Flag):
|
51 |
def __str__(self):
|
|
|
46 |
)
|
47 |
from .configuration_opt import OPTConfig
|
48 |
|
49 |
+
def logit(p, eps=1e-16):
|
50 |
+
p = np.clip(p, eps, 1 - eps)
|
51 |
+
return -np.log(1 / p - 1)
|
52 |
|
53 |
class BaseEnumOptions(Flag):
|
54 |
def __str__(self):
|