HONGRIZON commited on
Commit
bd81bdd
·
verified ·
1 Parent(s): 023def7

Delete modeling_jnu_tsb.py

Browse files
Files changed (1) hide show
  1. modeling_jnu_tsb.py +0 -43
modeling_jnu_tsb.py DELETED
@@ -1,43 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any, Dict, Optional
4
-
5
- import torch
6
- from torch import nn
7
- from transformers import PreTrainedModel
8
-
9
- try:
10
- from .configuration_jnu_tsb import JNUTSBConfig
11
- except ImportError: # pragma: no cover - local execution fallback
12
- from configuration_jnu_tsb import JNUTSBConfig
13
-
14
-
15
- class JNUTSBModel(PreTrainedModel):
16
- """Tiny placeholder model for Hugging Face AutoModel loading.
17
-
18
- The actual forecasting and routing logic lives in ``runtime.JNUTSBRuntime``.
19
- This class exists so that ``AutoModel.from_pretrained(..., trust_remote_code=True)``
20
- can load a normal model object from the Hub.
21
- """
22
-
23
- config_class = JNUTSBConfig
24
- base_model_prefix = "jnu_tsb"
25
- main_input_name = "inputs"
26
-
27
- def __init__(self, config: JNUTSBConfig) -> None:
28
- super().__init__(config)
29
- self.dummy = nn.Parameter(torch.zeros(1), requires_grad=False)
30
-
31
- def forward(self, *args: Any, **kwargs: Any) -> Dict[str, str]:
32
- return {
33
- "message": "JNU-TSB is a router wrapper. Use pipeline(task='jnu-tsb', ...) or model.predict(...)."
34
- }
35
-
36
- def predict(self, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) -> Any:
37
- try:
38
- from .runtime import JNUTSBRuntime
39
- except ImportError: # pragma: no cover
40
- from runtime import JNUTSBRuntime
41
-
42
- runtime = JNUTSBRuntime.from_config(self.config)
43
- return runtime.predict(inputs=inputs, **kwargs)