Demolifted commited on
Commit
2cd8632
·
1 Parent(s): 6b93fba

Update Kronos implementation to support base model and add live/1m/5m intervals

Browse files
Files changed (1) hide show
  1. model/kronos.py +14 -0
model/kronos.py CHANGED
@@ -112,6 +112,13 @@ class KronosTokenizer(nn.Module, PyTorchModelHubMixin):
112
 
113
  return (z_pre, z), bsq_loss, quantized, z_indices
114
 
 
 
 
 
 
 
 
115
  def indices_to_bits(self, x, half=False):
116
  """
117
  Converts indices to bit representations and scales them.
@@ -222,6 +229,13 @@ class Kronos(nn.Module, PyTorchModelHubMixin):
222
  self.head = DualHead(self.s1_bits, self.s2_bits, self.d_model)
223
  self.apply(self._init_weights)
224
 
 
 
 
 
 
 
 
225
  def _init_weights(self, module):
226
 
227
  if isinstance(module, nn.Linear):
 
112
 
113
  return (z_pre, z), bsq_loss, quantized, z_indices
114
 
115
+ @classmethod
116
+ def from_pretrained(cls, pretrained_model_name_or_path, *args, **kwargs):
117
+ """
118
+ Load a pretrained tokenizer from Hugging Face Hub.
119
+ """
120
+ return super().from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
121
+
122
  def indices_to_bits(self, x, half=False):
123
  """
124
  Converts indices to bit representations and scales them.
 
229
  self.head = DualHead(self.s1_bits, self.s2_bits, self.d_model)
230
  self.apply(self._init_weights)
231
 
232
+ @classmethod
233
+ def from_pretrained(cls, pretrained_model_name_or_path, *args, **kwargs):
234
+ """
235
+ Load a pretrained model from Hugging Face Hub.
236
+ """
237
+ return super().from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
238
+
239
  def _init_weights(self, module):
240
 
241
  if isinstance(module, nn.Linear):