時刻* | 主な内容 | メモ/ハマりポイント | 解決策・結果 |
---|---|---|---|
09:30-10:10 | 環境セットアップ・Python venv 有効化・pip install transformers torch fastapi uvicorn |
zsh: no matches found → uvicorn[standard] の引用漏れ |
pip install 'uvicorn[standard]' で解決 |
10:10-10:45 | 学習済み GPT-2(rinna)fine-tune モデル発掘~/AI_myself/results/checkpoint-2838/ を oupe-ec-server/model/ へコピー |
pytorch_model.bin が無いと勘違い |
.safetensors だけでも OK と確認 |
10:45-11:20 | FastAPI プロトタイプ (app.py ) 作成モデル&トークナイザ読み込み → /chat エンドポイント |
SentencePiece 未導入 → import sentencepiece Error |
pip install sentencepiece |
11:20-12:30 | 手動テスト(Python REPL)・model.generate() パラメータ試行・Prompt / token decode 手順確認 |
eos_token_id="\\n" で 0トークン終了 |
min_new_tokens を追加 |
13:00-15:00 | few-shot + Prompt エンジニアリング「言葉が泉のように湧き出る知的な狂人」ペルソナ30字詩 1 行返答 | ユーザ: ラベルが混入 |
後処理で split / bad_words_ids |
15:00-16:30 | Swagger UI (/docs ) で動作確認・POST JSON の入れ方・Reset / Clear の挙動学習 |
Reset はクライアント側のみと理解 | |
16:30-18:00 | 返答が空・プロンプト漏れをデバッグ・<<START>> マーカー → <unk> 問題・token スライス方式へ移行 |
prompt_len = ids.input_ids.shape[-1] で安定切り出し |
|
18:00-19:30 | 生成パラメータ微調整temperature 1.4 / top_p 0.80 / max_new_tokens 48 |
面白さ↔回答性のバランスなど感触確認 | |
19:30-21:00 | VS Code 警告整理・venv Interpreter 選択・Pylance の import 警告を解消 | source venv/bin/activate + Interpreter 再選択で OK |
|
21:00-22:15 | 不要ラベル・引用符除去ロジック追加・reply.strip('\\"“”') ・先頭 ユーザ: / A: カット・禁止語 or 正規表現 |
「途中で切れる」「ユーザ: 残る」をほぼ解消 | |
22:15-22:30 | ラベルを Q: / A: にリネームfew-shot と末尾生成トリガを更新 | 後処理で if reply.startswith("A:") カット |
<< >>
など未知列を <unk>
に変換する。min_new_tokens
と bad_words_ids
の併用で “0 トークン終了” & “ラベル混入” を防げる。お疲れさまでした!