AoiNoGeso commited on
Commit
e587030
·
1 Parent(s): d2010e3

Upload Fully-tuned Japanese CLIP model

Browse files
Files changed (6) hide show
  1. README.md +68 -0
  2. config.json +10 -0
  3. pytorch_model.bin +3 -0
  4. special_tokens_map.json +7 -0
  5. tokenizer_config.json +63 -0
  6. vocab.txt +0 -0
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ja
3
+ license: apache-2.0
4
+ tags:
5
+ - clip
6
+ - japanese
7
+ - multimodal
8
+ - vision-language
9
+ - stair-captions
10
+ - image-text-matching
11
+ - full-tuning # タグを更新
12
+ datasets:
13
+ - stair-captions
14
+ library_name: transformers
15
+ pipeline_tag: zero-shot-image-classification
16
+ ---
17
+
18
+ # Japanese CLIP Model with Full Tuning
19
+
20
+ 日本語画像・テキスト対応CLIPモデル(STAIR Captions v1.2で学習、両エンコーダー学習)
21
+
22
+ ## モデル概要 / Model Overview
23
+
24
+ このモデルは、STAIR Captions v1.2データセットで画像エンコーダーとテキストエンコーダーの両方をファインチューニングして学習された日本語対応のCLIPモデルです。
25
+
26
+ ## 特徴 / Features
27
+
28
+ - **Full Tuning**: 画像エンコーダーとテキストエンコーダーの両方を学習
29
+ - **高品質な日本語理解**: BERT-base-japanese-v3をファインチューニング
30
+ - **温度付きコントラスト損失**: InfoNCE損失による効果的な学習
31
+
32
+ ## モデル詳細 / Model Details
33
+
34
+ - **テキストエンコーダー**: tohoku-nlp/bert-base-japanese-v3 (ファインチューニング)
35
+ - **画像エンコーダー**: ResNet50 (ImageNet事前学習済み、ファインチューニング) # 説明を更新
36
+ - **学習手法**: Full Tuning (両エンコーダーの同時学習) # 説明を更新
37
+ - **共通埋め込み次元**: 512
38
+ - **画像サイズ**: 224x224
39
+ - **最大テキスト長**: 128
40
+ - **学習率**: 1e-05
41
+ - **損失関数**: 温度付きコントラスト損失 (InfoNCE)
42
+
43
+ ## 使用方法 / How to Use
44
+
45
+ ```python
46
+ from transformers import AutoTokenizer, AutoModel
47
+ import torch
48
+ import torch.nn.functional as F
49
+
50
+ # モデルとトークナイザーのロード
51
+ tokenizer = AutoTokenizer.from_pretrained("AoiNoGeso/japanese-clip-stair-v3")
52
+ model = AutoModel.from_pretrained("AoiNoGeso/japanese-clip-stair-v3")
53
+
54
+ # 推論例
55
+ text = "猫が座っている"
56
+ tokens = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
57
+
58
+ # テキスト埋め込みを取得
59
+ with torch.no_grad():
60
+ text_embeddings = model.text_encoder(tokens["input_ids"], tokens["attention_mask"])
61
+
62
+ # 学習データ / Training Data
63
+ - データセット: STAIR Captions v1.2
64
+ - 言語: 日本語
65
+ - ドメイン: 一般的な画像キャプション
66
+
67
+ # ライセンス / License
68
+ Apache License 2.0
config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "text_model_name": "tohoku-nlp/bert-base-japanese-v3",
3
+ "image_embedding_dim": 2048,
4
+ "text_embedding_dim": 768,
5
+ "projection_dim": 512,
6
+ "temperature": 0.07,
7
+ "max_text_length": 128,
8
+ "image_size": 224,
9
+ "method": "Full Tuning"
10
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0874109bc69733024b0e113938f439b705d1e2c675cb22ffb543968af3869cb
3
+ size 545058562
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": false,
47
+ "do_subword_tokenize": true,
48
+ "do_word_tokenize": true,
49
+ "jumanpp_kwargs": null,
50
+ "mask_token": "[MASK]",
51
+ "mecab_kwargs": {
52
+ "mecab_dic": "unidic_lite"
53
+ },
54
+ "model_max_length": 512,
55
+ "never_split": null,
56
+ "pad_token": "[PAD]",
57
+ "sep_token": "[SEP]",
58
+ "subword_tokenizer_type": "wordpiece",
59
+ "sudachi_kwargs": null,
60
+ "tokenizer_class": "BertJapaneseTokenizer",
61
+ "unk_token": "[UNK]",
62
+ "word_tokenizer_type": "mecab"
63
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff