MCPcopy Create free account
hub / github.com/shiyu-coder/Kronos / generate

Method generate

model/kronos.py:508–517  ·  view source on GitHub ↗
(self, x, x_stamp, y_stamp, pred_len, T, top_k, top_p, sample_count, verbose)

Source from the content-addressed store, hash-verified

506 self.model = self.model.to(self.device)
507
508 def generate(self, x, x_stamp, y_stamp, pred_len, T, top_k, top_p, sample_count, verbose):
509
510 x_tensor = torch.from_numpy(np.array(x).astype(np.float32)).to(self.device)
511 x_stamp_tensor = torch.from_numpy(np.array(x_stamp).astype(np.float32)).to(self.device)
512 y_stamp_tensor = torch.from_numpy(np.array(y_stamp).astype(np.float32)).to(self.device)
513
514 preds = auto_regressive_inference(self.tokenizer, self.model, x_tensor, x_stamp_tensor, y_stamp_tensor, self.max_context, pred_len,
515 self.clip, T, top_k, top_p, sample_count, verbose)
516 preds = preds[:, -pred_len:, :]
517 return preds
518
519 def predict(self, df, x_timestamp, y_timestamp, pred_len, T=1.0, top_k=0, top_p=0.9, sample_count=1, verbose=True):
520

Callers 2

predictMethod · 0.95
predict_batchMethod · 0.95

Calls 1

Tested by

no test coverage detected