Open GENZITSU opened 11 months ago
3種類(ユーザー、作品、タグ)、5種類(書いた、読んだ、ダグ付、タグフォロー、ユーザーフォロー)のエッジを用いて、作品に紐づくタグ(3クラス)を予測している記事
詳しく書かれていないがタスクはおそらくエッジが生成されるかの予測
accuracyはtrain→val→testの順で0.974, 0.619, 0.544と順当に下がっている。 というのもデータの分割方法がその順番で難しくなっているからで、3クラスではあるけどテストデータの方が文字列としての難易度が高いから
正解クラス情報については、よく使われているタグ上位1,000件に対して、定期的に人力でチェックして分類しているデータを使用しました。分割方法は上位500件を訓練用、次の250件を検証用、次の250件をテスト用としました。
記事で利用されているDeep Graph LibraryがsotaなGNNを扱うには便利らしい。 直近の更新が1週間前で11K starついてる
特に二次創作ファン同士だけで通じるような、wrx2、2434、ci、knkz、zmなど、イニシャルで省略されたものも多いです。このような短い文字列からだけで直接推定するのは難しい
タグ予測確かに難しい… どれもわからない
合成データセットを作成して、End-to-EndなOCRモデルDonutを学習させている記事。
合成データセットの作成方法がとにかく今風で参考になる。
まずはOCR結果から
実装はoshizo/VisualNovelVDUDataGeneratorみたいで、参考にされたのがBelval/TextRecognitionDataGenerator
フォントファイルと背景画像、キャラクターの透過png画像と表示するメッセージを与えて画像を合成
背景画像とキャラクターの透過pngはStable Diffusionで作成したとのこと
DonutのDeocoderにはTransformerが利用されているので、テキストは支離滅裂な文章ではなく自然な日本語であることが望ましいとのことで、rinna/japanese-gpt2-mediumをキャラクターのセリフに特化してファインチューニングしたモデルを使って5万件程度のテキストを生成。
この際、難しい単語もしっかり入れるために、promptに入れ込むという工夫を実施
元々のtokenizerに入っていない単語も追加で認識できるようにするため、toknerizer.jsonを直で編集し1500文字分追加
余談ですが学習には公式レポジトリではなくNielsRogge/Transformers-Tutorialsを用いることでHuggingface対応させることができる模様
合成データセットの作成方法としてめちゃくちゃ勉強になる。
ChatGPTに長期の会話履歴を埋め込みながら会話する方法を3通り試している記事
試しているの以下の3通り
本当に長期の記憶を実装する場合は、会話要約の随時更新 + 関連文章の検索の方が良さそうかな...?
GPT4を利用して仮想的な対戦相手とワードウルフを遊べるブラウザゲームを作成したとのこと
プロンプトの作り方が参考になり、CoTのアイデアに乗っ取って思考と発言内容を分離させて考えるようにしている。
# Game rules
You are playing a game of "Word Werewolf".
There is one werewolf among the players.
Each player is given a secret word--the majority (villagers) shares a common word, while the werewolf has a different one.
No one (even the werewolf himself) knows who is the werewolf, so you have to talk about your secret words to find out.
The players then vote to execute someone. The villagers win if the werewolf is executed; otherwise the werewolf wins.
# Players
{{ 全プレイヤーの名前 }}
# Your character
You act as {{ ボットの名前 }}, whose character is as described below:
{{ ボットの性格 }}
# Your secret word
{{ お題 }}
# What you should do
1. Summarize each other player's comments so far.
2. Think if each of their topic align with yours ({{ お題 }}).
3. Guess who is most likely the werewolf.
- When multiple people are talking about different topic from yours, you should be the werewolf.
- When someone agrees with your topic, you (and that person) are probably not the werewolf.
4. Think what you should say next.
- At the very beginning, give brief and vague description of the word. When the word is dog, for example, say something like "I adore them".
- If you might be the minority, you must blend in by deducing the villagers' word and lying to avoid detection.
- When you lack information, ask questions about the word to find out the werewolf.
# Response format
You must respond with a single valid JSON.
Your inner thoughts should always be in English, while you speak with the language and tone specified in the character description.
Here is an example:
{
thoughts: "Markus said it 'walks silently', which sounds more like 'cat' than my word 'dog'.
Conner's description 'independent animal' also suggests 'cat'. The majority word is thus most likely 'cat',
which makes me the werewolf. I should pretend to talk about cat.",
likelyWerewolf: "Kara",
say: "They love high places, right?"
}
GPT3.5だと全然ダメだったとの記載があったので、GPT4が使えるようになるまでは様子見感がある
XAIの代表的な手法から説明性をもとにした応用例までをカバーしているチュートリアルスライド
勉強になったところだけ抜粋
以下は雑感
pydanticにArugumentParserのclassメソッドを追加することで、コマンドライン引数からの入力を可能にするという小テクが紹介されている。
# from https://qiita.com/ShotaOki/items/c777d600b2f854d30241
from argparse import ArgumentParser
from pydantic import BaseModel
class Argments(BaseModel):
"""
Pythonファイルの引数を定義する
"""
bucketname: str # AWSのバケット名
filename: str # ファイル名
timeout: int # タイムアウト時間
@classmethod
def parse_args(cls):
# 付け足した関数
parser = ArgumentParser()
for k in cls.schema()["properties"].keys():
parser.add_argument(f"-{k[0:1]}", f"--{k}")
return cls.parse_obj(parser.parse_args().__dict__)
# 実行してみる: 引数を検証する
args = Argments.parse_args()
print(args)
print(args.bucketname)
print(args.timeout)
コマンドライン引数に型を付与できるだけでなく、入力補完も効かせられるようになるのは便利そう
docker-compose.ymlと同じ階層に.envファイルを置いておくことで、yml中で設定する変数の値を.envファイルで管理できるようになるというテクを紹介
ちなみにコンテナ内の環境変数を変えたい場合はdocker-compose.yml中にenv_fileを定義する必要がある。
# from https://zenn.dev/forcia_tech/articles/20230613_hatano_dotenv
services:
postgres:
...
env_file:
- .env
- .env.local
...
これをコマンドライン引数で渡す形式にすることでyml中の設定変数を書き換えられるのだが、オプション指定の手間は割とおきい
docker compose --env-file .env --env-file .env.local up -d
.envファイルもgitで管理しておかないと存在を忘れやすいというのが注意点か
2019年に行われたX線CT画像を用いた工業製品内部の鋳巣領域の推定コンテンストで1位だった手法の解説
ポイントは以下
5 myths about medical AI, debunked
医療AIを実用化するにあたってよくある5つの勘違いを紹介しているgoogle healthからの記事
コメント
真新しい事は書かれていないが、全て重要である
出典