finnstrom3693
commited on
Commit
•
5875b95
1
Parent(s):
5be2e91
Update modeling5.py
Browse files- modeling5.py +2 -1
modeling5.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# @title Model Architecture
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras import layers, activations, initializers
|
|
|
4 |
|
5 |
class MiniSunConfig:
|
6 |
def __init__(self, vocab_size=30522, max_position_embeddings=1024, hidden_size=512,
|
@@ -158,7 +159,7 @@ def cosine_annealing_with_restarts(step, config):
|
|
158 |
return config.learning_rate * (effective_step / warmup_steps)
|
159 |
else:
|
160 |
cos_step = effective_step - warmup_steps
|
161 |
-
total_cos_steps = restart_period - warmup_steps
|
162 |
return 0.5 * config.learning_rate * (1 + tf.cos(tf.constant(np.pi) * cos_step / total_cos_steps))
|
163 |
|
164 |
# Configuration
|
|
|
1 |
# @title Model Architecture
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras import layers, activations, initializers
|
4 |
+
import numpy as np
|
5 |
|
6 |
class MiniSunConfig:
|
7 |
def __init__(self, vocab_size=30522, max_position_embeddings=1024, hidden_size=512,
|
|
|
159 |
return config.learning_rate * (effective_step / warmup_steps)
|
160 |
else:
|
161 |
cos_step = effective_step - warmup_steps
|
162 |
+
total_cos_steps = config.restart_period - warmup_steps
|
163 |
return 0.5 * config.learning_rate * (1 + tf.cos(tf.constant(np.pi) * cos_step / total_cos_steps))
|
164 |
|
165 |
# Configuration
|