kaitos255 commited on
Commit
98db8b2
·
1 Parent(s): c6f4dd0

update README

Browse files
Files changed (2) hide show
  1. README.md +34 -32
  2. README_ja.md +113 -0
README.md CHANGED
@@ -12,19 +12,21 @@ tags:
12
 
13
  # PLaMo-Embedding-1B
14
 
15
- ## モデルの概要
16
- PLaMo-Embedding-1Bは、Preferred Networks, Inc. によって開発された日本語テキスト埋め込みモデルです。
17
 
18
- 日本語の文章を入力することで数値ベクトルに変換することができ、情報検索、テキスト分類、クラスタリングなどをはじめとした幅広い用途でお使い頂けます。
19
 
20
- 日本語テキスト埋め込みのためのベンチマークである[JMTEB](https://github.com/sbintuitions/JMTEB)において、2025年4月初頭時点で最高水準のスコアを達成しました。
21
- 特に検索タスクにおいて一際優れた性能を示しています。
22
 
23
- PLaMo-Embedding-1Bは [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0) ライセンスで公開されており、商用利用を含めて自由にお使い頂けます。
24
 
25
- 技術的詳細については次のTech Blogをご参照ください: [link]
26
 
27
- ## 使用方法
 
 
 
 
28
 
29
  ### Requirements
30
  ```
@@ -33,13 +35,13 @@ torch
33
  transformers
34
  ```
35
 
36
- ### サンプルコード
37
  ```python
38
  import torch
39
  import torch.nn.functional as F
40
  from transformers import AutoModel, AutoTokenizer
41
 
42
- # 🤗 Huggingface Hubから以下のようにしてモデルをダウンロードできます
43
  tokenizer = AutoTokenizer.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
44
  model = AutoModel.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
45
 
@@ -53,24 +55,25 @@ documents = [
53
  ]
54
 
55
  with torch.inference_mode():
56
- # 情報検索におけるクエリ文章の埋め込みに関しては、`encode_query` メソッドを用いてください
57
- # tokenizerも渡す必要があります
58
  query_embedding = model.encode_query(query, tokenizer)
59
- # それ以外の文章に関しては、 `encode_document` メソッドを用いてください
60
- # 情報検索以外の用途についても、 `encode_document` メソッドを用いてください
61
  document_embeddings = model.encode_document(documents, tokenizer)
62
 
63
- # モデルに文章を入力して得られたベクトル間の類似度は、近い文章は高く、遠い文章は低くなります
64
- # この性質を用いて情報検索などに活用することができます
65
  similarities = F.cosine_similarity(query_embedding, document_embeddings)
66
  print(similarities)
67
  # tensor([0.8812, 0.5533])
68
  ```
69
 
70
- `encode_document`, `encode_query` では、モデルの最大コンテキスト長である4096を超えた文章は切り捨てられるのでご注意ください。特に `encode_query` では、内部でprefixが付与されており、この分僅かに最大コンテキスト長が短くなっています。
71
 
72
- ## ベンチマーク結果
73
- 日本語テキスト埋め込みのためのベンチマークである[JMTEB](https://github.com/sbintuitions/JMTEB)を用いて性能評価を行いました。
 
74
 
75
  Model |Avg. | Retrieval | STS | Classification | Reranking | Clustering | PairClassification |
76
  |:----------------------------------------------|:----------|:------------|:----------|:-----------------|:------------|:-------------|:---------------------|
@@ -82,22 +85,21 @@ print(similarities)
82
  |||
83
  |[**PLaMo-Embedding-1B**](https://huggingface.co/pfnet/plamo-embedding-1b) (This model) (*)|**76.10**|**79.94**|**83.14**|77.20|93.57|53.47|62.37|
84
 
85
- (*): コンテキスト長1024で計測。モデルとしてはコンテキスト長4096まで対応していますが、学習時に入れているコンテキスト長が1024までのため、1024で計測しています。ただし、4096で評価してもそこまでスコア平均に影響がないことがわかっています(Tech Blog参照)
86
-
87
- ## モデル詳細
88
 
89
- - モデルサイズ: 1B
90
- - コンテキスト長: 4096
91
- - 埋め込み次元: 2048
92
- - 類似度計測に用いる関数: cosine類似度
93
- - 開発元: Preferred Networks, Inc
94
- - 対応言語: 日本語
95
- - ライセンス: [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0)
96
 
97
- ## ライセンス
 
 
 
 
 
 
98
 
99
- このモデルは [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) のもとで公開されており、商用利用を含めて自由にお使い頂けます。
100
 
 
101
 
102
  ## How to cite
103
 
@@ -107,6 +109,6 @@ print(similarities)
107
  title = {PLaMo-Embedding-1B},
108
  year = {2025},
109
  url = {https://huggingface.co/pfnet/plamo-embedding-1b},
110
- urldate = {2025-04-**}
111
  }
112
  ```
 
12
 
13
  # PLaMo-Embedding-1B
14
 
15
+ [日本語版のREADME/Japanese README](README_ja.md)
 
16
 
17
+ ## Model Overview
18
 
19
+ PLaMo-Embedding-1B is a Japanese text embedding model developed by Preferred Networks, Inc.
 
20
 
21
+ It can convert Japanese text input into numerical vectors and can be used for a wide range of applications, including information retrieval, text classification, and clustering.
22
 
23
+ As of early April 2025, it achieved top-class scores on [JMTEB](https://github.com/sbintuitions/JMTEB), a benchmark for Japanese text embedding. It demonstrated particularly outstanding performance, especially in retrieval tasks.
24
 
25
+ PLaMo-Embedding-1B is released under the [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0) license, and you can use it freely, including for commercial purposes.
26
+
27
+ For technical details, please refer to the following Tech Blog post (Ja): https://tech.preferred.jp/ja/blog/plamo-embedding-1b/
28
+
29
+ ## Usage
30
 
31
  ### Requirements
32
  ```
 
35
  transformers
36
  ```
37
 
38
+ ### Sample Code
39
  ```python
40
  import torch
41
  import torch.nn.functional as F
42
  from transformers import AutoModel, AutoTokenizer
43
 
44
+ # You can download models from the Hugging Face Hub 🤗 as follows:
45
  tokenizer = AutoTokenizer.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
46
  model = AutoModel.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
47
 
 
55
  ]
56
 
57
  with torch.inference_mode():
58
+ # For embedding query texts in information retrieval, please use the `encode_query` method.
59
+ # You also need to pass the `tokenizer`.
60
  query_embedding = model.encode_query(query, tokenizer)
61
+ # For other texts/sentences, please use the `encode_document` method.
62
+ # Also, for applications other than information retrieval, please use the `encode_document` method.
63
  document_embeddings = model.encode_document(documents, tokenizer)
64
 
65
+ # The similarity between vectors obtained by inputting sentences into the model is high for similar sentences and low for dissimilar sentences.
66
+ # This feature can be utilized for applications such as information retrieval.
67
  similarities = F.cosine_similarity(query_embedding, document_embeddings)
68
  print(similarities)
69
  # tensor([0.8812, 0.5533])
70
  ```
71
 
72
+ Note: For `encode_document` and `encode_query`, texts exceeding the model's maximum context length of 4096 will be truncated. Be especially aware that for `encode_query`, a prefix is added internally, making the effective maximum context length slightly shorter.
73
 
74
+
75
+ ## Benchmarks
76
+ We conducted a performance evaluation using [JMTEB](https://github.com/sbintuitions/JMTEB), a benchmark for Japanese text embedding.
77
 
78
  Model |Avg. | Retrieval | STS | Classification | Reranking | Clustering | PairClassification |
79
  |:----------------------------------------------|:----------|:------------|:----------|:-----------------|:------------|:-------------|:---------------------|
 
85
  |||
86
  |[**PLaMo-Embedding-1B**](https://huggingface.co/pfnet/plamo-embedding-1b) (This model) (*)|**76.10**|**79.94**|**83.14**|77.20|93.57|53.47|62.37|
87
 
88
+ (*): Measured with a context length of 1024. Although the model supports a context length of up to 4096, we measured at 1024 because the context length included during training was up to 1024. However, it is known that evaluating at 4096 does not significantly affect the average score. (Ref: [Tech Blog (Ja)](https://tech.preferred.jp/ja/blog/plamo-embedding-1b/))。
 
 
89
 
90
+ ## Model Details
 
 
 
 
 
 
91
 
92
+ - Model Size: 1B
93
+ - Maximum Context Length: 4096 tokens
94
+ - Embedding Dimensionality: 2048
95
+ - Similarity Function: cosine similarity
96
+ - Developer: Preferred Networks, Inc
97
+ - Language: Japanese
98
+ - License: [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0)
99
 
100
+ ## License
101
 
102
+ PLaMo-Embedding-1B is released under the [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0) license, and you can use it freely, including for commercial purposes.
103
 
104
  ## How to cite
105
 
 
109
  title = {PLaMo-Embedding-1B},
110
  year = {2025},
111
  url = {https://huggingface.co/pfnet/plamo-embedding-1b},
112
+ urldate = {2025-04-17}
113
  }
114
  ```
README_ja.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ja
4
+ library_name: transformers
5
+ license: apache-2.0
6
+ pipeline_tag: sentence-similarity
7
+ tags:
8
+ - feature-extraction
9
+ - sentence-similarity
10
+ - transformers
11
+ ---
12
+
13
+ # PLaMo-Embedding-1B
14
+
15
+ ## モデルの概要
16
+
17
+ PLaMo-Embedding-1Bは、Preferred Networks, Inc. によって開発された日本語テキスト埋め込みモデルです。
18
+
19
+ 日本語の文章を入力することで数値ベクトルに変換することができ、情報検索、テキスト分類、クラスタリングなどをはじめとした幅広い用途でお使い頂けます。
20
+
21
+ 日本語テキスト埋め込みのためのベンチマークである[JMTEB](https://github.com/sbintuitions/JMTEB)において、2025年4月初頭時点でトップクラスのスコアを達成しました。
22
+ 特に検索タスクにおいて一際優れた性能を示しています。
23
+
24
+ PLaMo-Embedding-1Bは [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0) ライセンスで公開されており、商用利用を含めて自由にお使い頂けます。
25
+
26
+ 技術的詳細については次のTech Blog (Ja) をご参照ください: https://tech.preferred.jp/ja/blog/plamo-embedding-1b/
27
+
28
+ ## 使用方法
29
+
30
+ ### Requirements
31
+ ```
32
+ sentencepiece
33
+ torch
34
+ transformers
35
+ ```
36
+
37
+ ### サンプルコード
38
+ ```python
39
+ import torch
40
+ import torch.nn.functional as F
41
+ from transformers import AutoModel, AutoTokenizer
42
+
43
+ # 🤗 Huggingface Hubから以下のようにしてモデルをダウンロードできます
44
+ tokenizer = AutoTokenizer.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
45
+ model = AutoModel.from_pretrained("pfnet/plamo-embedding-1b", trust_remote_code=True)
46
+
47
+ device = "cuda" if torch.cuda.is_available() else "cpu"
48
+ model = model.to(device)
49
+
50
+ query = "PLaMo-Embedding-1Bとは何ですか?"
51
+ documents = [
52
+ "PLaMo-Embedding-1Bは、Preferred Networks, Inc. によって開発された日本語テキスト埋め込みモデルです。",
53
+ "最近は随分と暖かくなりましたね。"
54
+ ]
55
+
56
+ with torch.inference_mode():
57
+ # 情報検索におけるクエリ文章の埋め込みに関しては、`encode_query` メソッドを用いてください
58
+ # tokenizerも渡す必要があります
59
+ query_embedding = model.encode_query(query, tokenizer)
60
+ # それ以外の文章に関しては、 `encode_document` メソッドを用いてください
61
+ # 情報検索以外の用途についても、 `encode_document` メソッドを用いてください
62
+ document_embeddings = model.encode_document(documents, tokenizer)
63
+
64
+ # モデルに文章を入力して得られたベクトル間の類似度は、近い文章は高く、遠い文章は低くなります
65
+ # この性質を用いて情報検索などに活用することができます
66
+ similarities = F.cosine_similarity(query_embedding, document_embeddings)
67
+ print(similarities)
68
+ # tensor([0.8812, 0.5533])
69
+ ```
70
+
71
+ ※ `encode_document`, `encode_query` では、モデルの最大コンテキスト長である4096を超えた文章は切り捨てられるのでご注意ください。特に `encode_query` では、内部でprefixが付与されており、この分僅かに最大コンテキスト長が短くなっています。
72
+
73
+ ## ベンチマーク結果
74
+ 日本語テキスト埋め込みのためのベンチマークである[JMTEB](https://github.com/sbintuitions/JMTEB)を用いて性能評価を行いました。
75
+
76
+ Model |Avg. | Retrieval | STS | Classification | Reranking | Clustering | PairClassification |
77
+ |:----------------------------------------------|:----------|:------------|:----------|:-----------------|:------------|:-------------|:---------------------|
78
+ | [intfloat/multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) |70.90 | 70.98 | 79.70 | 72.89 | 92.96 | 51.24 | 62.15 |
79
+ | [pkshatech/GLuCoSE-base-ja-v2](https://huggingface.co/pkshatech/GLuCoSE-base-ja-v2) |72.23 | 73.36 | 82.96 | 74.21 | 93.01 | 48.65 | 62.37 |
80
+ | [OpenAI/text-embedding-3-large](https://openai.com/index/new-embedding-models-and-api-updates/) |74.05 | 74.48 | 82.52 | 77.58 | 93.58 | 53.32 | 62.35 |
81
+ | [cl-nagoya/ruri-large-v2](https://huggingface.co/cl-nagoya/ruri-large-v2) |74.55 | 76.34 | 83.17 | 77.18 | 93.21 | 52.14 | 62.27 |
82
+ |[Sarashina-Embedding-v1-1B](https://huggingface.co/sbintuitions/sarashina-embedding-v1-1b)|75.50|77.61|82.71|**78.37**|**93.74**|**53.86**|62.00|
83
+ |||
84
+ |[**PLaMo-Embedding-1B**](https://huggingface.co/pfnet/plamo-embedding-1b) (This model) (*)|**76.10**|**79.94**|**83.14**|77.20|93.57|53.47|62.37|
85
+
86
+ (*): コンテキスト長1024で計測。モデルとしてはコンテキスト長4096まで対応していますが、学習時に入れているコンテキスト長が1024までのため、1024で計測しています。ただし、4096で評価してもそこまでスコア平均に影響がないことがわかっています ([Tech Blog](https://tech.preferred.jp/ja/blog/plamo-embedding-1b/)参照 (Ja))。
87
+
88
+ ## モデル詳細
89
+
90
+ - モデルサイズ: 1B
91
+ - 最大コンテキスト長: 4096トークン
92
+ - 埋め込み次元: 2048
93
+ - 類似度計測に用いる関数: cosine類似度
94
+ - 開発元: Preferred Networks, Inc
95
+ - 対応言語: 日本語
96
+ - ライセンス: [Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0)
97
+
98
+ ## ライセンス
99
+
100
+ PLaMo-Embedding-1Bは [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) のもとで公開されており、商用利用を含めて自由にお使い頂けます。
101
+
102
+
103
+ ## How to cite
104
+
105
+ ```
106
+ @online{PLaMoEmbedding1B,
107
+ author = {Preferred Networks, Inc},
108
+ title = {PLaMo-Embedding-1B},
109
+ year = {2025},
110
+ url = {https://huggingface.co/pfnet/plamo-embedding-1b},
111
+ urldate = {2025-04-17}
112
+ }
113
+ ```