tirex-mirror 2025.6.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tirex_mirror-2025.6.9/LICENSE +49 -0
- tirex_mirror-2025.6.9/LICENSE_MIRROR.txt +7 -0
- tirex_mirror-2025.6.9/MANIFEST.in +3 -0
- tirex_mirror-2025.6.9/NOTICE.txt +1 -0
- tirex_mirror-2025.6.9/PKG-INFO +180 -0
- tirex_mirror-2025.6.9/README.md +92 -0
- tirex_mirror-2025.6.9/pyproject.toml +60 -0
- tirex_mirror-2025.6.9/setup.cfg +4 -0
- tirex_mirror-2025.6.9/src/tirex/__init__.py +8 -0
- tirex_mirror-2025.6.9/src/tirex/api_adapter/__init__.py +2 -0
- tirex_mirror-2025.6.9/src/tirex/api_adapter/forecast.py +209 -0
- tirex_mirror-2025.6.9/src/tirex/api_adapter/gluon.py +48 -0
- tirex_mirror-2025.6.9/src/tirex/api_adapter/hf_data.py +38 -0
- tirex_mirror-2025.6.9/src/tirex/api_adapter/standard_adapter.py +67 -0
- tirex_mirror-2025.6.9/src/tirex/base.py +73 -0
- tirex_mirror-2025.6.9/src/tirex/models/__init__.py +2 -0
- tirex_mirror-2025.6.9/src/tirex/models/components.py +147 -0
- tirex_mirror-2025.6.9/src/tirex/models/mixed_stack.py +143 -0
- tirex_mirror-2025.6.9/src/tirex/models/predict_utils.py +72 -0
- tirex_mirror-2025.6.9/src/tirex/models/tirex.py +231 -0
- tirex_mirror-2025.6.9/src/tirex_mirror.egg-info/PKG-INFO +180 -0
- tirex_mirror-2025.6.9/src/tirex_mirror.egg-info/SOURCES.txt +25 -0
- tirex_mirror-2025.6.9/src/tirex_mirror.egg-info/dependency_links.txt +1 -0
- tirex_mirror-2025.6.9/src/tirex_mirror.egg-info/requires.txt +25 -0
- tirex_mirror-2025.6.9/src/tirex_mirror.egg-info/top_level.txt +1 -0
- tirex_mirror-2025.6.9/tests/test_forecast_adapter.py +101 -0
- tirex_mirror-2025.6.9/tests/test_standard_adapter.py +183 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
NXAI COMMUNITY LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
Preamble 1
|
|
4
|
+
|
|
5
|
+
We are proud to present the NXAI TiRex time series model and software, demonstrating the strength of xLSTM for time series. While TiRex is freely available for open research and development, we believe that organizations significantly benefiting from our technology should contribute back. Our goal is to support research, small and medium-sized enterprises (SMEs), and open innovation, while ensuring that large enterprises who incorporate TiRex into commercial products or services fairly compensate the creators for their research and development efforts.
|
|
6
|
+
|
|
7
|
+
Linz, May 27, 2025.
|
|
8
|
+
|
|
9
|
+
Preamble 2
|
|
10
|
+
|
|
11
|
+
The NXAI COMMUNITY LICENSE AGREEMENT is based on the META LLAMA 3 COMMUNITY LICENSE AGREEMENT and contains some modifications, especially Section 2, “Additional Commercial Terms” is different.
|
|
12
|
+
|
|
13
|
+
“Agreement” means the terms and conditions for use, reproduction, distribution and modification of the NXAI Materials set forth herein.
|
|
14
|
+
“Documentation” means the specifications, manuals and documentation accompanying NXAI Materials distributed by NXAI at https://github.com/NX-AI/.
|
|
15
|
+
“Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
|
|
16
|
+
“NXAI Materials” means, collectively, NXAI’s proprietary models, algorithms and any Software, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code and all other work of NXAI in the field of neural networks, Documentation (and any portion thereof) made available under this Agreement.
|
|
17
|
+
“NXAI” or “we” means NXAI GmbH, Linz, Austria. Contact: license@nx-ai.com
|
|
18
|
+
|
|
19
|
+
By using or distributing any portion or element of the NXAI Materials, you agree to be bound by this Agreement.
|
|
20
|
+
|
|
21
|
+
1. License Rights and Redistribution.
|
|
22
|
+
|
|
23
|
+
a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under NXAIs intellectual property embodied in the NXAI Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the NXAI Materials.
|
|
24
|
+
|
|
25
|
+
b. Redistribution and Use.
|
|
26
|
+
|
|
27
|
+
i. If you distribute or make available the NXAI Materials (or any derivative works thereof), or a product or service that uses any of them, including another AI model, you shall (A) provide a copy of this Agreement with any such NXAI Materials; and (B) prominently display “Built with technology from NXAI” on a related website, user interface, blogpost, about page, or product documentation.
|
|
28
|
+
|
|
29
|
+
ii. If you receive NXAI Materials, or any derivative works thereof, from a Licensee as part of an integrated end user product, then Section 2 of this Agreement will not apply to you.
|
|
30
|
+
|
|
31
|
+
iii. You must retain in all copies of the NXAI Materials that you distribute the following attribution notice within a “Notice” text file distributed as a part of such copies: “This product includes materials developed at NXAI that are licensed under the NXAI Community License, Copyright © NXAI GmbH, All Rights Reserved.”
|
|
32
|
+
|
|
33
|
+
2. Additional Commercial Terms. If (a) the Licensee, on a consolidated basis (including parent, subsidiaries, and affiliates), exceeds the annual revenue of one hundred million Euros (€100,000,000), and (b) the Licensee incorporates NXAI Material, in whole or in part, into a Commercial Product or Service, then the Licensee must obtain a commercial license from NXAI, which NXAI may grant to you in its sole discretion, and you are not authorized to exercise any of the rights under this Agreement unless or until NXAI otherwise expressly grants you such rights.
|
|
34
|
+
|
|
35
|
+
3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE NXAI MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND NXAI DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE NXAI MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE NXAI MATERIALS AND ANY OUTPUT AND RESULTS.
|
|
36
|
+
|
|
37
|
+
4. Limitation of Liability. IN NO EVENT WILL NXAI OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF NXAI OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
|
|
38
|
+
|
|
39
|
+
5. Intellectual Property.
|
|
40
|
+
|
|
41
|
+
a. No trademark licenses are granted under this Agreement, and in connection with the NXAI Materials, neither NXAI nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the NXAI Materials or as set forth in this Section 5(a). NXAI hereby grants you a license to use “NXAI” (the “Mark”) solely as required to comply with the last sentence of Section 1.b.i. All goodwill arising out of your use of the Mark will insure to the benefit of NXAI.
|
|
42
|
+
|
|
43
|
+
b. Subject to NXAI’s ownership of NXAI Materials and derivatives made by or for NXAI, with respect to any derivative works and modifications of the NXAI Materials that are made by you, as between you and NXAI, you are and will be the owner of such derivative works and modifications.
|
|
44
|
+
|
|
45
|
+
c. If you institute litigation or other proceedings against NXAI or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the NXAI Materials or models released by NXAI outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless NXAI from and against any claim by any third party arising out of or related to your use or distribution of the NXAI Materials.
|
|
46
|
+
|
|
47
|
+
6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the NXAI Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. NXAI may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the NXAI Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
|
|
48
|
+
|
|
49
|
+
7. Governing Law and Jurisdiction. This Agreement shall be governed by and construed in accordance with the laws of the Republic of Austria, without regard to its conflict of laws principles. The courts located in Linz, Austria shall have exclusive jurisdiction over any disputes arising out of or in connection with this Agreement.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
This project, `tirex-mirror`, is an unofficial mirror and repackaging of the TiRex model developed by NXAI GmbH.
|
|
2
|
+
|
|
3
|
+
It is maintained solely to enable installation via PyPI and does not modify or extend the original code or functionality.
|
|
4
|
+
|
|
5
|
+
This repository is not affiliated with or endorsed by NXAI GmbH.
|
|
6
|
+
|
|
7
|
+
All rights to the original code remain with NXAI GmbH. Please refer to `LICENSE.txt` and `NOTICE.txt` for licensing terms and attribution requirements as defined by the NXAI Community License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This product includes materials developed at NXAI that are licensed under the NXAI Community License, Copyright © NXAI GmbH, All Rights Reserved.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tirex-mirror
|
|
3
|
+
Version: 2025.6.9
|
|
4
|
+
Summary: Unofficial mirror of NX-AI/tirex for packaging
|
|
5
|
+
Author-email: Arpad Rozsas <rozsasarpi@gmail.com>
|
|
6
|
+
License: NXAI COMMUNITY LICENSE AGREEMENT
|
|
7
|
+
|
|
8
|
+
Preamble 1
|
|
9
|
+
|
|
10
|
+
We are proud to present the NXAI TiRex time series model and software, demonstrating the strength of xLSTM for time series. While TiRex is freely available for open research and development, we believe that organizations significantly benefiting from our technology should contribute back. Our goal is to support research, small and medium-sized enterprises (SMEs), and open innovation, while ensuring that large enterprises who incorporate TiRex into commercial products or services fairly compensate the creators for their research and development efforts.
|
|
11
|
+
|
|
12
|
+
Linz, May 27, 2025.
|
|
13
|
+
|
|
14
|
+
Preamble 2
|
|
15
|
+
|
|
16
|
+
The NXAI COMMUNITY LICENSE AGREEMENT is based on the META LLAMA 3 COMMUNITY LICENSE AGREEMENT and contains some modifications, especially Section 2, “Additional Commercial Terms” is different.
|
|
17
|
+
|
|
18
|
+
“Agreement” means the terms and conditions for use, reproduction, distribution and modification of the NXAI Materials set forth herein.
|
|
19
|
+
“Documentation” means the specifications, manuals and documentation accompanying NXAI Materials distributed by NXAI at https://github.com/NX-AI/.
|
|
20
|
+
“Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
|
|
21
|
+
“NXAI Materials” means, collectively, NXAI’s proprietary models, algorithms and any Software, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code and all other work of NXAI in the field of neural networks, Documentation (and any portion thereof) made available under this Agreement.
|
|
22
|
+
“NXAI” or “we” means NXAI GmbH, Linz, Austria. Contact: license@nx-ai.com
|
|
23
|
+
|
|
24
|
+
By using or distributing any portion or element of the NXAI Materials, you agree to be bound by this Agreement.
|
|
25
|
+
|
|
26
|
+
1. License Rights and Redistribution.
|
|
27
|
+
|
|
28
|
+
a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under NXAIs intellectual property embodied in the NXAI Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the NXAI Materials.
|
|
29
|
+
|
|
30
|
+
b. Redistribution and Use.
|
|
31
|
+
|
|
32
|
+
i. If you distribute or make available the NXAI Materials (or any derivative works thereof), or a product or service that uses any of them, including another AI model, you shall (A) provide a copy of this Agreement with any such NXAI Materials; and (B) prominently display “Built with technology from NXAI” on a related website, user interface, blogpost, about page, or product documentation.
|
|
33
|
+
|
|
34
|
+
ii. If you receive NXAI Materials, or any derivative works thereof, from a Licensee as part of an integrated end user product, then Section 2 of this Agreement will not apply to you.
|
|
35
|
+
|
|
36
|
+
iii. You must retain in all copies of the NXAI Materials that you distribute the following attribution notice within a “Notice” text file distributed as a part of such copies: “This product includes materials developed at NXAI that are licensed under the NXAI Community License, Copyright © NXAI GmbH, All Rights Reserved.”
|
|
37
|
+
|
|
38
|
+
2. Additional Commercial Terms. If (a) the Licensee, on a consolidated basis (including parent, subsidiaries, and affiliates), exceeds the annual revenue of one hundred million Euros (€100,000,000), and (b) the Licensee incorporates NXAI Material, in whole or in part, into a Commercial Product or Service, then the Licensee must obtain a commercial license from NXAI, which NXAI may grant to you in its sole discretion, and you are not authorized to exercise any of the rights under this Agreement unless or until NXAI otherwise expressly grants you such rights.
|
|
39
|
+
|
|
40
|
+
3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE NXAI MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND NXAI DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE NXAI MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE NXAI MATERIALS AND ANY OUTPUT AND RESULTS.
|
|
41
|
+
|
|
42
|
+
4. Limitation of Liability. IN NO EVENT WILL NXAI OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF NXAI OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
|
|
43
|
+
|
|
44
|
+
5. Intellectual Property.
|
|
45
|
+
|
|
46
|
+
a. No trademark licenses are granted under this Agreement, and in connection with the NXAI Materials, neither NXAI nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the NXAI Materials or as set forth in this Section 5(a). NXAI hereby grants you a license to use “NXAI” (the “Mark”) solely as required to comply with the last sentence of Section 1.b.i. All goodwill arising out of your use of the Mark will insure to the benefit of NXAI.
|
|
47
|
+
|
|
48
|
+
b. Subject to NXAI’s ownership of NXAI Materials and derivatives made by or for NXAI, with respect to any derivative works and modifications of the NXAI Materials that are made by you, as between you and NXAI, you are and will be the owner of such derivative works and modifications.
|
|
49
|
+
|
|
50
|
+
c. If you institute litigation or other proceedings against NXAI or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the NXAI Materials or models released by NXAI outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless NXAI from and against any claim by any third party arising out of or related to your use or distribution of the NXAI Materials.
|
|
51
|
+
|
|
52
|
+
6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the NXAI Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. NXAI may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the NXAI Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
|
|
53
|
+
|
|
54
|
+
7. Governing Law and Jurisdiction. This Agreement shall be governed by and construed in accordance with the laws of the Republic of Austria, without regard to its conflict of laws principles. The courts located in Linz, Austria shall have exclusive jurisdiction over any disputes arising out of or in connection with this Agreement.
|
|
55
|
+
|
|
56
|
+
Project-URL: Repository, https://github.com/rozsasarpi/tirex-mirror
|
|
57
|
+
Project-URL: Issues, https://github.com/rozsasarpi/tirex-mirror/issues
|
|
58
|
+
Keywords: TiRex,xLSTM,Time Series,Zero-shot,Deep Learning
|
|
59
|
+
Classifier: Programming Language :: Python :: 3
|
|
60
|
+
Classifier: Operating System :: OS Independent
|
|
61
|
+
Requires-Python: >=3.11
|
|
62
|
+
Description-Content-Type: text/markdown
|
|
63
|
+
License-File: LICENSE
|
|
64
|
+
License-File: LICENSE_MIRROR.txt
|
|
65
|
+
License-File: NOTICE.txt
|
|
66
|
+
Requires-Dist: torch
|
|
67
|
+
Requires-Dist: torchvision
|
|
68
|
+
Requires-Dist: xlstm
|
|
69
|
+
Requires-Dist: einops
|
|
70
|
+
Requires-Dist: ninja
|
|
71
|
+
Requires-Dist: huggingface-hub
|
|
72
|
+
Requires-Dist: lightning
|
|
73
|
+
Requires-Dist: numpy
|
|
74
|
+
Requires-Dist: pandas
|
|
75
|
+
Requires-Dist: dacite
|
|
76
|
+
Requires-Dist: tqdm
|
|
77
|
+
Provides-Extra: notebooks
|
|
78
|
+
Requires-Dist: ipykernel; extra == "notebooks"
|
|
79
|
+
Provides-Extra: gluonts
|
|
80
|
+
Requires-Dist: gluonts; extra == "gluonts"
|
|
81
|
+
Provides-Extra: hfdataset
|
|
82
|
+
Requires-Dist: datasets; extra == "hfdataset"
|
|
83
|
+
Provides-Extra: all
|
|
84
|
+
Requires-Dist: ipykernel; extra == "all"
|
|
85
|
+
Requires-Dist: gluonts; extra == "all"
|
|
86
|
+
Requires-Dist: datasets; extra == "all"
|
|
87
|
+
Dynamic: license-file
|
|
88
|
+
|
|
89
|
+
# tirex-mirror
|
|
90
|
+
|
|
91
|
+
Unofficial mirror of [NX-AI/tirex](https://github.com/NX-AI/tirex) for packaging.
|
|
92
|
+
|
|
93
|
+
## Legal Notice
|
|
94
|
+
|
|
95
|
+
This is an unofficial mirror of [NX-AI/tirex](https://github.com/NX-AI/tirex).
|
|
96
|
+
See [NOTICE.txt](NOTICE.txt) and [LICENSE_MIRROR.txt](LICENSE_MIRROR.txt) for attribution details.
|
|
97
|
+
The original project is licensed under the terms in [LICENSE](LICENSE).
|
|
98
|
+
|
|
99
|
+
## Purpose
|
|
100
|
+
|
|
101
|
+
This repository automatically mirrors the upstream TiRex project and publishes it to PyPI as `tirex-mirror` for packaging and distribution purposes.
|
|
102
|
+
|
|
103
|
+
**Installation**: `pip install tirex-mirror`
|
|
104
|
+
**Import**: `import tirex`
|
|
105
|
+
|
|
106
|
+
## Development Notes
|
|
107
|
+
|
|
108
|
+
### Setting up local environment
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Create and activate virtual environment
|
|
112
|
+
python -m venv venv
|
|
113
|
+
source venv/bin/activate
|
|
114
|
+
|
|
115
|
+
# Install build dependencies
|
|
116
|
+
pip install build toml twine
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Dry run workflow steps locally
|
|
120
|
+
|
|
121
|
+
Run commands from `publish.yml`.
|
|
122
|
+
|
|
123
|
+
Test building the package
|
|
124
|
+
```bash
|
|
125
|
+
python -m build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Manual publishing
|
|
129
|
+
|
|
130
|
+
Check package contents
|
|
131
|
+
```bash
|
|
132
|
+
twine check dist/*
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Test upload to TestPyPI (optional)
|
|
136
|
+
```bash
|
|
137
|
+
twine upload --repository testpypi dist/*
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Real upload to PyPI
|
|
141
|
+
```bash
|
|
142
|
+
twine upload dist/*
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Test the package (from testpypi):
|
|
146
|
+
```bash
|
|
147
|
+
pip install \
|
|
148
|
+
--index-url https://test.pypi.org/simple/ \
|
|
149
|
+
--extra-index-url https://pypi.org/simple \
|
|
150
|
+
tirex-mirror==2025.06.09
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### GitHub Releases
|
|
154
|
+
|
|
155
|
+
The workflow automatically creates GitHub releases alongside PyPI releases.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# View releases
|
|
159
|
+
gh release list
|
|
160
|
+
|
|
161
|
+
# Create manual release (if needed)
|
|
162
|
+
VERSION="2025.06.09"
|
|
163
|
+
gh release create "v$VERSION" \
|
|
164
|
+
--title "TiRex Mirror v$VERSION" \
|
|
165
|
+
--notes "Manual release" \
|
|
166
|
+
dist/*
|
|
167
|
+
|
|
168
|
+
# Manual workflow trigger
|
|
169
|
+
gh workflow run publish.yml
|
|
170
|
+
|
|
171
|
+
# Check workflow status
|
|
172
|
+
gh run list --workflow=publish.yml
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Cleanup after testing
|
|
176
|
+
|
|
177
|
+
Remove all untracked and ignored files and folders
|
|
178
|
+
```bash
|
|
179
|
+
git ls-files -o -i --exclude-standard | grep -vE '^(\.venv|venv)/' | xargs -r rm -rf
|
|
180
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# tirex-mirror
|
|
2
|
+
|
|
3
|
+
Unofficial mirror of [NX-AI/tirex](https://github.com/NX-AI/tirex) for packaging.
|
|
4
|
+
|
|
5
|
+
## Legal Notice
|
|
6
|
+
|
|
7
|
+
This is an unofficial mirror of [NX-AI/tirex](https://github.com/NX-AI/tirex).
|
|
8
|
+
See [NOTICE.txt](NOTICE.txt) and [LICENSE_MIRROR.txt](LICENSE_MIRROR.txt) for attribution details.
|
|
9
|
+
The original project is licensed under the terms in [LICENSE](LICENSE).
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
This repository automatically mirrors the upstream TiRex project and publishes it to PyPI as `tirex-mirror` for packaging and distribution purposes.
|
|
14
|
+
|
|
15
|
+
**Installation**: `pip install tirex-mirror`
|
|
16
|
+
**Import**: `import tirex`
|
|
17
|
+
|
|
18
|
+
## Development Notes
|
|
19
|
+
|
|
20
|
+
### Setting up local environment
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Create and activate virtual environment
|
|
24
|
+
python -m venv venv
|
|
25
|
+
source venv/bin/activate
|
|
26
|
+
|
|
27
|
+
# Install build dependencies
|
|
28
|
+
pip install build toml twine
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Dry run workflow steps locally
|
|
32
|
+
|
|
33
|
+
Run commands from `publish.yml`.
|
|
34
|
+
|
|
35
|
+
Test building the package
|
|
36
|
+
```bash
|
|
37
|
+
python -m build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Manual publishing
|
|
41
|
+
|
|
42
|
+
Check package contents
|
|
43
|
+
```bash
|
|
44
|
+
twine check dist/*
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Test upload to TestPyPI (optional)
|
|
48
|
+
```bash
|
|
49
|
+
twine upload --repository testpypi dist/*
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Real upload to PyPI
|
|
53
|
+
```bash
|
|
54
|
+
twine upload dist/*
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Test the package (from testpypi):
|
|
58
|
+
```bash
|
|
59
|
+
pip install \
|
|
60
|
+
--index-url https://test.pypi.org/simple/ \
|
|
61
|
+
--extra-index-url https://pypi.org/simple \
|
|
62
|
+
tirex-mirror==2025.06.09
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### GitHub Releases
|
|
66
|
+
|
|
67
|
+
The workflow automatically creates GitHub releases alongside PyPI releases.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# View releases
|
|
71
|
+
gh release list
|
|
72
|
+
|
|
73
|
+
# Create manual release (if needed)
|
|
74
|
+
VERSION="2025.06.09"
|
|
75
|
+
gh release create "v$VERSION" \
|
|
76
|
+
--title "TiRex Mirror v$VERSION" \
|
|
77
|
+
--notes "Manual release" \
|
|
78
|
+
dist/*
|
|
79
|
+
|
|
80
|
+
# Manual workflow trigger
|
|
81
|
+
gh workflow run publish.yml
|
|
82
|
+
|
|
83
|
+
# Check workflow status
|
|
84
|
+
gh run list --workflow=publish.yml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Cleanup after testing
|
|
88
|
+
|
|
89
|
+
Remove all untracked and ignored files and folders
|
|
90
|
+
```bash
|
|
91
|
+
git ls-files -o -i --exclude-standard | grep -vE '^(\.venv|venv)/' | xargs -r rm -rf
|
|
92
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tirex-mirror"
|
|
3
|
+
version = "2025.06.09"
|
|
4
|
+
description = "Unofficial mirror of NX-AI/tirex for packaging"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
classifiers = [ "Programming Language :: Python :: 3", "Operating System :: OS Independent",]
|
|
8
|
+
keywords = [ "TiRex", "xLSTM", "Time Series", "Zero-shot", "Deep Learning",]
|
|
9
|
+
dependencies = [ "torch", "torchvision", "xlstm", "einops", "ninja", "huggingface-hub", "lightning", "numpy", "pandas", "dacite", "tqdm",]
|
|
10
|
+
[[project.authors]]
|
|
11
|
+
name = "Arpad Rozsas"
|
|
12
|
+
email = "rozsasarpi@gmail.com"
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = [ "setuptools>=42", "wheel",]
|
|
16
|
+
build-backend = "setuptools.build_meta"
|
|
17
|
+
|
|
18
|
+
[project.license]
|
|
19
|
+
file = "LICENSE"
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Repository = "https://github.com/rozsasarpi/tirex-mirror"
|
|
23
|
+
Issues = "https://github.com/rozsasarpi/tirex-mirror/issues"
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
notebooks = [ "ipykernel",]
|
|
27
|
+
gluonts = [ "gluonts",]
|
|
28
|
+
hfdataset = [ "datasets",]
|
|
29
|
+
all = [ "ipykernel", "gluonts", "datasets",]
|
|
30
|
+
|
|
31
|
+
[tool.docformatter]
|
|
32
|
+
diff = false
|
|
33
|
+
docstring-length = [ 40, 1000,]
|
|
34
|
+
in-place = true
|
|
35
|
+
pre-summary-newline = true
|
|
36
|
+
recursive = true
|
|
37
|
+
wrap-summaries = 100
|
|
38
|
+
wrap-descriptions = 100
|
|
39
|
+
non-cap = [ "TiRex", "xLSTM", "sLSTM",]
|
|
40
|
+
|
|
41
|
+
[tool.ruff]
|
|
42
|
+
exclude = [ ".eggs", ".git", ".ipynb_checkpoints", ".pytest_cache", ".ruff_cache", ".vscode", "__pypackages__", "_build", "build", "dist", "node_modules", "site-packages", "archive",]
|
|
43
|
+
line-length = 120
|
|
44
|
+
target-version = "py311"
|
|
45
|
+
|
|
46
|
+
[tool.ruff.format]
|
|
47
|
+
quote-style = "double"
|
|
48
|
+
|
|
49
|
+
[tool.ruff.lint]
|
|
50
|
+
select = [ "I001",]
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint.mccabe]
|
|
53
|
+
max-complexity = 18
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint.isort]
|
|
56
|
+
combine-as-imports = true
|
|
57
|
+
section-order = [ "future", "standard-library", "third-party", "first-party", "tirex", "local-folder",]
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint.isort.sections]
|
|
60
|
+
tirex = [ "tirex",]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Copyright (c) NXAI GmbH.
|
|
2
|
+
# This software may be used and distributed according to the terms of the NXAI Community License Agreement.
|
|
3
|
+
|
|
4
|
+
from .api_adapter.forecast import ForecastModel
|
|
5
|
+
from .base import load_model
|
|
6
|
+
from .models.tirex import TiRexZero
|
|
7
|
+
|
|
8
|
+
__all__ = ["load_model", "ForecastModel"]
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Copyright (c) NXAI GmbH.
|
|
2
|
+
# This software may be used and distributed according to the terms of the NXAI Community License Agreement.
|
|
3
|
+
|
|
4
|
+
from abc import ABC, abstractmethod
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
import torch
|
|
8
|
+
|
|
9
|
+
from .standard_adapter import ContextType, get_batches
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from .gluon import format_gluonts_output, get_gluon_batches
|
|
13
|
+
|
|
14
|
+
_GLUONTS_AVAILABLE = True
|
|
15
|
+
except ImportError:
|
|
16
|
+
_GLUONTS_AVAILABLE = False
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
from .hf_data import get_hfdata_batches
|
|
20
|
+
|
|
21
|
+
_HF_DATASETS_AVAILABLE = True
|
|
22
|
+
except ImportError:
|
|
23
|
+
_HF_DATASETS_AVAILABLE = False
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
DEF_TARGET_COLUMN = "target"
|
|
27
|
+
DEF_META_COLUMNS = ("start", "item_id")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _format_output(
|
|
31
|
+
quantiles: torch.Tensor,
|
|
32
|
+
means: torch.Tensor,
|
|
33
|
+
sample_meta: list[dict],
|
|
34
|
+
quantile_levels: list[float],
|
|
35
|
+
output_type: Literal["torch", "numpy", "gluonts"],
|
|
36
|
+
):
|
|
37
|
+
if output_type == "torch":
|
|
38
|
+
return quantiles.cpu(), means.cpu()
|
|
39
|
+
elif output_type == "numpy":
|
|
40
|
+
return quantiles.cpu().numpy(), means.cpu().numpy()
|
|
41
|
+
elif output_type == "gluonts":
|
|
42
|
+
if not _GLUONTS_AVAILABLE:
|
|
43
|
+
raise ValueError("output_type glutonts needs GluonTs but GluonTS is not available (not installed)!")
|
|
44
|
+
return format_gluonts_output(quantiles, means, sample_meta, quantile_levels)
|
|
45
|
+
else:
|
|
46
|
+
raise ValueError(f"Invalid output type: {output_type}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _as_generator(batches, fc_func, quantile_levels, output_type, **predict_kwargs):
|
|
50
|
+
for batch_ctx, batch_meta in batches:
|
|
51
|
+
quantiles, mean = fc_func(batch_ctx, **predict_kwargs)
|
|
52
|
+
yield _format_output(
|
|
53
|
+
quantiles=quantiles,
|
|
54
|
+
means=mean,
|
|
55
|
+
sample_meta=batch_meta,
|
|
56
|
+
quantile_levels=quantile_levels,
|
|
57
|
+
output_type=output_type,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _gen_forecast(fc_func, batches, output_type, quantile_levels, yield_per_batch, **predict_kwargs):
|
|
62
|
+
if yield_per_batch:
|
|
63
|
+
return _as_generator(batches, fc_func, quantile_levels, output_type, **predict_kwargs)
|
|
64
|
+
|
|
65
|
+
prediction_q = []
|
|
66
|
+
prediction_m = []
|
|
67
|
+
sample_meta = []
|
|
68
|
+
for batch_ctx, batch_meta in batches:
|
|
69
|
+
quantiles, mean = fc_func(batch_ctx, **predict_kwargs)
|
|
70
|
+
prediction_q.append(quantiles)
|
|
71
|
+
prediction_m.append(mean)
|
|
72
|
+
sample_meta.extend(batch_meta)
|
|
73
|
+
|
|
74
|
+
prediction_q = torch.cat(prediction_q, dim=0)
|
|
75
|
+
prediction_m = torch.cat(prediction_m, dim=0)
|
|
76
|
+
|
|
77
|
+
return _format_output(
|
|
78
|
+
quantiles=prediction_q,
|
|
79
|
+
means=prediction_m,
|
|
80
|
+
sample_meta=sample_meta,
|
|
81
|
+
quantile_levels=quantile_levels,
|
|
82
|
+
output_type=output_type,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _common_forecast_doc():
|
|
87
|
+
common_doc = f"""
|
|
88
|
+
This method takes historical context data as input and outputs probabilistic forecasts.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
output_type (Literal["torch", "numpy", "gluonts"], optional):
|
|
92
|
+
Specifies the desired format of the returned forecasts:
|
|
93
|
+
- "torch": Returns forecasts as `torch.Tensor` objects [batch_dim, forecast_len, |quantile_levels|]
|
|
94
|
+
- "numpy": Returns forecasts as `numpy.ndarray` objects [batch_dim, forecast_len, |quantile_levels|]
|
|
95
|
+
- "gluonts": Returns forecasts as a list of GluonTS `Forecast` objects.
|
|
96
|
+
Defaults to "torch".
|
|
97
|
+
|
|
98
|
+
batch_size (int, optional): The number of time series instances to process concurrently by the model.
|
|
99
|
+
Defaults to 512. Must be $>= 1$.
|
|
100
|
+
|
|
101
|
+
quantile_levels (List[float], optional): Quantile levels for which predictions should be generated.
|
|
102
|
+
Defaults to (0.1, 0.2, ..., 0.9).
|
|
103
|
+
|
|
104
|
+
yield_per_batch (bool, optional): If `True`, the method will act as a generator, yielding
|
|
105
|
+
forecasts batch by batch as they are computed.
|
|
106
|
+
Defaults to `False`.
|
|
107
|
+
|
|
108
|
+
**predict_kwargs: Additional keyword arguments that are passed directly to the underlying
|
|
109
|
+
prediction mechanism of the pre-trained model. Refer to the model's
|
|
110
|
+
internal prediction method documentation for available options.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
The return type depends on `output_type` and `yield_per_batch`:
|
|
114
|
+
- If `yield_per_batch` is `True`: An iterator that yields forecasts. Each yielded item
|
|
115
|
+
will correspond to a batch of forecasts in the format specified by `output_type`.
|
|
116
|
+
- If `yield_per_batch` is `False`: A single object containing all forecasts.
|
|
117
|
+
- If `output_type="torch"`: `Tuple[torch.Tensor, torch.Tensor]` (quantiles, mean).
|
|
118
|
+
- If `output_type="numpy"`: `Tuple[numpy.ndarray, numpy.ndarray]` (quantiles, mean).
|
|
119
|
+
- If `output_type="gluonts"`: A `List[gluonts.model.forecast.Forecast]` of all forecasts.
|
|
120
|
+
"""
|
|
121
|
+
return common_doc
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class ForecastModel(ABC):
|
|
125
|
+
@abstractmethod
|
|
126
|
+
def _forecast_quantiles(self, batch, **predict_kwargs):
|
|
127
|
+
pass
|
|
128
|
+
|
|
129
|
+
def forecast(
|
|
130
|
+
self,
|
|
131
|
+
context: ContextType,
|
|
132
|
+
output_type: Literal["torch", "numpy", "gluonts"] = "torch",
|
|
133
|
+
batch_size: int = 512,
|
|
134
|
+
quantile_levels: list[float] = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
|
135
|
+
yield_per_batch: bool = False,
|
|
136
|
+
**predict_kwargs,
|
|
137
|
+
):
|
|
138
|
+
f"""
|
|
139
|
+
{_common_forecast_doc}
|
|
140
|
+
Args:
|
|
141
|
+
context (ContextType): The historical "context" data of the time series:
|
|
142
|
+
- `torch.Tensor`: 1D `[context_length]` or 2D `[batch_dim, context_length]` tensor
|
|
143
|
+
- `np.ndarray`: 1D `[context_length]` or 2D `[batch_dim, context_length]` array
|
|
144
|
+
- `List[torch.Tensor]`: List of 1D tensors (samples with different lengths get padded per batch)
|
|
145
|
+
- `List[np.ndarray]`: List of 1D arrays (samples with different lengths get padded per batch)
|
|
146
|
+
"""
|
|
147
|
+
assert batch_size >= 1, "Batch size must be >= 1"
|
|
148
|
+
batches = get_batches(context, batch_size)
|
|
149
|
+
return _gen_forecast(
|
|
150
|
+
self._forecast_quantiles, batches, output_type, quantile_levels, yield_per_batch, **predict_kwargs
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def forecast_gluon(
|
|
154
|
+
self,
|
|
155
|
+
gluonDataset,
|
|
156
|
+
output_type: Literal["torch", "numpy", "gluonts"] = "torch",
|
|
157
|
+
batch_size: int = 512,
|
|
158
|
+
quantile_levels: list[float] = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
|
159
|
+
yield_per_batch: bool = False,
|
|
160
|
+
data_kwargs: dict = {},
|
|
161
|
+
**predict_kwargs,
|
|
162
|
+
):
|
|
163
|
+
f"""
|
|
164
|
+
{_common_forecast_doc()}
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
gluonDataset (gluon_ts.dataset.common.Dataset): A GluonTS dataset object containing the
|
|
168
|
+
historical time series data.
|
|
169
|
+
|
|
170
|
+
data_kwargs (dict, optional): Additional keyword arguments passed to the
|
|
171
|
+
autogluon data processing function.
|
|
172
|
+
"""
|
|
173
|
+
assert batch_size >= 1, "Batch size must be >= 1"
|
|
174
|
+
if not _GLUONTS_AVAILABLE:
|
|
175
|
+
raise ValueError("forecast_gluon glutonts needs GluonTs but GluonTS is not available (not installed)!")
|
|
176
|
+
batches = get_gluon_batches(gluonDataset, batch_size, **data_kwargs)
|
|
177
|
+
return _gen_forecast(
|
|
178
|
+
self._forecast_quantiles, batches, output_type, quantile_levels, yield_per_batch, **predict_kwargs
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
def forecast_hfdata(
|
|
182
|
+
self,
|
|
183
|
+
hf_dataset,
|
|
184
|
+
output_type: Literal["torch", "numpy", "gluonts"] = "torch",
|
|
185
|
+
batch_size: int = 512,
|
|
186
|
+
quantile_levels: list[float] = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
|
187
|
+
yield_per_batch: bool = False,
|
|
188
|
+
data_kwargs: dict = {},
|
|
189
|
+
**predict_kwargs,
|
|
190
|
+
):
|
|
191
|
+
f"""
|
|
192
|
+
{_common_forecast_doc()}
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
hf_dataset (datasets.Dataset): A Hugging Face `Dataset` object containing the
|
|
196
|
+
historical time series data.
|
|
197
|
+
|
|
198
|
+
data_kwargs (dict, optional): Additional keyword arguments passed to the
|
|
199
|
+
datasets data processing function.
|
|
200
|
+
"""
|
|
201
|
+
assert batch_size >= 1, "Batch size must be >= 1"
|
|
202
|
+
if not _HF_DATASETS_AVAILABLE:
|
|
203
|
+
raise ValueError(
|
|
204
|
+
"forecast_hfdata glutonts needs HuggingFace datasets but datasets is not available (not installed)!"
|
|
205
|
+
)
|
|
206
|
+
batches = get_hfdata_batches(hf_dataset, batch_size, **data_kwargs)
|
|
207
|
+
return _gen_forecast(
|
|
208
|
+
self._forecast_quantiles, batches, output_type, quantile_levels, yield_per_batch, **predict_kwargs
|
|
209
|
+
)
|