Shuu12121 commited on
Commit
7d45f75
·
verified ·
1 Parent(s): b67582b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +115 -164
README.md CHANGED
@@ -5,203 +5,154 @@ datasets:
5
  - Shuu12121/java-codesearch-dataset-open
6
  language:
7
  - en
 
8
  base_model:
9
  - Shuu12121/CodeHawks-ModernBERT-1.0
10
  pipeline_tag: sentence-similarity
11
  tags:
12
  - code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ---
14
- # Model Card for Model ID
15
 
16
- <!-- Provide a quick summary of what the model is/does. -->
17
 
18
- This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
19
 
20
- ## Model Details
21
 
22
- ### Model Description
 
23
 
24
- <!-- Provide a longer summary of what this model is. -->
25
 
 
 
 
 
 
 
26
 
 
27
 
28
- - **Developed by:** [More Information Needed]
29
- - **Funded by [optional]:** [More Information Needed]
30
- - **Shared by [optional]:** [More Information Needed]
31
- - **Model type:** [More Information Needed]
32
- - **Language(s) (NLP):** [More Information Needed]
33
- - **License:** [More Information Needed]
34
- - **Finetuned from model [optional]:** [More Information Needed]
35
-
36
- ### Model Sources [optional]
37
-
38
- <!-- Provide the basic links for the model. -->
39
-
40
- - **Repository:** [More Information Needed]
41
- - **Paper [optional]:** [More Information Needed]
42
- - **Demo [optional]:** [More Information Needed]
43
-
44
- ## Uses
45
-
46
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
47
-
48
- ### Direct Use
49
-
50
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
51
-
52
- [More Information Needed]
53
-
54
- ### Downstream Use [optional]
55
-
56
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
57
-
58
- [More Information Needed]
59
-
60
- ### Out-of-Scope Use
61
-
62
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
63
-
64
- [More Information Needed]
65
-
66
- ## Bias, Risks, and Limitations
67
-
68
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
69
-
70
- [More Information Needed]
71
-
72
- ### Recommendations
73
-
74
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
75
-
76
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
77
-
78
- ## How to Get Started with the Model
79
-
80
- Use the code below to get started with the model.
81
-
82
- [More Information Needed]
83
-
84
- ## Training Details
85
-
86
- ### Training Data
87
-
88
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
89
-
90
- [More Information Needed]
91
-
92
- ### Training Procedure
93
-
94
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
95
-
96
- #### Preprocessing [optional]
97
-
98
- [More Information Needed]
99
-
100
-
101
- #### Training Hyperparameters
102
-
103
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
104
-
105
- #### Speeds, Sizes, Times [optional]
106
-
107
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
108
-
109
- [More Information Needed]
110
-
111
- ## Evaluation
112
-
113
- <!-- This section describes the evaluation protocols and provides the results. -->
114
-
115
- ### Testing Data, Factors & Metrics
116
-
117
- #### Testing Data
118
-
119
- <!-- This should link to a Dataset Card if possible. -->
120
-
121
- [More Information Needed]
122
-
123
- #### Factors
124
-
125
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
126
-
127
- [More Information Needed]
128
-
129
- #### Metrics
130
-
131
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
132
-
133
- [More Information Needed]
134
-
135
- ### Results
136
-
137
- [More Information Needed]
138
-
139
- #### Summary
140
-
141
-
142
-
143
- ## Model Examination [optional]
144
-
145
- <!-- Relevant interpretability work for the model goes here -->
146
-
147
- [More Information Needed]
148
-
149
- ## Environmental Impact
150
-
151
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
152
-
153
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
154
-
155
- - **Hardware Type:** [More Information Needed]
156
- - **Hours used:** [More Information Needed]
157
- - **Cloud Provider:** [More Information Needed]
158
- - **Compute Region:** [More Information Needed]
159
- - **Carbon Emitted:** [More Information Needed]
160
-
161
- ## Technical Specifications [optional]
162
-
163
- ### Model Architecture and Objective
164
 
165
- [More Information Needed]
166
 
167
- ### Compute Infrastructure
 
168
 
169
- [More Information Needed]
170
 
171
- #### Hardware
172
 
173
- [More Information Needed]
 
 
174
 
175
- #### Software
 
 
176
 
177
- [More Information Needed]
 
 
178
 
179
- ## Citation [optional]
 
 
 
 
 
 
 
180
 
181
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
 
182
 
183
- **BibTeX:**
184
 
185
- [More Information Needed]
186
 
187
- **APA:**
 
 
188
 
189
- [More Information Needed]
190
 
191
- ## Glossary [optional]
 
 
 
 
 
 
 
 
192
 
193
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
 
 
194
 
195
- [More Information Needed]
196
 
197
- ## More Information [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
- [More Information Needed]
200
 
201
- ## Model Card Authors [optional]
 
 
 
202
 
203
- [More Information Needed]
204
 
205
- ## Model Card Contact
 
206
 
207
- [More Information Needed]
 
 
 
5
  - Shuu12121/java-codesearch-dataset-open
6
  language:
7
  - en
8
+ - ja
9
  base_model:
10
  - Shuu12121/CodeHawks-ModernBERT-1.0
11
  pipeline_tag: sentence-similarity
12
  tags:
13
  - code
14
+ - code-search
15
+ - retrieval
16
+ - sentence-similarity
17
+ - bert
18
+ - transformers
19
+ - deep-learning
20
+ - machine-learning
21
+ - nlp
22
+ - programming
23
+ - multi-language
24
+ - rust
25
+ - python
26
+ - java
27
+ - javascript
28
+ - php
29
+ - ruby
30
+ - go
31
  ---
 
32
 
 
33
 
34
+ # **CodeModernBERT-Owl**
35
 
36
+ ## **概要 / Overview**
37
 
38
+ ### **🦉 CodeModernBERT-Owl: 高精度なコード検索 & コード理解モデル**
39
+ **CodeModernBERT-Owl** is a **pretrained model** designed from scratch for **code search and code understanding tasks**.
40
 
41
+ Compared to previous versions such as **CodeHawks-ModernBERT** and **CodeMorph-ModernBERT**, this model **now supports Rust** and **improves search accuracy** in Python, PHP, Java, JavaScript, Go, and Ruby.
42
 
