Skip to content

Commit f8efb99

Browse files
authored
Merge pull request #190 from InvolutionHell/test/remark
fix: add remark funmadocs
2 parents 3615267 + f8b991c commit f8efb99

File tree

4 files changed

+213
-10
lines changed

4 files changed

+213
-10
lines changed

.idea/workspace.xml

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/docs/ai/MoE/moe-update.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Theory of MoE
2+
title: "Theory of MoE"
33
description: ""
44
date: "2025-10-05"
55
tags:
@@ -16,17 +16,21 @@ docId: db3qwg25h6l0bh8f2sdabdqc
1616
给定正的常数 $c_1, c_2$,我们定义:
1717

1818
- $x = \Omega(y)$,如果 $x > c_2 |y|$;
19-
- $x = \Theta(y)$,如果 $c_1 |y| < x < c_2 |y|$;
20-
- $x = O(y)$,如果 $x < c_1 |y|$;
21-
- $x = o(y)$,如果 $\frac{x}{y} \to 0$。
22-
- O(y):上界,表示“不会比 y 增长得更快”。
23-
- Ω(y):下界,表示“至少和 y 一样快”。
24-
- Θ(y):上下界都在 y 的数量级内,表示“和 y 同阶”。
25-
- o(y):严格比 y 小得多,最终会趋近于 0。
19+
- $x = \Theta(y)$,如果 $c_1 |y| \lt x \lt c_2 |y|$;
20+
- $x = O(y)$,如果 $x \lt c_1 |y|$;
21+
- $x = o(y)$,如果 $\dfrac{x}{y} \to 0$。
22+
23+
其中:
24+
25+
- $O(y)$:上界,表示“不会比 $y$ 增长得更快”。
26+
- $\Omega(y)$:下界,表示“至少和 $y$ 一样快”。
27+
- $\Theta(y)$:上下界都在 $y$ 的数量级内,表示“和 $y$ 同阶”。
28+
- $o(y)$:严格比 $y$ 小得多,最终会趋近于 $0$。
2629

2730
## **重要假设**
2831

29-
1. 这个文章只想给出闭式遗忘公式,所以直接简化成线性模型。$f(X)=X^⊤w,w∈R^d$
32+
1. 这个文章只想给出闭式遗忘公式,所以直接简化成线性模型。$f(X)=X^{\top}w,\; w\in \mathbb{R}^d$
33+
3034
2. 这个文章只讨论task-wised的路由方法,数据生成的时候每份数据只加入了一个信号数据,其余都是正态分布噪声。目的也是为了简化模型,然后在实际工程应用中,token会被隐式的送到各个experts,而不采用人为设定的方式。
3135

3236
> ### 数据集生成规则

mdx-components.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,50 @@
1+
import Image from "next/image";
2+
import type { ImageProps } from "next/image";
13
import defaultMdxComponents from "fumadocs-ui/mdx";
24
import type { MDXComponents } from "mdx/types";
5+
import type { ComponentPropsWithoutRef } from "react";
6+
7+
type MdxImageProps = ComponentPropsWithoutRef<"img"> & {
8+
src?: ImageProps["src"];
9+
width?: number | string;
10+
height?: number | string;
11+
};
12+
13+
function MdxImage({ src, alt = "", width, height, ...rest }: MdxImageProps) {
14+
if (!src) {
15+
return (
16+
<img
17+
src={src as string}
18+
alt={alt}
19+
width={width}
20+
height={height}
21+
{...rest}
22+
/>
23+
);
24+
}
25+
const numericWidth = typeof width === "string" ? Number(width) : width;
26+
const numericHeight = typeof height === "string" ? Number(height) : height;
27+
28+
if (!Number.isFinite(numericWidth) || !Number.isFinite(numericHeight)) {
29+
// fallback: 当 width/height 不是可解析数值时,直接使用原生 <img>
30+
return <img src={src ?? ""} alt={alt ?? ""} {...rest} />;
31+
}
32+
33+
return (
34+
<Image
35+
src={src ?? ""}
36+
alt={alt ?? ""}
37+
width={numericWidth}
38+
height={numericHeight}
39+
{...rest}
40+
/>
41+
);
42+
}
343

444
export function getMDXComponents(components?: MDXComponents): MDXComponents {
545
return {
646
...defaultMdxComponents,
47+
img: MdxImage,
748
...components,
849
};
950
}

next.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// next.config.mjs
22
import { createMDX } from "fumadocs-mdx/next";
33
import createNextIntlPlugin from "next-intl/plugin";
4+
import { remarkImage } from "fumadocs-core/mdx-plugins";
45

56
const withMDX = createMDX({
67
configPath: "source.config.ts",
8+
mdxOptions: {
9+
remarkPlugins: [[remarkImage, { onError: "ignore", external: true }]],
10+
},
711
});
8-
912
const withNextIntl = createNextIntlPlugin("./i18n.ts");
1013

1114
/** @type {import('next').NextConfig} */

0 commit comments

Comments
 (0)