-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrspress.config.ts
324 lines (311 loc) · 8.51 KB
/
rspress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import path from 'path';
import { defineConfig } from 'rspress/config';
import { NavItem, Sidebar } from '@rspress/shared';
import { pluginShiki } from '@rspress/plugin-shiki';
import { pluginRss, PluginRssOption } from './rspress/plugin-rss';
import { toArray } from './rspress/plugin-rss/utils';
const PUBLISH_URL = 'https://volcengine.github.io/veScaleWeb';
const COPYRIGHT = '© 2023 Bytedance Inc. All Rights Reserved.';
function getMeta(name: string, value: string) {
return {
[name]: {
property: name,
content: value,
},
};
}
function getI18nHelper(lang: 'zh' | 'en') {
const isZh = lang === 'zh';
const prefix = isZh ? '/zh' : '';
const getLink = (str: string) => `${prefix}${str}`;
const getText = (zhText: string, enText: string) => (isZh ? zhText : enText);
return { getText, getLink };
}
function getNavConfig(lang: 'zh' | 'en'): NavItem[] {
const { getText, getLink } = getI18nHelper(lang);
return [
{
text: getText('指南', 'Guide'),
link: getLink('/guide/introduction'),
activeMatch: '/guide/',
},
{
text: getText('文章', 'Publication'),
link: getLink('/blog/mlsys2024'),
activeMatch: '/blog',
},
{
text: getText('关于', 'About'),
items: [
{
text: getText('我们', 'Who Are We'),
link: getLink('/misc/who-are-we'),
},
{
text: getText('加入我们', 'Join Us'),
link: getLink('/misc/join-us'),
},
{
text: getText('贡献指南', 'Contributing Guide'),
link: 'https://github.com/volcengine/veScale/blob/main/CONTRIBUTING.md',
},
],
},
];
}
function getSidebarConfig(lang: 'zh' | 'en'): Sidebar {
const { getText, getLink } = getI18nHelper(lang);
return {
[getLink('/guide/')]: [
{
collapsible: false,
text: getText('开始', 'Getting started'),
items: [
{
link: getLink('/guide/introduction'),
text: getText('介绍', 'Introduction'),
},
{
link: getLink('/guide/quick-start'),
text: getText('快速开始', 'Quick Start'),
},
],
},
{
collapsible: false,
text: getText('DTensor', 'DTensor'),
items: [
{
link: getLink('/guide/dtensor'),
text: getText('概览', 'Overview'),
},
],
},
{
collapsible: false,
text: getText('Parallel', 'Parallel'),
items: [
{
link: getLink('/guide/parallel_overview'),
text: getText('概览', 'Overview'),
},
{
link: getLink('/guide/dmodule'),
text: getText('Tensor Parallel & Sequence Parallel', 'Tensor Parallel & Sequence Parallel'),
},
{
link: getLink('/guide/ddp'),
text: getText('Data Parallel', 'Data Parallel'),
},
{
link: getLink('/guide/doptimizer'),
text: getText('Optimizer Parallel', 'Optimizer Parallel'),
},
{
link: getLink('/guide/pp'),
text: getText('Pipeline Parallel', 'Pipeline Parallel'),
},
{
link: getLink('/guide/vedevicemesh'),
text: getText('nD Device Mesh', 'nD Device Mesh'),
},
],
},
{
collapsible: false,
text: getText('Plan', 'Plan'),
items: [
{
link: getLink('/guide/auto_tp_sp'),
text: getText('Auto TP & SP Plan', 'Auto TP & SP Plan'),
},
{
link: getLink('/guide/auto_pp'),
text: getText('Auto PP Plan', 'Auto PP Plan'),
},
],
},
{
collapsible: false,
text: getText('Checkpoint', 'Checkpoint'),
items: [
{
link: getLink('/guide/checkpoint'),
text: getText('概览', 'Overview'),
},
],
},
],
[getLink('/blog/')]: [
{
text: getText(
'MLSys2024',
'MLSys2024'
),
link: getLink('/blog/mlsys2024'),
},
{
text: getText(
'MegaScale',
'MegaScale'
),
link: getLink('/blog/megascale'),
},
],
};
}
const toFeedItem: PluginRssOption['toFeedItem'] = (page) => {
const fm = page.frontmatter as Record<string, any>;
const { date } = fm;
if (!date) return false;
const categories = toArray(fm['categories'], fm['category']);
const isBlog = /blog/.test(page.routePath) || categories.includes('blog');
// we only include the blogs at the moment
if (!isBlog) return false;
const feed = `blog-${page.lang}`;
return {
title: fm.title || page.title || '',
id: fm.rssId || page.id || '',
link: fm.permalink || page.routePath || '',
description: fm.rssDescription || fm.description || '',
content: fm.rssContent || fm.summary || page.content || '',
date,
category: categories,
feed,
};
};
export default defineConfig({
base: '/veScaleWeb/',
root: path.join(__dirname, 'docs'),
title: 'veScale',
description: 'A PyTorch Native LLM Training Framework',
logo: {
light: '/vescale-logo-light.png',
dark: '/vescale-logo-dark.png',
},
icon: '/icon.png',
lang: 'en',
globalStyles: path.join(__dirname, 'theme', 'index.css'),
markdown: {
checkDeadLinks: true,
},
plugins: [
pluginShiki(),
pluginRss({
routePublicPath: PUBLISH_URL,
feedOptions: { copyright: COPYRIGHT, link: PUBLISH_URL },
feedOptionsByName: {
'blog-en': { title: 'veScale Publication', link: `${PUBLISH_URL}/blog` },
'blog-zh': { title: 'veScale Publication', link: `${PUBLISH_URL}/zh/blog` },
},
toFeedItem,
}),
],
themeConfig: {
footer: {
message: '© 2024 Bytedance Inc. All Rights Reserved.',
},
socialLinks: [
{
icon: 'github',
mode: 'link',
content: 'https://github.com/volcengine/veScale',
},
{
icon: 'twitter',
mode: 'link',
content: 'https://twitter.com/veScaleAI',
},
{
icon: 'lark',
mode: 'link',
content:
'https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=8a9m7db8-5ee9-4561-b3d8-dbf93149ab2v',
},
{
icon: 'slack',
mode: 'link',
content:
'https://join.slack.com/t/vescale/shared_invite/zt-2gw87xkkg-_oLPkBKzLU1BOtH~6oHsYg',
},
],
locales: [
{
lang: 'en',
title: 'veScale',
description: 'A PyTorch Native LLM Training Framework',
nav: getNavConfig('en'),
sidebar: getSidebarConfig('en'),
label: 'English',
},
{ // TODO: enable chinese webpage
lang: 'en',
title: 'veScale',
description: 'A PyTorch Native LLM Training Framework',
nav: getNavConfig('en'),
sidebar: getSidebarConfig('en'),
label: '简体中文',
},
],
},
builderConfig: {
source: {
alias: {
'@builtIns': path.join(__dirname, 'components', 'builtIns'),
'@components': path.join(__dirname, 'components'),
'@hooks': path.join(__dirname, 'hooks'),
},
},
dev: {
startUrl: false,
},
tools: {
postcss: (config, { addPlugins }) => {
addPlugins([require('tailwindcss/nesting'), require('tailwindcss')]);
},
},
html: {
meta: {
...getMeta('og:title', 'veScale'),
...getMeta('og:type', 'website'),
...getMeta('og:url', PUBLISH_URL),
...getMeta(
'og:description',
'A PyTorch Native LLM Training Framework'
),
...getMeta('twitter:site', '@vescale'),
...getMeta('twitter:card', 'summary_large_image'),
},
tags: [
// Configure Google Analytics
{
tag: 'script',
attrs: {
async: true,
src: 'https://www.googletagmanager.com/gtag/js?id=G-XKKCNZZNJD',
},
},
{
tag: 'script',
children: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XKKCNZZNJD');`,
},
],
},
output: {
copy: {
patterns: [
{
from: path.join(__dirname, 'docs', 'public', '_redirects'),
},
{
from: path.join(__dirname, 'docs', 'public', '_headers'),
},
],
},
},
},
});