|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +# |
| 18 | +from enum import Enum |
| 19 | +from typing import List |
| 20 | + |
| 21 | + |
| 22 | +class BuiltInModelType(Enum): |
| 23 | + # forecast models |
| 24 | + ARIMA = "Arima" |
| 25 | + HOLTWINTERS = "HoltWinters" |
| 26 | + EXPONENTIAL_SMOOTHING = "ExponentialSmoothing" |
| 27 | + NAIVE_FORECASTER = "NaiveForecaster" |
| 28 | + STL_FORECASTER = "StlForecaster" |
| 29 | + |
| 30 | + # anomaly detection models |
| 31 | + GAUSSIAN_HMM = "GaussianHmm" |
| 32 | + GMM_HMM = "GmmHmm" |
| 33 | + STRAY = "Stray" |
| 34 | + |
| 35 | + # large time series models (LTSM) |
| 36 | + TIMER_XL = "Timer-XL" |
| 37 | + # sundial |
| 38 | + SUNDIAL = "Timer-Sundial" |
| 39 | + |
| 40 | + @classmethod |
| 41 | + def values(cls) -> List[str]: |
| 42 | + return [item.value for item in cls] |
| 43 | + |
| 44 | + @staticmethod |
| 45 | + def is_built_in_model(model_type: str) -> bool: |
| 46 | + """ |
| 47 | + Check if the given model type corresponds to a built-in model. |
| 48 | + """ |
| 49 | + return model_type in BuiltInModelType.values() |
| 50 | + |
| 51 | + |
| 52 | +class ModelFileType(Enum): |
| 53 | + SAFETENSORS = "safetensors" |
| 54 | + PYTORCH = "pytorch" |
| 55 | + UNKNOWN = "unknown" |
| 56 | + |
| 57 | + |
| 58 | +class ModelCategory(Enum): |
| 59 | + BUILT_IN = "BUILT-IN" |
| 60 | + FINE_TUNED = "FINE-TUNED" |
| 61 | + USER_DEFINED = "USER-DEFINED" |
| 62 | + |
| 63 | + |
| 64 | +class ModelStates(Enum): |
| 65 | + ACTIVE = "ACTIVE" |
| 66 | + INACTIVE = "INACTIVE" |
| 67 | + LOADING = "LOADING" |
| 68 | + DROPPING = "DROPPING" |
| 69 | + TRAINING = "TRAINING" |
| 70 | + FAILED = "FAILED" |
0 commit comments