""" コンセプトページ WILLプロジェクトの概念説明を提供する """ import streamlit as st from ....models.registry import ModelRegistry from ..components import GPU_REQUIRED_MODELS def render_concept_page() -> None: """コンセプトページをレンダリング""" st.markdown('

CONCEPT

', unsafe_allow_html=True) st.markdown('

DOCUMENTATION

', unsafe_allow_html=True) _render_what_section() _render_how_section() _render_specification_section() def _render_what_section() -> None: """WHAT セクション""" st.markdown( '''

WHAT

言語モデルにランダムノイズを入力し
出力にもノイズを加えて学習バイアスを破壊する

人間の問いかけなしに
モデルの構造だけが出力するものを観測する


''', unsafe_allow_html=True, ) def _render_how_section() -> None: """HOW セクション""" st.markdown( '''

HOW

''', unsafe_allow_html=True, ) # Step 1 st.markdown( '

01 — INPUT

', unsafe_allow_html=True, ) st.code("noise = torch.randn(1, seq_len, embedding_dim)", language="python") st.markdown( '

' "ランダムノイズをEmbedding層に直接注入

", unsafe_allow_html=True, ) st.markdown("
", unsafe_allow_html=True) # Step 2 st.markdown( '

02 — CORRUPT

', unsafe_allow_html=True, ) st.code("corrupted = logits + randn_like(logits) * logits.std() * 10", language="python") st.markdown( '

' "出力にノイズを加算し学習バイアスを破壊

", unsafe_allow_html=True, ) st.markdown("
", unsafe_allow_html=True) # Step 3 st.markdown( '

03 — DECODE

', unsafe_allow_html=True, ) st.code("tokens = corrupted.argmax(dim=-1)", language="python") st.markdown( '

' "Softmaxなしで生トークンを抽出

", unsafe_allow_html=True, ) def _render_specification_section() -> None: """仕様セクション""" # 利用可能なモデル一覧を動的に取得 all_configs = ModelRegistry.get_all_configs() available_configs = {k: v for k, v in all_configs.items() if k not in GPU_REQUIRED_MODELS} model_names = [cfg.name for cfg in available_configs.values()] model_list_str = " / ".join(model_names[:5]) + " ..." # パラメータ範囲を計算 params_info = "125M - 1.5B" st.markdown( f'''

SPEC

Models{model_list_str}
Sequence32 tokens
InputN(0, 1)
CorruptionN(0, σ×10)
Decodeargmax
''', unsafe_allow_html=True, )