foretoken 0.0.1a1__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.
- foretoken-0.0.1a1/LICENSE +201 -0
- foretoken-0.0.1a1/PKG-INFO +196 -0
- foretoken-0.0.1a1/README.md +168 -0
- foretoken-0.0.1a1/benchmarks/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/arguments.py +444 -0
- foretoken-0.0.1a1/benchmarks/client/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/client/openai_client.py +148 -0
- foretoken-0.0.1a1/benchmarks/config.py +358 -0
- foretoken-0.0.1a1/benchmarks/deployment/__init__.py +9 -0
- foretoken-0.0.1a1/benchmarks/deployment/discovery.py +166 -0
- foretoken-0.0.1a1/benchmarks/deployment/lifecycle.py +111 -0
- foretoken-0.0.1a1/benchmarks/logger/__init__.py +5 -0
- foretoken-0.0.1a1/benchmarks/logger/cli.py +27 -0
- foretoken-0.0.1a1/benchmarks/logger/wandb.py +261 -0
- foretoken-0.0.1a1/benchmarks/main.py +74 -0
- foretoken-0.0.1a1/benchmarks/metrics/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/metrics/aggregator.py +161 -0
- foretoken-0.0.1a1/benchmarks/report/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/report/pareto.py +145 -0
- foretoken-0.0.1a1/benchmarks/report/summary.py +156 -0
- foretoken-0.0.1a1/benchmarks/runner/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/runner/base.py +284 -0
- foretoken-0.0.1a1/benchmarks/runner/multi_dataset.py +105 -0
- foretoken-0.0.1a1/benchmarks/runner/run_benchmark.py +79 -0
- foretoken-0.0.1a1/benchmarks/runner/run_spec.py +22 -0
- foretoken-0.0.1a1/benchmarks/runner/select_runner.py +27 -0
- foretoken-0.0.1a1/benchmarks/runner/sweep.py +141 -0
- foretoken-0.0.1a1/benchmarks/runner/trace_runner.py +225 -0
- foretoken-0.0.1a1/benchmarks/storage/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/storage/result_writer.py +37 -0
- foretoken-0.0.1a1/benchmarks/utils/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/utils/bench_params.py +223 -0
- foretoken-0.0.1a1/benchmarks/workload/__init__.py +2 -0
- foretoken-0.0.1a1/benchmarks/workload/hf_dataset.py +154 -0
- foretoken-0.0.1a1/benchmarks/workload/loader.py +205 -0
- foretoken-0.0.1a1/benchmarks/workload/random_dataset.py +273 -0
- foretoken-0.0.1a1/benchmarks/workload/trace_loader.py +275 -0
- foretoken-0.0.1a1/benchmarks/workload/trace_workload.py +109 -0
- foretoken-0.0.1a1/cli/README.md +169 -0
- foretoken-0.0.1a1/cli/foretoken/__init__.py +26 -0
- foretoken-0.0.1a1/cli/foretoken/accelerators/__init__.py +4 -0
- foretoken-0.0.1a1/cli/foretoken/accelerators/_exporter.py +102 -0
- foretoken-0.0.1a1/cli/foretoken/accelerators/discovery.py +264 -0
- foretoken-0.0.1a1/cli/foretoken/accelerators/metax.py +61 -0
- foretoken-0.0.1a1/cli/foretoken/accelerators/nvidia.py +184 -0
- foretoken-0.0.1a1/cli/foretoken/arguments.py +297 -0
- foretoken-0.0.1a1/cli/foretoken/kubernetes.py +664 -0
- foretoken-0.0.1a1/cli/foretoken/main.py +188 -0
- foretoken-0.0.1a1/cli/foretoken/manifest.py +132 -0
- foretoken-0.0.1a1/cli/foretoken/observability.py +349 -0
- foretoken-0.0.1a1/cli/foretoken/platform/__init__.py +8 -0
- foretoken-0.0.1a1/cli/foretoken/platform/config.py +119 -0
- foretoken-0.0.1a1/cli/foretoken/platform/gateway.py +357 -0
- foretoken-0.0.1a1/cli/foretoken/platform/gateway_resources.py +192 -0
- foretoken-0.0.1a1/cli/foretoken/platform/helm.py +422 -0
- foretoken-0.0.1a1/cli/foretoken/platform/helm_client.py +216 -0
- foretoken-0.0.1a1/cli/foretoken/platform/lifecycle.py +345 -0
- foretoken-0.0.1a1/cli/foretoken/platform/types.py +33 -0
- foretoken-0.0.1a1/cli/foretoken/source.py +171 -0
- foretoken-0.0.1a1/foretoken.egg-info/PKG-INFO +196 -0
- foretoken-0.0.1a1/foretoken.egg-info/SOURCES.txt +65 -0
- foretoken-0.0.1a1/foretoken.egg-info/dependency_links.txt +1 -0
- foretoken-0.0.1a1/foretoken.egg-info/entry_points.txt +2 -0
- foretoken-0.0.1a1/foretoken.egg-info/requires.txt +18 -0
- foretoken-0.0.1a1/foretoken.egg-info/top_level.txt +2 -0
- foretoken-0.0.1a1/pyproject.toml +58 -0
- foretoken-0.0.1a1/setup.cfg +4 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: foretoken
|
|
3
|
+
Version: 0.0.1a1
|
|
4
|
+
Summary: Command-line tools for installing and operating Foretoken
|
|
5
|
+
Author: Foretoken contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: packaging>=24.0
|
|
11
|
+
Requires-Dist: PyYAML>=6.0
|
|
12
|
+
Provides-Extra: bench
|
|
13
|
+
Requires-Dist: datasets>=2.14; extra == "bench"
|
|
14
|
+
Requires-Dist: evalscope>=1.10; extra == "bench"
|
|
15
|
+
Requires-Dist: httpx>=0.27; extra == "bench"
|
|
16
|
+
Requires-Dist: huggingface_hub>=0.23; extra == "bench"
|
|
17
|
+
Requires-Dist: matplotlib>=3.7; extra == "bench"
|
|
18
|
+
Requires-Dist: numpy>=1.24; extra == "bench"
|
|
19
|
+
Requires-Dist: openai>=1.40; extra == "bench"
|
|
20
|
+
Requires-Dist: tqdm>=4.65; extra == "bench"
|
|
21
|
+
Requires-Dist: transformers>=4.40; extra == "bench"
|
|
22
|
+
Requires-Dist: vllm>=0.18; extra == "bench"
|
|
23
|
+
Requires-Dist: wandb>=0.16; extra == "bench"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<!--
|
|
29
|
+
SPDX-License-Identifier: Apache-2.0
|
|
30
|
+
SPDX-FileCopyrightText: Copyright contributors to the Foretoken project
|
|
31
|
+
-->
|
|
32
|
+
|
|
33
|
+
# Foretoken command-line tool
|
|
34
|
+
|
|
35
|
+
English | [简体中文](README_zh.md)
|
|
36
|
+
|
|
37
|
+
The Foretoken command-line tool installs the shared Kubernetes platform, deploys model services from Kustomize configurations, reports serving readiness, resolves frontend endpoints, and runs benchmarks through one `foretoken` entry point.
|
|
38
|
+
|
|
39
|
+
For a new cluster, start by installing the command-line tool. If `foretoken --version` already works, go straight to platform installation. If the cluster already has the Foretoken platform, start with model deployment.
|
|
40
|
+
|
|
41
|
+
## Before you start
|
|
42
|
+
|
|
43
|
+
You need Python 3.10 or later, an active Kubernetes context, `kubectl`, and Helm. GPU nodes must already have their vendor driver and Kubernetes device plugin. Source installation also requires Docker and Make, plus either a local kind/k3d cluster or an OCI registry reachable by every target node.
|
|
44
|
+
|
|
45
|
+
## Install the command-line tool
|
|
46
|
+
|
|
47
|
+
Install the published Foretoken command-line tool package with pip:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install foretoken
|
|
51
|
+
|
|
52
|
+
# For source installation from the repository:
|
|
53
|
+
# pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or create and activate a virtual environment with uv:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uv venv
|
|
60
|
+
source .venv/bin/activate
|
|
61
|
+
uv pip install foretoken
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This step only installs the `foretoken` command in the current Python environment; it does not change the Kubernetes cluster. Run `foretoken --version` to see the command-line tool and corresponding platform version.
|
|
65
|
+
|
|
66
|
+
## Install the Kubernetes platform
|
|
67
|
+
|
|
68
|
+
`foretoken install` installs the Foretoken CRDs and controller in the active Kubernetes context. Platform resources use the `foretoken-platform` namespace. The command also configures monitoring and, in Gateway mode, the Gateway resources. Deploy model services separately with `foretoken deploy`.
|
|
69
|
+
|
|
70
|
+
### Default installation
|
|
71
|
+
|
|
72
|
+
The default uses release images and local access through a `LoadBalancer` Service:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
foretoken install
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
During installation, the command-line tool discovers Prometheus and accelerator metric exporters. It reuses compatible shared instances, installs managed Prometheus and NVIDIA DCGM Exporter releases when needed, and connects to the mxExporter already provided by a MetaX cluster. It never installs GPU drivers, device plugins, or vendor operators. Ambiguous or incomplete monitoring stops installation with an actionable error; see [Observability](../observability/README.md) for the selection rules.
|
|
79
|
+
|
|
80
|
+
### Gateway mode
|
|
81
|
+
|
|
82
|
+
The command-line tool creates a dedicated `GatewayClass` and `Gateway` only when the cluster runs Envoy Gateway:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
foretoken install --frontend-mode gateway
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
With another Gateway Controller, reuse a Gateway managed by that controller:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
foretoken install \
|
|
92
|
+
--frontend-mode gateway \
|
|
93
|
+
--gateway-name inference-gateway \
|
|
94
|
+
--gateway-namespace gateway-system
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Add `--gateway-section-name LISTENER` only when more than one listener matches.
|
|
98
|
+
|
|
99
|
+
### Current source
|
|
100
|
+
|
|
101
|
+
Build Foretoken images from the current source tree and configure the platform to use them:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
foretoken install -e .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A standard active kind or k3d context imports the built images locally. Other Kubernetes contexts need a registry reachable by their nodes. Sign in to the registry host with an account that can push the target repository before installation:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
docker login ghcr.io
|
|
111
|
+
foretoken install -e . --registry ghcr.io/example/foretoken
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Registry login authorizes the local image push. Private registries also need `imagePullSecrets` and `workload.imagePullSecrets` through `--values` so nodes can pull the images; see [Deploy Foretoken from Source](../docs/custom-deployment.md).
|
|
115
|
+
|
|
116
|
+
### Installation options
|
|
117
|
+
|
|
118
|
+
Repeatable `--values` files provide platform image, runtime, and hardware settings. Release and source installs record their mode in Helm metadata and cannot switch silently. Releases originally installed directly with Helm remain under their existing Helm lifecycle and are not adopted automatically.
|
|
119
|
+
|
|
120
|
+
## Deploy and operate model services
|
|
121
|
+
|
|
122
|
+
Deploy one frontend and all models rendered by a Kustomize root:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
foretoken deploy examples/multi-model-quickstart
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The command applies the configuration, reports each `FrontendService` and `ModelService` state when it changes, and exits when every resource is Ready for its current generation. Change the default ten-minute deadline with `--timeout`.
|
|
129
|
+
|
|
130
|
+
Delete the resources rendered by the same configuration:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
foretoken delete examples/multi-model-quickstart
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The command waits for deletion and ignores resources that are already absent. After deleting all Foretoken services, remove the platform release:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
foretoken uninstall
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The command preserves Foretoken CRDs and refuses to uninstall while user-owned services remain. It removes monitoring and Gateway resources managed by the command-line tool with the platform, while reused cluster components remain unchanged.
|
|
143
|
+
|
|
144
|
+
Inspect the same deployment without applying it:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
foretoken status examples/multi-model-quickstart
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Inspect every Foretoken service in a namespace, or continue watching state changes:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
foretoken status -n foretoken-multi-model-demo
|
|
154
|
+
foretoken status -n foretoken-multi-model-demo --watch
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Resolve the public frontend URL after deployment:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
FORETOKEN_FRONTEND_URL="$(foretoken endpoint examples/multi-model-quickstart)"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
For an HTTP Gateway, resolve its request `Host` separately:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
FORETOKEN_FRONTEND_URL="$(foretoken endpoint examples/quickstart)"
|
|
167
|
+
FORETOKEN_REQUEST_HOST="$(foretoken endpoint examples/quickstart --host)"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The host value is the URL authority for direct access or the configured routing hostname for an HTTP Gateway. The command waits for the LoadBalancer or Gateway address, but serving readiness remains owned by `foretoken deploy`.
|
|
171
|
+
|
|
172
|
+
## Run benchmarks
|
|
173
|
+
|
|
174
|
+
Install the optional benchmark dependencies with pip:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
pip install 'foretoken[bench]'
|
|
178
|
+
|
|
179
|
+
# For source installation from the repository:
|
|
180
|
+
# pip install -e .
|
|
181
|
+
# pip install -e '.[bench]'
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Or install the benchmark dependencies in the activated uv environment:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
uv pip install 'foretoken[bench]'
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Then run the benchmark:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
foretoken bench examples/quickstart
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The command-line tool uses the active `kubectl` context and honors standard Kubernetes configuration such as `KUBECONFIG`.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Foretoken
|
|
2
|
+
|
|
3
|
+
English | [简体中文](README_zh.md)
|
|
4
|
+
|
|
5
|
+
Foretoken is a generative inference orchestration framework built for SLO/SLA targets and heterogeneous accelerators.
|
|
6
|
+
|
|
7
|
+
Built on inference engines such as vLLM and SGLang, Foretoken organizes multiple generation instances into a cluster service for request routing, autoscaling, instance management, and benchmarking.
|
|
8
|
+
We aim to turn an inference cluster into a token factory that continuously converts compute into tokens while meeting latency and quality requirements.
|
|
9
|
+
|
|
10
|
+
## When to Use Foretoken
|
|
11
|
+
|
|
12
|
+
- Serve one or more models across multiple GPUs or nodes.
|
|
13
|
+
- Route requests based on load, queue depth, or KV cache state.
|
|
14
|
+
- Autoscale inference instances based on traffic and SLO targets.
|
|
15
|
+
- Compare aggregated serving, Prefill/Decode disaggregation, and different parallelism strategies.
|
|
16
|
+
- Use the same orchestration stack across NVIDIA and MetaX accelerators.
|
|
17
|
+
|
|
18
|
+
If you only need to serve a single model on one GPU, using an inference engine such as vLLM directly is usually enough.
|
|
19
|
+
|
|
20
|
+
## Features and Status
|
|
21
|
+
|
|
22
|
+
| Feature | Description | Status |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| Benchmarking | Performance benchmarks and parameter sweeps, correctness evaluation, and SLO simulation | In development |
|
|
25
|
+
| Profiling | Use PyTorch Profiler and Nsight to identify compute, communication, and CPU/GPU bottlenecks | Planned |
|
|
26
|
+
| Hardware support | Common interfaces for device capabilities, runtimes, communication, and metrics | In development |
|
|
27
|
+
| Request routing | Select instances based on load, queues, KV reuse, and service levels | Research |
|
|
28
|
+
| Distributed inference | Aggregated serving, Prefill/Decode disaggregation, and WideEP parallelism | Research |
|
|
29
|
+
| Control plane | Model services, instance groups, autoscaling, updates, and failure recovery | In development |
|
|
30
|
+
| [Observability](observability/README.md) | Collect runtime metrics, evaluate alerts, and profile CPU/GPU bottlenecks | In development |
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
This Quick Start requires Python 3.10 or later, a Kubernetes cluster, `kubectl`, Helm, and at least one available GPU. See the [k3d guide](docs/k3d-deployment.md) to prepare a single-machine test cluster.
|
|
35
|
+
|
|
36
|
+
### 1. Install the command-line tool
|
|
37
|
+
|
|
38
|
+
Install the published command-line tool package:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install foretoken
|
|
42
|
+
|
|
43
|
+
# For source installation from the repository:
|
|
44
|
+
# pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Install the Kubernetes platform
|
|
48
|
+
|
|
49
|
+
By default, installation uses the Foretoken images published on GHCR:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Release images:
|
|
53
|
+
foretoken install
|
|
54
|
+
|
|
55
|
+
# Source installation from the repository:
|
|
56
|
+
# foretoken install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This installs the Foretoken CRDs and controller in the `foretoken-platform` namespace and waits for the controller to become ready. The default mode exposes the frontend through a `LoadBalancer` Service. Source installation rebuilds the images and updates the cluster; to deploy the current source to a remote cluster, see the [source deployment guide](docs/custom-deployment.md).
|
|
60
|
+
|
|
61
|
+
### 3. Deploy the Quick Start
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
foretoken deploy examples/quickstart
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This example deploys one frontend service and one `Qwen/Qwen3-0.6B` model replica. The workload requests one GPU, 8 CPU, and 52 GiB memory; allow additional capacity for the platform. See the [single-model example](examples/quickstart/README.md) for its resource configuration and [`examples/`](examples/) for more deployments.
|
|
68
|
+
|
|
69
|
+
### 4. Send a test request
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
FORETOKEN_FRONTEND_URL="$(foretoken endpoint examples/quickstart)"
|
|
73
|
+
|
|
74
|
+
curl --fail-with-body --no-buffer \
|
|
75
|
+
"$FORETOKEN_FRONTEND_URL/v1/chat/completions" \
|
|
76
|
+
-H "Content-Type: application/json" \
|
|
77
|
+
-d '{"model":"Qwen/Qwen3-0.6B","messages":[{"role":"user","content":"Hello"}],"stream":true}'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 5. Run a benchmark
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install 'foretoken[bench]'
|
|
84
|
+
|
|
85
|
+
# For source installation from the repository:
|
|
86
|
+
# pip install -e .
|
|
87
|
+
# pip install -e '.[bench]'
|
|
88
|
+
foretoken bench examples/quickstart
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
See [Benchmarking](benchmarks/README.md) for datasets, remote endpoints, result storage, and parameter sweeps.
|
|
92
|
+
|
|
93
|
+
## Gateway Mode
|
|
94
|
+
|
|
95
|
+
Gateway mode provides a shared entry point through Kubernetes Gateway and a hostname. It suits clusters that already use Gateway or manage external traffic centrally.
|
|
96
|
+
|
|
97
|
+
Foretoken creates its default Gateway for Envoy Gateway. Install Envoy Gateway, then add the public hostname under `spec` in `examples/quickstart/frontend.yaml`:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
spec:
|
|
101
|
+
hostname: foretoken.example.com
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Then run:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Install Envoy Gateway
|
|
108
|
+
helm upgrade --install envoy-gateway \
|
|
109
|
+
oci://docker.io/envoyproxy/gateway-helm \
|
|
110
|
+
--namespace envoy-gateway-system \
|
|
111
|
+
--create-namespace \
|
|
112
|
+
--wait
|
|
113
|
+
|
|
114
|
+
# Install the platform in Gateway mode
|
|
115
|
+
foretoken install --frontend-mode gateway
|
|
116
|
+
|
|
117
|
+
# Deploy the Quick Start
|
|
118
|
+
foretoken deploy examples/quickstart
|
|
119
|
+
|
|
120
|
+
# Resolve the Gateway address and request hostname
|
|
121
|
+
FORETOKEN_FRONTEND_URL="$(foretoken endpoint examples/quickstart)"
|
|
122
|
+
FORETOKEN_REQUEST_HOST="$(foretoken endpoint examples/quickstart --host)"
|
|
123
|
+
|
|
124
|
+
# Send a test request
|
|
125
|
+
curl --fail-with-body --no-buffer \
|
|
126
|
+
"$FORETOKEN_FRONTEND_URL/v1/chat/completions" \
|
|
127
|
+
-H "Host: $FORETOKEN_REQUEST_HOST" \
|
|
128
|
+
-H "Content-Type: application/json" \
|
|
129
|
+
-d '{"model":"Qwen/Qwen3-0.6B","messages":[{"role":"user","content":"Hello"}],"stream":true}'
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
See the [command-line tool guide](cli/README.md) to reuse a Gateway from another controller, select a listener, or configure TLS.
|
|
133
|
+
|
|
134
|
+
## Stop and Uninstall
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Delete the frontend and model service deployed by the Quick Start
|
|
138
|
+
foretoken delete examples/quickstart
|
|
139
|
+
|
|
140
|
+
# Uninstall the Foretoken platform
|
|
141
|
+
foretoken uninstall
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The uninstall command preserves Foretoken CRDs and reused cluster components. It removes the platform and the monitoring or Gateway resources managed by the command-line tool.
|
|
145
|
+
|
|
146
|
+
## Related Projects
|
|
147
|
+
|
|
148
|
+
- [vLLM](https://github.com/vllm-project/vllm)
|
|
149
|
+
- [NVIDIA Dynamo](https://github.com/ai-dynamo/dynamo)
|
|
150
|
+
- [llm-d](https://github.com/llm-d/llm-d)
|
|
151
|
+
- [AIBrix](https://github.com/vllm-project/aibrix)
|
|
152
|
+
- [vLLM Production Stack](https://github.com/vllm-project/production-stack)
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Contributions of all kinds are welcome, including code, documentation, tests, design discussions, issue reports, and improvements to deployment, hardware, benchmarking, routing, and autoscaling.
|
|
157
|
+
Performance-related changes should include the test setup, raw results, and reproducible commands.
|
|
158
|
+
See [Contributing to Foretoken](CONTRIBUTING.md) for development principles, collaboration expectations, and the pull request workflow.
|
|
159
|
+
|
|
160
|
+
Thank you to everyone who has contributed to Foretoken.
|
|
161
|
+
|
|
162
|
+
<a href="https://github.com/shiweijiezero/foretoken/graphs/contributors">
|
|
163
|
+
<img src="https://contrib.rocks/image?repo=shiweijiezero/foretoken" alt="Foretoken contributors" />
|
|
164
|
+
</a>
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
This project is licensed under the [Apache License 2.0](LICENSE).
|