register.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. import os.path as osp
  16. from ...base.register import register_model_info, register_suite_info
  17. from ..ts_base.model import TSModel
  18. from ..ts_base.runner import TSRunner
  19. from .config import LongForecastConfig
  20. REPO_ROOT_PATH = os.environ.get("PADDLE_PDX_PADDLETS_PATH")
  21. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), "..", "configs"))
  22. register_suite_info(
  23. {
  24. "suite_name": "LongForecast",
  25. "model": TSModel,
  26. "runner": TSRunner,
  27. "config": LongForecastConfig,
  28. "runner_root_path": REPO_ROOT_PATH,
  29. }
  30. )
  31. ################ Models Using Universal Config ################
  32. # DLinear
  33. DLinear_CFG_PATH = osp.join(PDX_CONFIG_DIR, "DLinear.yaml")
  34. register_model_info(
  35. {
  36. "model_name": "DLinear",
  37. "suite": "LongForecast",
  38. "config_path": DLinear_CFG_PATH,
  39. "supported_apis": ["train", "evaluate", "predict", "export"],
  40. "supported_train_opts": {
  41. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  42. "dy2st": False,
  43. "amp": [],
  44. },
  45. "supported_evaluate_opts": {
  46. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  47. "amp": [],
  48. },
  49. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  50. "supported_infer_opts": {"device": ["cpu", "gpu"]},
  51. }
  52. )
  53. DLinear_CFG_PATH = osp.join(PDX_CONFIG_DIR, "RLinear.yaml")
  54. register_model_info(
  55. {
  56. "model_name": "RLinear",
  57. "suite": "LongForecast",
  58. "config_path": DLinear_CFG_PATH,
  59. "supported_apis": ["train", "evaluate", "predict", "export"],
  60. "supported_train_opts": {
  61. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  62. "dy2st": False,
  63. "amp": [],
  64. },
  65. "supported_evaluate_opts": {
  66. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  67. "amp": [],
  68. },
  69. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  70. "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  71. }
  72. )
  73. DLinear_CFG_PATH = osp.join(PDX_CONFIG_DIR, "NLinear.yaml")
  74. register_model_info(
  75. {
  76. "model_name": "NLinear",
  77. "suite": "LongForecast",
  78. "config_path": DLinear_CFG_PATH,
  79. "supported_apis": ["train", "evaluate", "predict", "export"],
  80. "supported_train_opts": {
  81. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  82. "dy2st": False,
  83. "amp": [],
  84. },
  85. "supported_evaluate_opts": {
  86. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  87. "amp": [],
  88. },
  89. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  90. "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  91. }
  92. )
  93. # TiDE
  94. TiDE_CFG_PATH = osp.join(PDX_CONFIG_DIR, "TiDE.yaml")
  95. register_model_info(
  96. {
  97. "model_name": "TiDE",
  98. "suite": "LongForecast",
  99. "config_path": TiDE_CFG_PATH,
  100. "supported_apis": ["train", "evaluate", "predict", "export"],
  101. "supported_train_opts": {
  102. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  103. "dy2st": False,
  104. "amp": [],
  105. },
  106. "supported_evaluate_opts": {
  107. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  108. "amp": [],
  109. },
  110. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  111. "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  112. }
  113. )
  114. # PatchTST
  115. PatchTST_CFG_PATH = osp.join(PDX_CONFIG_DIR, "PatchTST.yaml")
  116. register_model_info(
  117. {
  118. "model_name": "PatchTST",
  119. "suite": "LongForecast",
  120. "config_path": PatchTST_CFG_PATH,
  121. "supported_apis": ["train", "evaluate", "predict", "export"],
  122. "supported_train_opts": {
  123. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  124. "dy2st": False,
  125. "amp": [],
  126. },
  127. "supported_evaluate_opts": {"device": ["cpu", "gpu_n1cx"], "amp": []},
  128. "supported_predict_opts": {"device": ["cpu", "gpu"]},
  129. "supported_infer_opts": {"device": ["cpu", "gpu"]},
  130. }
  131. )
  132. # Non-stationary
  133. Nonstationary_CFG_PATH = osp.join(PDX_CONFIG_DIR, "Nonstationary.yaml")
  134. register_model_info(
  135. {
  136. "model_name": "Nonstationary",
  137. "suite": "LongForecast",
  138. "config_path": Nonstationary_CFG_PATH,
  139. "supported_apis": ["train", "evaluate", "predict", "export"],
  140. "supported_train_opts": {
  141. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  142. "dy2st": False,
  143. "amp": [],
  144. },
  145. "supported_evaluate_opts": {
  146. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  147. "amp": [],
  148. },
  149. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  150. "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  151. }
  152. )
  153. # timesnet
  154. TimesNet_CFG_PATH = osp.join(PDX_CONFIG_DIR, "TimesNet.yaml")
  155. register_model_info(
  156. {
  157. "model_name": "TimesNet",
  158. "suite": "LongForecast",
  159. "config_path": TimesNet_CFG_PATH,
  160. "supported_apis": ["train", "evaluate", "predict", "export"],
  161. "supported_train_opts": {
  162. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  163. "dy2st": False,
  164. "amp": [],
  165. },
  166. "supported_evaluate_opts": {
  167. "device": ["cpu", "gpu_n1cx", "xpu", "npu", "mlu"],
  168. "amp": [],
  169. },
  170. "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  171. "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
  172. }
  173. )