omniverse1 commited on
Commit
65e06a7
·
verified ·
1 Parent(s): 75654a9

update models 1.4

Browse files
Files changed (1) hide show
  1. models.py +3 -3
models.py CHANGED
@@ -1,7 +1,7 @@
1
  import torch
2
  import numpy as np
3
  import pandas as pd
4
- from chronos.pipeline import ChronosPipeline
5
  import warnings
6
  warnings.filterwarnings('ignore')
7
 
@@ -16,7 +16,7 @@ def load_timesfm_model():
16
  try:
17
  print(f"Loading Chronos Pipeline: {model_name}")
18
  # ChronosPipeline handles model, tokenizer, and device placement automatically
19
- _pipeline = ChronosPipeline.from_pretrained(
20
  model_name,
21
  # Setting device_map="auto" to automatically select available device
22
  device_map="auto"
@@ -24,7 +24,7 @@ def load_timesfm_model():
24
  print(f"Model loaded successfully.")
25
  return _pipeline
26
  except Exception as e:
27
- print(f"Error loading model: {e}. Please ensure the 'chronos' library is installed.")
28
  _pipeline = None
29
  return None
30
  return _pipeline
 
1
  import torch
2
  import numpy as np
3
  import pandas as pd
4
+ from chronos import BaseChronosPipeline # GANTI DARI 'chronos.pipeline import ChronosPipeline'
5
  import warnings
6
  warnings.filterwarnings('ignore')
7
 
 
16
  try:
17
  print(f"Loading Chronos Pipeline: {model_name}")
18
  # ChronosPipeline handles model, tokenizer, and device placement automatically
19
+ _pipeline = BaseChronosPipeline.from_pretrained( # MENGGUNAKAN BaseChronosPipeline
20
  model_name,
21
  # Setting device_map="auto" to automatically select available device
22
  device_map="auto"
 
24
  print(f"Model loaded successfully.")
25
  return _pipeline
26
  except Exception as e:
27
+ print(f"Error loading model: {e}. Please ensure the 'chronos-forecasting' library is installed.")
28
  _pipeline = None
29
  return None
30
  return _pipeline