Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language: Translate pages to Chinese #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/Attention.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@

<div class={classNames('attention', className, { expanded: isAttentionExpanded })}>
<div class="title" on:mouseenter={handleMouseEnter} on:mouseleave={handleMouseLeave} role="group">
<div>Multi-head Self Attention</div>
<div>多头自注意力</div>
</div>
<div class="content relative">
<div class="bounding transformer-bounding" class:active={$isBoundingBoxActive}>
<div class="bounding-title">Transformer Block 1</div>
<div class="bounding-title">Transformer 1</div>
</div>
<div
class="bounding attention-bounding"
Expand Down Expand Up @@ -158,7 +158,7 @@
</div>
<div class="head-out mx-[2rem]">
<div class="column out">
<div class="title">Out</div>
<div class="title">输出</div>
{#each $tokens as token, index}
<div class="head1 cell x1-12" class:last={index === $tokens.length - 1}>
<div class={`vector x1-12 ${outputVectorColor}`}></div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/AttentionMatrix.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
shape={'circle'}
colorScale={qkColorScale}
/>
<div class="matrix-label">Dot product</div>
<div class="matrix-label">点积</div>
<Tooltip class="popover tooltip">
<Katex math={'Q \\cdot K^T'}></Katex>
</Tooltip>
Expand Down Expand Up @@ -333,7 +333,7 @@
colorScale={maskedColorScale}
/>
</div>
<div class="matrix-label">Scaling · Mask</div>
<div class="matrix-label">缩放 · 掩码</div>
<Tooltip class="popover tooltip">
<Katex math={'\\frac{QK^T}{\\sqrt{d_k}} + M'}></Katex>
</Tooltip>
Expand Down Expand Up @@ -393,7 +393,7 @@
/>
</div>

<div class="matrix-label">Softmax · Dropout</div>
<div class="matrix-label">归一化指数函数 · 暂退</div>
<Tooltip class="popover tooltip">
<Katex math={'\\text{Dropout}(\\text{softmax}(\\frac{QK^T}{\\sqrt{d_k}} + M))'}></Katex>
</Tooltip>
Expand Down Expand Up @@ -423,7 +423,7 @@
colorScale={softmaxColorScale}
/>

<div class="matrix-label">Attention</div>
<div class="matrix-label">注意力</div>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Embedding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
on:mouseenter={handleMouseEnter}
on:mouseleave={handleMouseLeave}
>
<div>Embedding</div>
<div>嵌入</div>
</div>
<div class="content relative">
<div class="token-column resizable resize-watch flex">
Expand All @@ -142,10 +142,10 @@
<!-- token id and embedding -->
<div class="column token-embedding embedding-detail">
<div class="subtitle flex items-center gap-1">
<span>Token<br />Embedding</span><HelpPopover
<span>Token 嵌入</span><HelpPopover
id="token-embedding"
goTo="article-token-embedding"
>{`Converts tokens into \nsemantically meaningful \nnumerical representations.`}</HelpPopover
>{`将 Token 转换为具有语义意义的数字表示`}</HelpPopover
>
</div>
{#each $tokens as token, index}
Expand Down Expand Up @@ -205,10 +205,10 @@
</div>
<div class="column embedding-detail position-embedding">
<div class="subtitle flex gap-1">
<span>Positional<br />Encoding</span><HelpPopover
<span>位置编码</span><HelpPopover
id="position-embedding"
goTo="article-positional-embedding"
>{`Encodes positional \ninformation of tokens into \nnumerical representations.`}</HelpPopover
>{`将标记的位置信息编码为数字表示`}</HelpPopover
>
</div>
{#each $tokens as token, index}
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelpPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<slot />
{#if goTo}
<div class="more-btn mt-1 text-blue-600 hover:underline" on:click={scrollToDiv}>
Read more
阅读更多
</div>
{/if}
</div></Popover
Expand Down
8 changes: 4 additions & 4 deletions src/components/InputForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
class:selectDisabled
class="select-button inline-flex shrink-0 items-center justify-center border border-s-0 border-gray-200 bg-white px-3 py-2 text-center text-xs font-medium text-gray-900 first:rounded-s-lg first:border-s last:rounded-e-lg"
>
Examples<ChevronDownOutline class="pointer-events-none h-4 w-4 text-gray-500" />
示例<ChevronDownOutline class="pointer-events-none h-4 w-4 text-gray-500" />
</button>
<Dropdown placement="bottom-start" bind:open={dropdownOpen} class="example-dropdown">
{#each inputTextExample as text, index}
Expand Down Expand Up @@ -185,10 +185,10 @@
{/if}
{#if $isLoaded && $isFetchingModel}
<span class="helper-text"
>Try the examples while GPT-2 model is being downloaded (600MB)</span
>T在下载 GPT-2 模型时尝试示例(600MB</span
>
{:else if exceedLimit}
<span class="helper-text">You can enter up to {wordLimit} words.</span>
<span class="helper-text">你最多输入 {wordLimit} 个词</span>
{/if}
</div>
</ButtonGroup>
Expand All @@ -201,7 +201,7 @@
type="submit"
on:click={handleSubmit}
>
Generate
生成
</button>
</form>
<Temperature disabled={isLoading} />
Expand Down
8 changes: 4 additions & 4 deletions src/components/LinearSoftmax.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
on:mouseenter={handleMouseEnter}
on:mouseleave={handleMouseLeave}
>
<div>Probabilities</div>
<div>概率</div>
</div>
<div
class="content resize-watch relative"
Expand Down Expand Up @@ -188,14 +188,14 @@
<div class="title-box logits">
<div class="title-text">Logits</div>
<Tooltip class="popover tooltip text-xs"
><Katex math={'\\text{logits} = \\text{hidden state} \\times \\text{LM Head Weights}'}
><Katex math={'\\text{logits} = \\text{隐藏状态} \\times \\text{LM 头权重}'}
></Katex></Tooltip
>
</div>
<div class="title-box exponents">
<div class="title-text">Exponents</div>
<div class="title-text">指数</div>
<Tooltip class="popover tooltip"
><Katex math={'e^{logit_i / temperature}'}></Katex></Tooltip
><Katex math={'e^{logit_i / 温度}'}></Katex></Tooltip
>
</div>
<div class="title-box probability">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Mlp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<div class={classNames('mlp', className)}>
<div class="title" on:mouseenter={handleMouseEnter} on:mouseleave={handleMouseLeave} role="group">
MLP
多层感知器 MLP
</div>
<div class="content relative">
<div class="bounding transformer-bounding" class:active={$isBoundingBoxActive}></div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Operation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
<path
d="M27.3536 4.35355C27.5488 4.15829 27.5488 3.84171 27.3536 3.64645L24.1716 0.46447C23.9763 0.269208 23.6597 0.269208 23.4645 0.464471C23.2692 0.659733 23.2692 0.976316 23.4645 1.17158L26.2929 4L23.4645 6.82843C23.2692 7.02369 23.2692 7.34028 23.4645 7.53554C23.6597 7.7308 23.9763 7.7308 24.1716 7.53554L27.3536 4.35355ZM27 3.5C20.3125 3.50001 15.2969 6.63952 11.5638 11.7944C7.84616 16.9278 5.39057 24.0677 3.75991 32.1346C0.498061 48.2711 0.5 68.3247 0.5 84H1.5C1.5 68.2984 1.50194 48.352 4.74009 32.3328C6.35943 24.3218 8.77884 17.3448 12.3737 12.3809C15.9531 7.4384 20.6875 4.50001 27 4.5V3.5Z"
/>
<text x="4" y="95" text-anchor="middle">Layer Normalization</text>
<text x="4" y="95" text-anchor="middle">层归一化</text>
</svg>{/if}
</div>
{:else if type === 'residual-start'}
<div class={classNames(`residual residual-start cell`, className)} class:active>
<div class="cursor"></div>
<svg class="main">
{#if head}<path {id} class="head" d="M0,0 Q0,-16 30,-16"></path>
<text x="30" y="-26" dy="4" dx="4">Residual</text>{/if}
<text x="30" y="-26" dy="4" dx="4">残差</text>{/if}
<path d={`M0,0 L0,${$vectorHeight}`}></path>
</svg>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Popovers/ActivationPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

<CommonPopover
className="activation-popover"
title="GeLu Activation"
title="GeLu 激活"
{offset}
{triggeredBy}
{trigger}
{placement}
goTo="article-activation"
>
<div class="activation-content">
Applies activation function to neuron outputs.
将激活函数应用于神经元输出。
</div></CommonPopover
>

Expand Down
2 changes: 1 addition & 1 deletion src/components/Popovers/CommonPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<slot></slot>
{#if goTo}
<div class="more-btn mt-1 text-blue-600 hover:underline" on:click={scrollToDiv}>
Read more
阅读更多
</div>
{/if}
</div></Popover
Expand Down
4 changes: 2 additions & 2 deletions src/components/Popovers/DropoutPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

<CommonPopover
className="dropout-popover"
title="Dropout"
title="Dropout 暂退法"
{offset}
{triggeredBy}
{trigger}
{placement}
goTo="article-dropout"
>
<div class="dropout-content">Disables randomly selected neurons.</div></CommonPopover
<div class="dropout-content">禁用随机选择的神经元</div></CommonPopover
>
4 changes: 2 additions & 2 deletions src/components/Popovers/LayerNormPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

<CommonPopover
className="ln-popover"
title="Layer Normalization"
title="层归一化"
{offset}
{triggeredBy}
{trigger}
{placement}
goTo="article-ln"
>
<div class="ln-content w-[10rem]">
Standardizes layer inputs to maintain consistent mean and variance.
标准化层输入以保持一致的平均值和方差
</div></CommonPopover
>
6 changes: 3 additions & 3 deletions src/components/Popovers/MLPWeightPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
</div>
</div>
<div class="matrix flex flex-col items-center">
<div class="title self-end">Token Embedding</div>
<div class="title self-end">Token 嵌入</div>
<!-- (tokenLen, 768) -->
<Matrix
className="token-embedding"
Expand All @@ -298,7 +298,7 @@
</div>
<div class="operator"><div class="symbol">&times;</div></div>
<div class="matrix flex flex-col items-center">
<div class="title">Q·K·V Weights</div>
<div class="title">Q·K·V 权重</div>
<!-- (768,2034) -->
<div class="flex gap-0">
<Matrix
Expand All @@ -317,7 +317,7 @@
</div>
<div class="operator"><div class="symbol">+</div></div>
<div class="matrix flex flex-col items-center">
<div class="title">bias</div>
<div class="title">偏置</div>
<!-- (768) -->
<Matrix
className="qkv-bias"
Expand Down
6 changes: 3 additions & 3 deletions src/components/Popovers/PositionalEncodingPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</div>
</div>
<div class="positions">
<div class="subtitle">Position</div>
<div class="subtitle">位置</div>
<div class="subcontent flex flex-col">
{#each $tokens as token, token_idx}
<div
Expand All @@ -105,7 +105,7 @@
</div>
</div>
<div class="embs">
<div class="subtitle">Embedding</div>
<div class="subtitle">嵌入</div>
<div class="subcontent flex flex-col">
{#each $tokens as token, token_idx}
<div
Expand All @@ -132,7 +132,7 @@
</div>
</div>
<div class="viz-container">
<div class="subtitle">Encoding Matrix</div>
<div class="subtitle">编码矩阵</div>
<div class="subcontent viz-subcontent">
<div class="chart-container mx-auto">
<div class="embed-dim-axis">
Expand Down
8 changes: 4 additions & 4 deletions src/components/Popovers/QKVWeightPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
<div
class="weight-popover-title rounded-t-md border-b border-gray-200 bg-gray-100 px-3 py-2 dark:border-gray-600 dark:bg-gray-700"
>
<h3 class="font-semibold text-gray-900">QKV Calculation</h3>
<h3 class="font-semibold text-gray-900">QKV 计算过程</h3>
{#if isAnimationActive}
<button
class="play-control forward"
Expand Down Expand Up @@ -283,7 +283,7 @@
</div>
</div>
<div class="matrix flex flex-col items-center">
<div class="title self-end">Embedding</div>
<div class="title self-end">嵌入</div>
<!-- (tokenLen, 768) -->
<Matrix
className="token-embedding"
Expand All @@ -298,7 +298,7 @@
</div>
<div class="operator"><div class="symbol">&times;</div></div>
<div class="matrix flex flex-col items-center">
<div class="title">Q·K·V Weights</div>
<div class="title">Q·K·V 权重</div>
<!-- (768,2034) -->
<div class="flex gap-0">
<Matrix
Expand All @@ -317,7 +317,7 @@
</div>
<div class="operator"><div class="symbol">+</div></div>
<div class="matrix flex flex-col items-center">
<div class="title">Bias</div>
<div class="title">偏置</div>
<!-- (768) -->
<Matrix
className="qkv-bias"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Popovers/ResidualPopover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<CommonPopover
className="residual-popover"
title="Residual Connection"
title="残差连接"
{offset}
{triggeredBy}
{trigger}
Expand All @@ -21,7 +21,7 @@
goTo="article-residual"
>
<div class="residual-content">
Adds skip-connections to allow for better gradient flow.
添加跳过连接以实现更好的梯度流
</div></CommonPopover
>

Expand Down
6 changes: 3 additions & 3 deletions src/components/SubsequentBlocks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
</svg> -->

<div class="text" class:active={$isBoundingBoxActive}>
{$modelMeta.layer_num - 1} more identical<br /><span class="highlight"
>Transformer<br />Blocks</span
>.
{$modelMeta.layer_num - 1} 更相同的<br /><span class="highlight"
>Transformer</span
>
</div>
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Temperature.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<div class="slider-container flex w-full flex-col items-end">
<div class="flex w-full shrink-0 items-center justify-between">
<div class="temperature-text flex items-center gap-[2px]">
<div>Temperature</div>
<div>Temperature(温度)</div>
<HelpPopover id="temperature-help" placement="right" goTo="article-prob">
{`Changes the output \nprobability distribution \nand randomness \nof next token.`}
{`改变下一个 token 的输出概率分布和随机性.`}
</HelpPopover>
</div>
<div class="temperature-value">
Expand Down
Loading