43
+ ### **🛠 主な特徴 / Key Features**
44
+ ✅ **Supports long sequences up to 2048 tokens** (compared to Microsoft's 512-token models)
45
+ ✅ **Optimized for code search, code understanding, and code clone detection**
46
+ ✅ **Fine-tuned on GitHub open-source repositories (Java, Rust)**
47
+ ✅ **Achieves the highest accuracy among the CodeHawks/CodeMorph series**
48
+ ✅ **Multi-language support**: **Python, PHP, Java, JavaScript, Go, Ruby, and Rust**
49
 
50
+ ---
51
 
52
+ ## **📊 モデルパラメータ / Model Parameters**
53
+ | パラメータ / Parameter | / Value |
54
+ |-------------------------|------------|
55
+ | **vocab_size** | 50,000 |
56
+ | **hidden_size** | 768 |
57
+ | **num_hidden_layers** | 12 |
58
+ | **num_attention_heads**| 12 |
59
+ | **intermediate_size** | 3,072 |
60
+ | **max_position_embeddings** | 2,048 |
61
+ | **type_vocab_size** | 2 |
62
+ | **hidden_dropout_prob**| 0.1 |
63
+ | **attention_probs_dropout_prob** | 0.1 |
64
+ | **local_attention_window** | 128 |
65
+ | **rope_theta** | 160,000 |
66
+ | **local_attention_rope_theta** | 10,000 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
+ ---
69
 
70
+ ## **💻 モデルの使用方法 / How to Use**
71
+ This model can be easily loaded using the **Hugging Face Transformers** library.
72
 
73
+ ⚠️ **Requires `transformers >= 4.48.0`**
74
 
75
+ 🔗 **[Colab Demo (Replace with "CodeModernBERT-Owl")](https://github.com/Shun0212/CodeBERTPretrained/blob/main/UseMyCodeMorph_ModernBERT.ipynb)**
76
 
77
+ ### **モデルのロード / Load the Model**
78
+ ```python
79
+ from transformers import AutoModelForMaskedLM, AutoTokenizer
80
 
81
+ tokenizer = AutoTokenizer.from_pretrained("Shuu12121/CodeModernBERT-Owl")
82
+ model = AutoModelForMaskedLM.from_pretrained("Shuu12121/CodeModernBERT-Owl")
83
+ ```
84
 
85
+ ### **コード埋め込みの取得 / Get Code Embeddings**
86
+ ```python
87
+ import torch
88
 
89
+ def get_embedding(text, model, tokenizer, device="cuda"):
90
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
91
+ if "token_type_ids" in inputs:
92
+ inputs.pop("token_type_ids")
93
+ inputs = {k: v.to(device) for k, v in inputs.items()}
94
+ outputs = model.model(**inputs)
95
+ embedding = outputs.last_hidden_state[:, 0, :]
96
+ return embedding
97
 
98
+ embedding = get_embedding("def my_function(): pass", model, tokenizer)
99
+ print(embedding.shape)
100
+ ```
101
 
102
+ ---
103
 
104
+ # **🔍 評価結果 / Evaluation Results**
105
 
106
+ ### **データセット / Dataset**
107
+ 📌 **Tested on `code_x_glue_ct_code_to_text` with a candidate pool size of 100.**
108
+ 📌 **Rust-specific evaluations were conducted using `Shuu12121/rust-codesearch-dataset-open`.**
109
 
110
+ ---
111
 
112
+ ## **📈 主要な評価指標の比較(同一シード値)/ Key Evaluation Metrics (Same Seed)**
113
+ | 言語 / Language | **CodeModernBERT-Owl** | **CodeHawks-ModernBERT** | **Salesforce CodeT5+** | **Microsoft CodeBERT** | **GraphCodeBERT** |
114
+ |-----------|-----------------|----------------------|-----------------|------------------|------------------|
115
+ | **Python** | **0.8793** | 0.8551 | 0.8266 | 0.5243 | 0.5493 |
116
+ | **Java** | **0.8880** | 0.7971 | **0.8867** | 0.3134 | 0.5879 |
117
+ | **JavaScript** | **0.8423** | 0.7634 | 0.7628 | 0.2694 | 0.5051 |
118
+ | **PHP** | **0.9129** | 0.8578 | **0.9027** | 0.2642 | 0.6225 |
119
+ | **Ruby** | **0.8038** | 0.7469 | **0.7568** | 0.3318 | 0.5876 |
120
+ | **Go** | **0.9386** | 0.9043 | 0.8117 | 0.3262 | 0.4243 |
121
 
122
+ **Achieves the highest accuracy in all target languages.**
123
+ ✅ **Significantly improved Java accuracy using additional fine-tuned GitHub data.**
124
+ ✅ **Outperforms previous models, especially in PHP and Go.**
125
 
126
+ ---
127
 
128
+ ## **📊 Rust (独自データセット) / Rust Performance**
129
+ | 指標 / Metric | **CodeModernBERT-Owl** |
130
+ |--------------|----------------|
131
+ | **MRR** | 0.7940 |
132
+ | **MAP** | 0.7940 |
133
+ | **R-Precision** | 0.7173 |
134
+
135
+ ### **📌 K別評価指標 / Evaluation Metrics by K**
136
+ | K | **Recall@K** | **Precision@K** | **NDCG@K** | **F1@K** | **Success Rate@K** | **Query Coverage@K** |
137
+ |----|-------------|---------------|------------|--------|-----------------|-----------------|
138
+ | **1** | 0.7173 | 0.7173 | 0.7173 | 0.7173 | 0.7173 | 0.7173 |
139
+ | **5** | 0.8913 | 0.7852 | 0.8118 | 0.8132 | 0.8913 | 0.8913 |
140
+ | **10** | 0.9333 | 0.7908 | 0.8254 | 0.8230 | 0.9333 | 0.9333 |
141
+ | **50** | 0.9887 | 0.7938 | 0.8383 | 0.8288 | 0.9887 | 0.9887 |
142
+ | **100** | 1.0000 | 0.7940 | 0.8401 | 0.8291 | 1.0000 | 1.0000 |
143
 
144
+ ---
145
 
146
+ ## **📝 結論 / Conclusion**
147
+ ✅ **Top performance in all languages**
148
+ ✅ **Rust support successfully added through dataset augmentation**
149
+ ✅ **Further performance improvements possible with better datasets**
150
 
151
+ ---
152
 
153
+ ## **📜 ライセンス / License**
154
+ 📄 **Apache 2.0**
155
 
156
+ ## **📧 連絡先 / Contact**
157
+ 📩 **For any questions, please contact:**
158
+ 📧 **[email protected]**