Shuu12121 commited on
Commit
f50b6fc
·
verified ·
1 Parent(s): 5496fcf

Upload ModernBERT model

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": true,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,777 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - generated_from_trainer
7
+ - dataset_size:901028
8
+ - loss:CosineSimilarityLoss
9
+ base_model: Shuu12121/CodeModernBERT-Owl
10
+ widget:
11
+ - source_sentence: " public void scan() throws Throwable {\n client = new\
12
+ \ FTPClient();\n log.info(\"connecting to \" + host + \"...\");\n \
13
+ \ client.connect(host);\n log.info(client.getReplyString());\n \
14
+ \ log.info(\"logging in...\");\n client.login(\"anonymous\", \"\");\n\
15
+ \ log.info(client.getReplyString());\n Date date = Calendar.getInstance().getTime();\n\
16
+ \ xmlDocument = new XMLDocument(host, dir, date);\n scanDirectory(dir);\n\
17
+ \ }\n"
18
+ sentences:
19
+ - " public static void zip(ZipOutputStream out, File f, String base) throws Exception\
20
+ \ {\n if (f.isDirectory()) {\n File[] fl = f.listFiles();\n\
21
+ \ base = base.length() == 0 ? \"\" : base + File.separator;\n \
22
+ \ for (int i = 0; i < fl.length; i++) {\n zip(out, fl[i],\
23
+ \ base + fl[i].getName());\n }\n } else {\n out.putNextEntry(new\
24
+ \ org.apache.tools.zip.ZipEntry(base));\n FileInputStream in = new\
25
+ \ FileInputStream(f);\n IOUtils.copyStream(in, out);\n in.close();\n\
26
+ \ }\n Thread.sleep(10);\n }\n"
27
+ - " public static void zip(String destination, String folder) {\n File\
28
+ \ fdir = new File(folder);\n File[] files = fdir.listFiles();\n \
29
+ \ PrintWriter stdout = new PrintWriter(System.out, true);\n int read =\
30
+ \ 0;\n FileInputStream in;\n byte[] data = new byte[1024];\n \
31
+ \ try {\n ZipOutputStream out = new ZipOutputStream(new FileOutputStream(destination));\n\
32
+ \ out.setMethod(ZipOutputStream.DEFLATED);\n for (int i\
33
+ \ = 0; i < files.length; i++) {\n try {\n stdout.println(files[i].getName());\n\
34
+ \ ZipEntry entry = new ZipEntry(files[i].getName());\n \
35
+ \ in = new FileInputStream(files[i].getPath());\n \
36
+ \ out.putNextEntry(entry);\n while ((read = in.read(data,\
37
+ \ 0, 1024)) != -1) {\n out.write(data, 0, read);\n \
38
+ \ }\n out.closeEntry();\n \
39
+ \ in.close();\n } catch (Exception e) {\n e.printStackTrace();\n\
40
+ \ }\n }\n out.close();\n } catch (IOException\
41
+ \ ex) {\n ex.printStackTrace();\n }\n }\n"
42
+ - " private void copyFile(URL from, File to) {\n try {\n InputStream\
43
+ \ is = from.openStream();\n IOUtils.copy(is, new FileOutputStream(to));\n\
44
+ \ } catch (IOException e) {\n e.printStackTrace();\n \
45
+ \ }\n }\n"
46
+ - source_sentence: " public void createMd5Hash() {\n try {\n \
47
+ \ String vcardObject = new ContactToVcard(TimeZone.getTimeZone(\"UTC\"), \"UTF-8\"\
48
+ ).convert(this);\n MessageDigest m = MessageDigest.getInstance(\"MD5\"\
49
+ );\n m.update(vcardObject.getBytes());\n this.md5Hash =\
50
+ \ new BigInteger(m.digest()).toString();\n if (log.isTraceEnabled())\
51
+ \ {\n log.trace(\"Hash is:\" + this.md5Hash);\n }\n\
52
+ \ } catch (ConverterException ex) {\n log.error(\"Error creating\
53
+ \ hash:\" + ex.getMessage());\n } catch (NoSuchAlgorithmException noSuchAlgorithmException)\
54
+ \ {\n log.error(\"Error creating hash:\" + noSuchAlgorithmException.getMessage());\n\
55
+ \ }\n }\n"
56
+ sentences:
57
+ - " public static void main(String[] args) {\n try {\n int\
58
+ \ encodeFlag = 0;\n if (args[0].equals(\"-e\")) {\n \
59
+ \ encodeFlag = Base64.ENCODE;\n } else if (args[0].equals(\"-d\"))\
60
+ \ {\n encodeFlag = Base64.DECODE;\n }\n String\
61
+ \ infile = args[1];\n String outfile = args[2];\n File fin\
62
+ \ = new File(infile);\n FileInputStream fis = new FileInputStream(fin);\n\
63
+ \ BufferedInputStream bis = new BufferedInputStream(fis);\n \
64
+ \ Base64.InputStream b64in = new Base64.InputStream(bis, encodeFlag | Base64.DO_BREAK_LINES);\n\
65
+ \ File fout = new File(outfile);\n FileOutputStream fos\
66
+ \ = new FileOutputStream(fout);\n BufferedOutputStream bos = new BufferedOutputStream(fos);\n\
67
+ \ byte[] buff = new byte[1024];\n int read = -1;\n \
68
+ \ while ((read = b64in.read(buff)) >= 0) {\n bos.write(buff,\
69
+ \ 0, read);\n }\n bos.close();\n b64in.close();\n\
70
+ \ } catch (Exception e) {\n e.printStackTrace();\n }\n\
71
+ \ }\n"
72
+ - " public static String md5(String str) {\n StringBuffer buf = new StringBuffer();\n\
73
+ \ try {\n MessageDigest md = MessageDigest.getInstance(\"MD5\"\
74
+ );\n byte[] data = new byte[32];\n md.update(str.getBytes(md5Encoding),\
75
+ \ 0, str.length());\n data = md.digest();\n for (int i =\
76
+ \ 0; i < data.length; i++) {\n int halfbyte = (data[i] >>> 4) &\
77
+ \ 0x0F;\n int two_halfs = 0;\n do {\n \
78
+ \ if ((0 <= halfbyte) && (halfbyte <= 9)) buf.append((char) ('0' + halfbyte));\
79
+ \ else buf.append((char) ('a' + (halfbyte - 10)));\n halfbyte\
80
+ \ = data[i] & 0x0F;\n } while (two_halfs++ < 1);\n }\n\
81
+ \ } catch (Exception e) {\n errorLog(\"{Malgn.md5} \" + e.getMessage());\n\
82
+ \ }\n return buf.toString();\n }\n"
83
+ - " public static String md5(String text, String charset) {\n MessageDigest\
84
+ \ msgDigest = null;\n try {\n msgDigest = MessageDigest.getInstance(\"\
85
+ MD5\");\n } catch (NoSuchAlgorithmException e) {\n throw new\
86
+ \ IllegalStateException(\"System doesn't support MD5 algorithm.\");\n }\n\
87
+ \ msgDigest.update(text.getBytes());\n byte[] bytes = msgDigest.digest();\n\
88
+ \ byte tb;\n char low;\n char high;\n char tmpChar;\n\
89
+ \ String md5Str = new String();\n for (int i = 0; i < bytes.length;\
90
+ \ i++) {\n tb = bytes[i];\n tmpChar = (char) ((tb >>> 4)\
91
+ \ & 0x000f);\n if (tmpChar >= 10) {\n high = (char)\
92
+ \ (('a' + tmpChar) - 10);\n } else {\n high = (char)\
93
+ \ ('0' + tmpChar);\n }\n md5Str += high;\n tmpChar\
94
+ \ = (char) (tb & 0x000f);\n if (tmpChar >= 10) {\n low\
95
+ \ = (char) (('a' + tmpChar) - 10);\n } else {\n low\
96
+ \ = (char) ('0' + tmpChar);\n }\n md5Str += low;\n \
97
+ \ }\n return md5Str;\n }\n"
98
+ - source_sentence: " @Override\n public void run() {\n \
99
+ \ try {\n IOUtils.copy(getSource(), processStdIn);\n\
100
+ \ System.err.println(\"Copy done.\");\n \
101
+ \ close();\n } catch (IOException e) {\n e.printStackTrace();\n\
102
+ \ IOUtils.closeQuietly(ExternalDecoder.this);\n \
103
+ \ }\n }\n"
104
+ sentences:
105
+ - " private String readJsonString() {\n StringBuilder builder = new StringBuilder();\n\
106
+ \ HttpClient client = new DefaultHttpClient();\n HttpGet httpGet\
107
+ \ = new HttpGet(SERVER_URL);\n try {\n HttpResponse response\
108
+ \ = client.execute(httpGet);\n StatusLine statusLine = response.getStatusLine();\n\
109
+ \ int statusCode = statusLine.getStatusCode();\n if (statusCode\
110
+ \ == 200) {\n HttpEntity entity = response.getEntity();\n \
111
+ \ InputStream content = entity.getContent();\n BufferedReader\
112
+ \ reader = new BufferedReader(new InputStreamReader(content));\n \
113
+ \ String line;\n while ((line = reader.readLine()) != null) {\n\
114
+ \ builder.append(line);\n }\n } else\
115
+ \ {\n Log.e(TAG, \"Failed to download file\");\n }\n\
116
+ \ } catch (ClientProtocolException e) {\n e.printStackTrace();\n\
117
+ \ } catch (IOException e) {\n e.printStackTrace();\n \
118
+ \ }\n return builder.toString();\n }\n"
119
+ - " public void run() {\n LogPrinter.log(Level.FINEST, \"Started Download\
120
+ \ at : {0, date, long}\", new Date());\n if (!PipeConnected) {\n \
121
+ \ throw new IllegalStateException(\"You should connect the pipe before with\
122
+ \ getInputStream()\");\n }\n InputStream ins = null;\n if\
123
+ \ (IsAlreadyDownloaded) {\n LogPrinter.log(Level.FINEST, \"The file\
124
+ \ already Exists open and foward the byte\");\n try {\n \
125
+ \ ContentLength = (int) TheAskedFile.length();\n ContentType\
126
+ \ = URLConnection.getFileNameMap().getContentTypeFor(TheAskedFile.getName());\n\
127
+ \ ins = new FileInputStream(TheAskedFile);\n byte[]\
128
+ \ buffer = new byte[BUFFER_SIZE];\n int read = ins.read(buffer);\n\
129
+ \ while (read >= 0) {\n Pipe.write(buffer, 0,\
130
+ \ read);\n read = ins.read(buffer);\n }\n \
131
+ \ } catch (IOException e) {\n e.printStackTrace();\n \
132
+ \ } finally {\n if (ins != null) {\n \
133
+ \ try {\n ins.close();\n } catch\
134
+ \ (IOException e) {\n }\n }\n }\n\
135
+ \ } else {\n LogPrinter.log(Level.FINEST, \"the file does not\
136
+ \ exist locally so we try to download the thing\");\n File theDir =\
137
+ \ TheAskedFile.getParentFile();\n if (!theDir.exists()) {\n \
138
+ \ theDir.mkdirs();\n }\n for (URL url : ListFastest)\
139
+ \ {\n FileOutputStream fout = null;\n boolean OnError\
140
+ \ = false;\n long timestart = System.currentTimeMillis();\n \
141
+ \ long bytecount = 0;\n try {\n \
142
+ \ URL newUrl = new URL(url.toString() + RequestedFile);\n LogPrinter.log(Level.FINEST,\
143
+ \ \"the download URL = {0}\", newUrl);\n URLConnection conn\
144
+ \ = newUrl.openConnection();\n ContentType = conn.getContentType();\n\
145
+ \ ContentLength = conn.getContentLength();\n \
146
+ \ ins = conn.getInputStream();\n fout = new FileOutputStream(TheAskedFile);\n\
147
+ \ byte[] buffer = new byte[BUFFER_SIZE];\n \
148
+ \ int read = ins.read(buffer);\n while (read >= 0) {\n \
149
+ \ fout.write(buffer, 0, read);\n \
150
+ \ Pipe.write(buffer, 0, read);\n read = ins.read(buffer);\n\
151
+ \ bytecount += read;\n }\n \
152
+ \ Pipe.flush();\n } catch (IOException e) {\n \
153
+ \ OnError = true;\n } finally {\n \
154
+ \ if (ins != null) {\n try {\n \
155
+ \ ins.close();\n } catch (IOException e) {\n \
156
+ \ }\n }\n if (fout !=\
157
+ \ null) {\n try {\n fout.close();\n\
158
+ \ } catch (IOException e) {\n }\n\
159
+ \ }\n }\n long timeend = System.currentTimeMillis();\n\
160
+ \ if (OnError) {\n continue;\n \
161
+ \ } else {\n long timetook = timeend - timestart;\n \
162
+ \ BigDecimal speed = new BigDecimal(bytecount).multiply(new BigDecimal(1000)).divide(new\
163
+ \ BigDecimal(timetook), MathContext.DECIMAL32);\n for (ReportCalculatedStatistique\
164
+ \ report : Listener) {\n report.reportUrlStat(url, speed,\
165
+ \ timetook);\n }\n break;\n \
166
+ \ }\n }\n }\n LogPrinter.log(Level.FINEST, \"download\
167
+ \ finished at {0,date,long}\", new Date());\n if (Pipe != null) {\n \
168
+ \ try {\n Pipe.close();\n } catch (IOException\
169
+ \ e) {\n e.printStackTrace();\n }\n }\n }\n"
170
+ - " public void run(String srcf, String dst) {\n final Path srcPath =\
171
+ \ new Path(\"./\" + srcf);\n final Path desPath = new Path(dst);\n \
172
+ \ try {\n Path[] srcs = FileUtil.stat2Paths(hdfs.globStatus(srcPath),\
173
+ \ srcPath);\n OutputStream out = FileSystem.getLocal(conf).create(desPath);\n\
174
+ \ for (int i = 0; i < srcs.length; i++) {\n System.out.println(srcs[i]);\n\
175
+ \ InputStream in = hdfs.open(srcs[i]);\n IOUtils.copyBytes(in,\
176
+ \ out, conf, false);\n in.close();\n }\n \
177
+ \ out.close();\n } catch (IOException ex) {\n System.err.print(ex.getMessage());\n\
178
+ \ }\n }\n"
179
+ - source_sentence: " private void readHomePage(ITestThread testThread) throws IOException\
180
+ \ {\n if (null == testThread) {\n throw new IllegalArgumentException(\"\
181
+ Test thread may not be null.\");\n }\n final InputStream urlIn =\
182
+ \ new URL(testUrl).openStream();\n final int availableBytes = urlIn.available();\n\
183
+ \ if (0 == availableBytes) {\n throw new IllegalStateException(\"\
184
+ Zero bytes on target host.\");\n }\n in = new BufferedReader(new\
185
+ \ InputStreamReader(urlIn));\n String line;\n while (null != in\
186
+ \ && null != (line = in.readLine())) {\n page.append(line);\n \
187
+ \ page.append('\\n');\n if (0 != lineDelay) {\n \
188
+ \ OS.sleep(lineDelay);\n }\n if (testThread.isActionStopped())\
189
+ \ {\n break;\n }\n }\n }\n"
190
+ sentences:
191
+ - " @Override\n public ReturnValue do_run() {\n int bufLen = 500 *\
192
+ \ 1024;\n ReturnValue ret = new ReturnValue();\n ret.setExitStatus(ReturnValue.SUCCESS);\n\
193
+ \ File output = null;\n if (((String) options.valueOf(\"input-file\"\
194
+ )).startsWith(\"s3://\")) {\n Pattern p = Pattern.compile(\"s3://(\\\
195
+ \\S+):(\\\\S+)@(\\\\S+)\");\n Matcher m = p.matcher((String) options.valueOf(\"\
196
+ input-file\"));\n boolean result = m.find();\n String accessKey\
197
+ \ = null;\n String secretKey = null;\n String URL = (String)\
198
+ \ options.valueOf(\"input-file\");\n if (result) {\n \
199
+ \ accessKey = m.group(1);\n secretKey = m.group(2);\n \
200
+ \ URL = \"s3://\" + m.group(3);\n } else {\n \
201
+ \ try {\n HashMap<String, String> settings = (HashMap<String,\
202
+ \ String>) ConfigTools.getSettings();\n accessKey = settings.get(\"\
203
+ AWS_ACCESS_KEY\");\n secretKey = settings.get(\"AWS_SECRET_KEY\"\
204
+ );\n } catch (Exception e) {\n ret.setExitStatus(ReturnValue.SETTINGSFILENOTFOUND);\n\
205
+ \ ret.setProcessExitStatus(ReturnValue.SETTINGSFILENOTFOUND);\n\
206
+ \ return (ret);\n }\n }\n \
207
+ \ if (accessKey == null || secretKey == null) {\n ret.setExitStatus(ReturnValue.ENVVARNOTFOUND);\n\
208
+ \ ret.setProcessExitStatus(ReturnValue.ENVVARNOTFOUND);\n \
209
+ \ return (ret);\n }\n AmazonS3 s3 = new AmazonS3Client(new\
210
+ \ BasicAWSCredentials(accessKey, secretKey));\n p = Pattern.compile(\"\
211
+ s3://([^/]+)/(\\\\S+)\");\n m = p.matcher(URL);\n result\
212
+ \ = m.find();\n if (result) {\n String bucket = m.group(1);\n\
213
+ \ String key = m.group(2);\n S3Object object = s3.getObject(new\
214
+ \ GetObjectRequest(bucket, key));\n System.out.println(\"Content-Type:\
215
+ \ \" + object.getObjectMetadata().getContentType());\n output =\
216
+ \ new File((String) options.valueOf(\"output-dir\") + File.separator + key);\n\
217
+ \ output.getParentFile().mkdirs();\n if (!output.exists()\
218
+ \ || output.length() != object.getObjectMetadata().getContentLength()) {\n \
219
+ \ System.out.println(\"Downloading an S3 object from bucket: \"\
220
+ \ + bucket + \" with key: \" + key);\n BufferedInputStream\
221
+ \ reader = new BufferedInputStream(object.getObjectContent(), bufLen);\n \
222
+ \ try {\n BufferedOutputStream writer = new\
223
+ \ BufferedOutputStream(new FileOutputStream(output), bufLen);\n \
224
+ \ while (true) {\n int data = reader.read();\n\
225
+ \ if (data == -1) {\n \
226
+ \ break;\n }\n writer.write(data);\n\
227
+ \ }\n reader.close();\n \
228
+ \ writer.close();\n } catch (FileNotFoundException\
229
+ \ e) {\n System.err.println(e.getMessage());\n \
230
+ \ } catch (IOException e) {\n System.err.println(e.getMessage());\n\
231
+ \ }\n } else {\n System.out.println(\"\
232
+ Skipping download of S3 object from bucket: \" + bucket + \" with key: \" + key\
233
+ \ + \" since local output exists: \" + output.getAbsolutePath());\n \
234
+ \ }\n }\n } else if (((String) options.valueOf(\"input-file\"\
235
+ )).startsWith(\"http://\") || ((String) options.valueOf(\"input-file\")).startsWith(\"\
236
+ https://\")) {\n Pattern p = Pattern.compile(\"(https*)://(\\\\S+):(\\\
237
+ \\S+)@(\\\\S+)\");\n Matcher m = p.matcher((String) options.valueOf(\"\
238
+ input-file\"));\n boolean result = m.find();\n String protocol\
239
+ \ = null;\n String user = null;\n String pass = null;\n\
240
+ \ String URL = (String) options.valueOf(\"input-file\");\n \
241
+ \ if (result) {\n protocol = m.group(1);\n user\
242
+ \ = m.group(2);\n pass = m.group(3);\n URL = protocol\
243
+ \ + \"://\" + m.group(4);\n }\n URL urlObj = null;\n \
244
+ \ try {\n urlObj = new URL(URL);\n if (urlObj\
245
+ \ != null) {\n URLConnection urlConn = urlObj.openConnection();\n\
246
+ \ if (user != null && pass != null) {\n \
247
+ \ String userPassword = user + \":\" + pass;\n String\
248
+ \ encoding = new Base64().encodeBase64String(userPassword.getBytes());\n \
249
+ \ urlConn.setRequestProperty(\"Authorization\", \"Basic \" +\
250
+ \ encoding);\n }\n p = Pattern.compile(\"\
251
+ ://([^/]+)/(\\\\S+)\");\n m = p.matcher(URL);\n \
252
+ \ result = m.find();\n if (result) {\n \
253
+ \ String host = m.group(1);\n String path =\
254
+ \ m.group(2);\n output = new File((String) options.valueOf(\"\
255
+ output-dir\") + path);\n output.getParentFile().mkdirs();\n\
256
+ \ if (!output.exists() || output.length() != urlConn.getContentLength())\
257
+ \ {\n System.out.println(\"Downloading an http object\
258
+ \ from URL: \" + URL);\n BufferedInputStream reader\
259
+ \ = new BufferedInputStream(urlConn.getInputStream(), bufLen);\n \
260
+ \ BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream(output),\
261
+ \ bufLen);\n while (true) {\n \
262
+ \ int data = reader.read();\n if (data\
263
+ \ == -1) {\n break;\n \
264
+ \ }\n writer.write(data);\n \
265
+ \ }\n reader.close();\n \
266
+ \ writer.close();\n } else {\n \
267
+ \ System.out.println(\"Skipping download of http object from\
268
+ \ URL: \" + URL + \" since local output exists: \" + output.getAbsolutePath());\n\
269
+ \ }\n }\n }\n \
270
+ \ } catch (MalformedURLException e) {\n System.err.println(e.getMessage());\n\
271
+ \ } catch (IOException e) {\n System.err.println(e.getMessage());\n\
272
+ \ }\n } else {\n output = new File((String) options.valueOf(\"\
273
+ input-file\"));\n }\n boolean result = FileTools.unzipFile(output,\
274
+ \ new File((String) options.valueOf(\"output-dir\")));\n if (!result) {\n\
275
+ \ ret.setStderr(\"Can't unzip software bundle \" + options.valueOf(\"\
276
+ input-file\") + \" to directory \" + options.valueOf(\"output-dir\"));\n \
277
+ \ ret.setExitStatus(ReturnValue.RUNTIMEEXCEPTION);\n }\n return\
278
+ \ (ret);\n }\n"
279
+ - " public void writeConfigurationFile() throws IOException, ComponentException\
280
+ \ {\n SystemConfig config = parent.getParentSystem().getConfiguration();\n\
281
+ \ File original = config.getLocation();\n File backup = new File(original.getParentFile(),\
282
+ \ original.getName() + \".\" + System.currentTimeMillis());\n FileInputStream\
283
+ \ in = new FileInputStream(original);\n FileOutputStream out = new FileOutputStream(backup);\n\
284
+ \ byte[] buffer = new byte[2048];\n try {\n int bytesread\
285
+ \ = 0;\n while ((bytesread = in.read(buffer)) > 0) {\n \
286
+ \ out.write(buffer, 0, bytesread);\n }\n } catch (IOException\
287
+ \ e) {\n logger.warn(\"Failed to copy backup of configuration file\"\
288
+ );\n throw e;\n } finally {\n in.close();\n \
289
+ \ out.close();\n }\n FileWriter replace = new FileWriter(original);\n\
290
+ \ replace.write(config.toFileFormat());\n replace.close();\n \
291
+ \ logger.info(\"Re-wrote configuration file \" + original.getPath());\n \
292
+ \ }\n"
293
+ - " @Override\n protected void doGet(HttpServletRequest req, HttpServletResponse\
294
+ \ resp) throws ServletException, IOException {\n resp.addHeader(\"Cache-Control\"\
295
+ , \"max-age=\" + Constants.HTTP_CACHE_SECONDS);\n String uuid = req.getRequestURI().substring(req.getRequestURI().indexOf(Constants.SERVLET_FULL_PREFIX)\
296
+ \ + Constants.SERVLET_FULL_PREFIX.length() + 1);\n boolean notScale = ClientUtils.toBoolean(req.getParameter(Constants.URL_PARAM_NOT_SCALE));\n\
297
+ \ ServletOutputStream os = resp.getOutputStream();\n if (uuid !=\
298
+ \ null && !\"\".equals(uuid)) {\n try {\n String mimetype\
299
+ \ = fedoraAccess.getMimeTypeForStream(uuid, FedoraUtils.IMG_FULL_STREAM);\n \
300
+ \ if (mimetype == null) {\n mimetype = \"image/jpeg\"\
301
+ ;\n }\n ImageMimeType loadFromMimeType = ImageMimeType.loadFromMimeType(mimetype);\n\
302
+ \ if (loadFromMimeType == ImageMimeType.JPEG || loadFromMimeType\
303
+ \ == ImageMimeType.PNG) {\n StringBuffer sb = new StringBuffer();\n\
304
+ \ sb.append(config.getFedoraHost()).append(\"/objects/\").append(uuid).append(\"\
305
+ /datastreams/IMG_FULL/content\");\n InputStream is = RESTHelper.get(sb.toString(),\
306
+ \ config.getFedoraLogin(), config.getFedoraPassword(), false);\n \
307
+ \ if (is == null) {\n return;\n \
308
+ \ }\n try {\n IOUtils.copyStreams(is,\
309
+ \ os);\n } catch (IOException e) {\n \
310
+ \ resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND);\n \
311
+ \ LOGGER.error(\"Unable to open full image.\", e);\n } finally\
312
+ \ {\n os.flush();\n if (is != null)\
313
+ \ {\n try {\n is.close();\n\
314
+ \ } catch (IOException e) {\n \
315
+ \ resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND);\n \
316
+ \ LOGGER.error(\"Unable to close stream.\", e);\n \
317
+ \ } finally {\n is = null;\n \
318
+ \ }\n }\n }\n\
319
+ \ } else {\n Image rawImg = KrameriusImageSupport.readImage(uuid,\
320
+ \ FedoraUtils.IMG_FULL_STREAM, this.fedoraAccess, 0, loadFromMimeType);\n \
321
+ \ BufferedImage scaled = null;\n if (!notScale)\
322
+ \ {\n scaled = KrameriusImageSupport.getSmallerImage(rawImg,\
323
+ \ 1250, 1000);\n } else {\n scaled =\
324
+ \ KrameriusImageSupport.getSmallerImage(rawImg, 2500, 2000);\n \
325
+ \ }\n KrameriusImageSupport.writeImageToStream(scaled,\
326
+ \ \"JPG\", os);\n resp.setContentType(ImageMimeType.JPEG.getValue());\n\
327
+ \ resp.setStatus(HttpURLConnection.HTTP_OK);\n \
328
+ \ }\n } catch (IOException e) {\n resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND);\n\
329
+ \ LOGGER.error(\"Unable to open full image.\", e);\n \
330
+ \ } catch (XPathExpressionException e) {\n resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND);\n\
331
+ \ LOGGER.error(\"Unable to create XPath expression.\", e);\n \
332
+ \ } finally {\n os.flush();\n }\n }\n\
333
+ \ }\n"
334
+ - source_sentence: " public static boolean insert(final Cargo cargo) {\n \
335
+ \ int result = 0;\n final Connection c = DBConnection.getConnection();\n\
336
+ \ PreparedStatement pst = null;\n if (c == null) {\n \
337
+ \ return false;\n }\n try {\n c.setAutoCommit(false);\n\
338
+ \ final String sql = \"insert into cargo (nome) values (?)\";\n \
339
+ \ pst = c.prepareStatement(sql);\n pst.setString(1, cargo.getNome());\n\
340
+ \ result = pst.executeUpdate();\n c.commit();\n }\
341
+ \ catch (final SQLException e) {\n try {\n c.rollback();\n\
342
+ \ } catch (final SQLException e1) {\n e1.printStackTrace();\n\
343
+ \ }\n System.out.println(\"[CargoDAO.insert] Erro ao inserir\
344
+ \ -> \" + e.getMessage());\n } finally {\n DBConnection.closePreparedStatement(pst);\n\
345
+ \ DBConnection.closeConnection(c);\n }\n if (result >\
346
+ \ 0) {\n return true;\n } else {\n return false;\n\
347
+ \ }\n }\n"
348
+ sentences:
349
+ - " public String md5sum(String toCompute) throws Exception {\n MessageDigest\
350
+ \ md = MessageDigest.getInstance(\"MD5\");\n md.update(toCompute.getBytes());\n\
351
+ \ java.math.BigInteger hash = new java.math.BigInteger(1, md.digest());\n\
352
+ \ return hash.toString(16);\n }\n"
353
+ - " protected void runTest(URL pBaseURL, String pName, String pHref) throws Exception\
354
+ \ {\n URL url = new URL(pBaseURL, pHref);\n XSParser parser = new\
355
+ \ XSParser();\n parser.setValidating(false);\n InputSource isource\
356
+ \ = new InputSource(url.openStream());\n isource.setSystemId(url.toString());\n\
357
+ \ String result;\n try {\n parser.parse(isource);\n \
358
+ \ ++numOk;\n result = \"Ok\";\n } catch (Exception\
359
+ \ e) {\n ++numFailed;\n result = e.getMessage();\n \
360
+ \ }\n log(\"Running test \" + pName + \" with URL \" + url + \": \" +\
361
+ \ result);\n }\n"
362
+ - " public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException\
363
+ \ {\n ZipFile zip = new ZipFile(mapPackFile);\n try {\n \
364
+ \ Enumeration<? extends ZipEntry> entries = zip.entries();\n MessageDigest\
365
+ \ md5Total = MessageDigest.getInstance(\"MD5\");\n MessageDigest md5\
366
+ \ = MessageDigest.getInstance(\"MD5\");\n while (entries.hasMoreElements())\
367
+ \ {\n ZipEntry entry = entries.nextElement();\n \
368
+ \ if (entry.isDirectory()) continue;\n String name = entry.getName();\n\
369
+ \ if (name.toUpperCase().startsWith(\"META-INF\")) continue;\n\
370
+ \ md5.reset();\n InputStream in = zip.getInputStream(entry);\n\
371
+ \ byte[] data = Utilities.getInputBytes(in);\n in.close();\n\
372
+ \ byte[] digest = md5.digest(data);\n log.trace(\"\
373
+ Hashsum \" + Hex.encodeHexString(digest) + \" includes \\\"\" + name + \"\\\"\"\
374
+ );\n md5Total.update(digest);\n md5Total.update(name.getBytes());\n\
375
+ \ }\n String md5sum = Hex.encodeHexString(md5Total.digest());\n\
376
+ \ log.trace(\"md5sum of \" + mapPackFile.getName() + \": \" + md5sum);\n\
377
+ \ return md5sum;\n } finally {\n zip.close();\n \
378
+ \ }\n }\n"
379
+ pipeline_tag: sentence-similarity
380
+ library_name: sentence-transformers
381
+ metrics:
382
+ - pearson_cosine
383
+ - spearman_cosine
384
+ model-index:
385
+ - name: SentenceTransformer based on Shuu12121/CodeModernBERT-Owl
386
+ results:
387
+ - task:
388
+ type: semantic-similarity
389
+ name: Semantic Similarity
390
+ dataset:
391
+ name: val
392
+ type: val
393
+ metrics:
394
+ - type: pearson_cosine
395
+ value: 0.9481467499740959
396
+ name: Pearson Cosine
397
+ - type: spearman_cosine
398
+ value: 0.5635084463158045
399
+ name: Spearman Cosine
400
+ ---
401
+
402
+ # SentenceTransformer based on Shuu12121/CodeModernBERT-Owl
403
+
404
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Shuu12121/CodeModernBERT-Owl](https://huggingface.co/Shuu12121/CodeModernBERT-Owl). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
405
+
406
+ ## Model Details
407
+
408
+ ### Model Description
409
+ - **Model Type:** Sentence Transformer
410
+ - **Base model:** [Shuu12121/CodeModernBERT-Owl](https://huggingface.co/Shuu12121/CodeModernBERT-Owl) <!-- at revision c6b9f919885bc8b27718df3af11dc0fbed7e2b63 -->
411
+ - **Maximum Sequence Length:** 2048 tokens
412
+ - **Output Dimensionality:** 768 dimensions
413
+ - **Similarity Function:** Cosine Similarity
414
+ <!-- - **Training Dataset:** Unknown -->
415
+ <!-- - **Language:** Unknown -->
416
+ <!-- - **License:** Unknown -->
417
+
418
+ ### Model Sources
419
+
420
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
421
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
422
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
423
+
424
+ ### Full Model Architecture
425
+
426
+ ```
427
+ SentenceTransformer(
428
+ (0): Transformer({'max_seq_length': 2048, 'do_lower_case': False}) with Transformer model: ModernBertModel
429
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
430
+ )
431
+ ```
432
+
433
+ ## Usage
434
+
435
+ ### Direct Usage (Sentence Transformers)
436
+
437
+ First install the Sentence Transformers library:
438
+
439
+ ```bash
440
+ pip install -U sentence-transformers
441
+ ```
442
+
443
+ Then you can load this model and run inference.
444
+ ```python
445
+ from sentence_transformers import SentenceTransformer
446
+
447
+ # Download from the 🤗 Hub
448
+ model = SentenceTransformer("sentence_transformers_model_id")
449
+ # Run inference
450
+ sentences = [
451
+ ' public static boolean insert(final Cargo cargo) {\n int result = 0;\n final Connection c = DBConnection.getConnection();\n PreparedStatement pst = null;\n if (c == null) {\n return false;\n }\n try {\n c.setAutoCommit(false);\n final String sql = "insert into cargo (nome) values (?)";\n pst = c.prepareStatement(sql);\n pst.setString(1, cargo.getNome());\n result = pst.executeUpdate();\n c.commit();\n } catch (final SQLException e) {\n try {\n c.rollback();\n } catch (final SQLException e1) {\n e1.printStackTrace();\n }\n System.out.println("[CargoDAO.insert] Erro ao inserir -> " + e.getMessage());\n } finally {\n DBConnection.closePreparedStatement(pst);\n DBConnection.closeConnection(c);\n }\n if (result > 0) {\n return true;\n } else {\n return false;\n }\n }\n',
452
+ ' protected void runTest(URL pBaseURL, String pName, String pHref) throws Exception {\n URL url = new URL(pBaseURL, pHref);\n XSParser parser = new XSParser();\n parser.setValidating(false);\n InputSource isource = new InputSource(url.openStream());\n isource.setSystemId(url.toString());\n String result;\n try {\n parser.parse(isource);\n ++numOk;\n result = "Ok";\n } catch (Exception e) {\n ++numFailed;\n result = e.getMessage();\n }\n log("Running test " + pName + " with URL " + url + ": " + result);\n }\n',
453
+ ' public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException {\n ZipFile zip = new ZipFile(mapPackFile);\n try {\n Enumeration<? extends ZipEntry> entries = zip.entries();\n MessageDigest md5Total = MessageDigest.getInstance("MD5");\n MessageDigest md5 = MessageDigest.getInstance("MD5");\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n if (entry.isDirectory()) continue;\n String name = entry.getName();\n if (name.toUpperCase().startsWith("META-INF")) continue;\n md5.reset();\n InputStream in = zip.getInputStream(entry);\n byte[] data = Utilities.getInputBytes(in);\n in.close();\n byte[] digest = md5.digest(data);\n log.trace("Hashsum " + Hex.encodeHexString(digest) + " includes \\"" + name + "\\"");\n md5Total.update(digest);\n md5Total.update(name.getBytes());\n }\n String md5sum = Hex.encodeHexString(md5Total.digest());\n log.trace("md5sum of " + mapPackFile.getName() + ": " + md5sum);\n return md5sum;\n } finally {\n zip.close();\n }\n }\n',
454
+ ]
455
+ embeddings = model.encode(sentences)
456
+ print(embeddings.shape)
457
+ # [3, 768]
458
+
459
+ # Get the similarity scores for the embeddings
460
+ similarities = model.similarity(embeddings, embeddings)
461
+ print(similarities.shape)
462
+ # [3, 3]
463
+ ```
464
+
465
+ <!--
466
+ ### Direct Usage (Transformers)
467
+
468
+ <details><summary>Click to see the direct usage in Transformers</summary>
469
+
470
+ </details>
471
+ -->
472
+
473
+ <!--
474
+ ### Downstream Usage (Sentence Transformers)
475
+
476
+ You can finetune this model on your own dataset.
477
+
478
+ <details><summary>Click to expand</summary>
479
+
480
+ </details>
481
+ -->
482
+
483
+ <!--
484
+ ### Out-of-Scope Use
485
+
486
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
487
+ -->
488
+
489
+ ## Evaluation
490
+
491
+ ### Metrics
492
+
493
+ #### Semantic Similarity
494
+
495
+ * Dataset: `val`
496
+ * Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
497
+
498
+ | Metric | Value |
499
+ |:--------------------|:-----------|
500
+ | pearson_cosine | 0.9481 |
501
+ | **spearman_cosine** | **0.5635** |
502
+
503
+ <!--
504
+ ## Bias, Risks and Limitations
505
+
506
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
507
+ -->
508
+
509
+ <!--
510
+ ### Recommendations
511
+
512
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
513
+ -->
514
+
515
+ ## Training Details
516
+
517
+ ### Training Dataset
518
+
519
+ #### Unnamed Dataset
520
+
521
+ * Size: 901,028 training samples
522
+ * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>
523
+ * Approximate statistics based on the first 1000 samples:
524
+ | | sentence_0 | sentence_1 | label |
525
+ |:--------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------|
526
+ | type | string | string | float |
527
+ | details | <ul><li>min: 52 tokens</li><li>mean: 332.69 tokens</li><li>max: 2048 tokens</li></ul> | <ul><li>min: 54 tokens</li><li>mean: 353.29 tokens</li><li>max: 2048 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.49</li><li>max: 1.0</li></ul> |
528
+ * Samples:
529
+ | sentence_0 | sentence_1 | label |
530
+ |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
531
+ | <code> public static Image load(final InputStream input, String format, Point dimension) throws CoreException {<br> MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);<br> File dotInput = null, dotOutput = null;<br> ByteArrayOutputStream dotContents = new ByteArrayOutputStream();<br> try {<br> dotInput = File.createTempFile(TMP_FILE_PREFIX, DOT_EXTENSION);<br> dotOutput = File.createTempFile(TMP_FILE_PREFIX, "." + format);<br> dotOutput.delete();<br> FileOutputStream tmpDotOutputStream = null;<br> try {<br> IOUtils.copy(input, dotContents);<br> tmpDotOutputStream = new FileOutputStream(dotInput);<br> IOUtils.copy(new ByteArrayInputStream(dotContents.toByteArray()), tmpDotOutputStream);<br> } finally {<br> IOUtils.closeQuietly(tmpDotOutputStream);<br> }<br> IStatus result = runDot(format, dimension, dotInp...</code> | <code> public final Matrix3D<E> read(final URL url) throws IOException {<br> if (url == null) {<br> throw new IllegalArgumentException("url must not be null");<br> }<br> InputStream inputStream = null;<br> try {<br> inputStream = url.openStream();<br> return read(inputStream);<br> } catch (IOException e) {<br> throw e;<br> } finally {<br> MatrixIOUtils.closeQuietly(inputStream);<br> }<br> }<br></code> | <code>0.0</code> |
532
+ | <code> public List<PathObject> fetchPath(BoardObject board) throws NetworkException {<br> if (boardPathMap.containsKey(board.getId())) {<br> return boardPathMap.get(board.getId()).getChildren();<br> }<br> HttpClient client = HttpConfig.newInstance();<br> HttpGet get = new HttpGet(HttpConfig.bbsURL() + HttpConfig.BBS_0AN_BOARD + board.getId());<br> try {<br> HttpResponse response = client.execute(get);<br> HttpEntity entity = response.getEntity();<br> Document doc = XmlOperator.readDocument(entity.getContent());<br> PathObject parent = new PathObject();<br> BBSBodyParseHelper.parsePathList(doc, parent);<br> parent = searchAndCreatePathFromRoot(parent);<br> boardPathMap.put(board.getId(), parent);<br> return parent.getChildren();<br> } catch (Exception e) {<br> e.printStackTrace();<br> throw new NetworkException(e);<br> }<br> }<br></code> | <code> public static void readDefault() {<br> ClassLoader l = Skeleton.class.getClassLoader();<br> URL url;<br> if (l != null) {<br> url = l.getResource(DEFAULT_LOC);<br> } else {<br> url = ClassLoader.getSystemResource(DEFAULT_LOC);<br> }<br> if (url == null) {<br> Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);<br> throw new GeneratorException();<br> }<br> try {<br> InputStreamReader reader = new InputStreamReader(url.openStream());<br> readSkel(new BufferedReader(reader));<br> } catch (IOException e) {<br> Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);<br> throw new GeneratorException();<br> }<br> }<br></code> | <code>0.0</code> |
533
+ | <code> public boolean copyFile(File source, File dest) {<br> try {<br> FileReader in = new FileReader(source);<br> FileWriter out = new FileWriter(dest);<br> int c;<br> while ((c = in.read()) != -1) out.write(c);<br> in.close();<br> out.close();<br> return true;<br> } catch (Exception e) {<br> return false;<br> }<br> }<br></code> | <code> public static boolean encodeFileToFile(String infile, String outfile) {<br> boolean success = false;<br> java.io.InputStream in = null;<br> java.io.OutputStream out = null;<br> try {<br> in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.ENCODE);<br> out = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile));<br> byte[] buffer = new byte[65536];<br> int read = -1;<br> while ((read = in.read(buffer)) >= 0) {<br> out.write(buffer, 0, read);<br> }<br> success = true;<br> } catch (java.io.IOException exc) {<br> exc.printStackTrace();<br> } finally {<br> try {<br> in.close();<br> } catch (Exception exc) {<br> }<br> try {<br> out.close();<br> } catch (Exception exc) {<br> }<br> }<br> return success;<br> }<br></code> | <code>1.0</code> |
534
+ * Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
535
+ ```json
536
+ {
537
+ "loss_fct": "torch.nn.modules.loss.MSELoss"
538
+ }
539
+ ```
540
+
541
+ ### Training Hyperparameters
542
+ #### Non-Default Hyperparameters
543
+
544
+ - `eval_strategy`: steps
545
+ - `per_device_train_batch_size`: 32
546
+ - `per_device_eval_batch_size`: 32
547
+ - `num_train_epochs`: 1
548
+ - `fp16`: True
549
+ - `multi_dataset_batch_sampler`: round_robin
550
+
551
+ #### All Hyperparameters
552
+ <details><summary>Click to expand</summary>
553
+
554
+ - `overwrite_output_dir`: False
555
+ - `do_predict`: False
556
+ - `eval_strategy`: steps
557
+ - `prediction_loss_only`: True
558
+ - `per_device_train_batch_size`: 32
559
+ - `per_device_eval_batch_size`: 32
560
+ - `per_gpu_train_batch_size`: None
561
+ - `per_gpu_eval_batch_size`: None
562
+ - `gradient_accumulation_steps`: 1
563
+ - `eval_accumulation_steps`: None
564
+ - `torch_empty_cache_steps`: None
565
+ - `learning_rate`: 5e-05
566
+ - `weight_decay`: 0.0
567
+ - `adam_beta1`: 0.9
568
+ - `adam_beta2`: 0.999
569
+ - `adam_epsilon`: 1e-08
570
+ - `max_grad_norm`: 1
571
+ - `num_train_epochs`: 1
572
+ - `max_steps`: -1
573
+ - `lr_scheduler_type`: linear
574
+ - `lr_scheduler_kwargs`: {}
575
+ - `warmup_ratio`: 0.0
576
+ - `warmup_steps`: 0
577
+ - `log_level`: passive
578
+ - `log_level_replica`: warning
579
+ - `log_on_each_node`: True
580
+ - `logging_nan_inf_filter`: True
581
+ - `save_safetensors`: True
582
+ - `save_on_each_node`: False
583
+ - `save_only_model`: False
584
+ - `restore_callback_states_from_checkpoint`: False
585
+ - `no_cuda`: False
586
+ - `use_cpu`: False
587
+ - `use_mps_device`: False
588
+ - `seed`: 42
589
+ - `data_seed`: None
590
+ - `jit_mode_eval`: False
591
+ - `use_ipex`: False
592
+ - `bf16`: False
593
+ - `fp16`: True
594
+ - `fp16_opt_level`: O1
595
+ - `half_precision_backend`: auto
596
+ - `bf16_full_eval`: False
597
+ - `fp16_full_eval`: False
598
+ - `tf32`: None
599
+ - `local_rank`: 0
600
+ - `ddp_backend`: None
601
+ - `tpu_num_cores`: None
602
+ - `tpu_metrics_debug`: False
603
+ - `debug`: []
604
+ - `dataloader_drop_last`: False
605
+ - `dataloader_num_workers`: 0
606
+ - `dataloader_prefetch_factor`: None
607
+ - `past_index`: -1
608
+ - `disable_tqdm`: False
609
+ - `remove_unused_columns`: True
610
+ - `label_names`: None
611
+ - `load_best_model_at_end`: False
612
+ - `ignore_data_skip`: False
613
+ - `fsdp`: []
614
+ - `fsdp_min_num_params`: 0
615
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
616
+ - `tp_size`: 0
617
+ - `fsdp_transformer_layer_cls_to_wrap`: None
618
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
619
+ - `deepspeed`: None
620
+ - `label_smoothing_factor`: 0.0
621
+ - `optim`: adamw_torch
622
+ - `optim_args`: None
623
+ - `adafactor`: False
624
+ - `group_by_length`: False
625
+ - `length_column_name`: length
626
+ - `ddp_find_unused_parameters`: None
627
+ - `ddp_bucket_cap_mb`: None
628
+ - `ddp_broadcast_buffers`: False
629
+ - `dataloader_pin_memory`: True
630
+ - `dataloader_persistent_workers`: False
631
+ - `skip_memory_metrics`: True
632
+ - `use_legacy_prediction_loop`: False
633
+ - `push_to_hub`: False
634
+ - `resume_from_checkpoint`: None
635
+ - `hub_model_id`: None
636
+ - `hub_strategy`: every_save
637
+ - `hub_private_repo`: None
638
+ - `hub_always_push`: False
639
+ - `gradient_checkpointing`: False
640
+ - `gradient_checkpointing_kwargs`: None
641
+ - `include_inputs_for_metrics`: False
642
+ - `include_for_metrics`: []
643
+ - `eval_do_concat_batches`: True
644
+ - `fp16_backend`: auto
645
+ - `push_to_hub_model_id`: None
646
+ - `push_to_hub_organization`: None
647
+ - `mp_parameters`:
648
+ - `auto_find_batch_size`: False
649
+ - `full_determinism`: False
650
+ - `torchdynamo`: None
651
+ - `ray_scope`: last
652
+ - `ddp_timeout`: 1800
653
+ - `torch_compile`: False
654
+ - `torch_compile_backend`: None
655
+ - `torch_compile_mode`: None
656
+ - `dispatch_batches`: None
657
+ - `split_batches`: None
658
+ - `include_tokens_per_second`: False
659
+ - `include_num_input_tokens_seen`: False
660
+ - `neftune_noise_alpha`: None
661
+ - `optim_target_modules`: None
662
+ - `batch_eval_metrics`: False
663
+ - `eval_on_start`: False
664
+ - `use_liger_kernel`: False
665
+ - `eval_use_gather_object`: False
666
+ - `average_tokens_across_devices`: False
667
+ - `prompts`: None
668
+ - `batch_sampler`: batch_sampler
669
+ - `multi_dataset_batch_sampler`: round_robin
670
+
671
+ </details>
672
+
673
+ ### Training Logs
674
+ | Epoch | Step | Training Loss | val_spearman_cosine |
675
+ |:------:|:-----:|:-------------:|:-------------------:|
676
+ | 0.0178 | 500 | 0.1622 | - |
677
+ | 0.0355 | 1000 | 0.0124 | 0.5702 |
678
+ | 0.0533 | 1500 | 0.0087 | - |
679
+ | 0.0710 | 2000 | 0.0064 | 0.5686 |
680
+ | 0.0888 | 2500 | 0.0048 | - |
681
+ | 0.1065 | 3000 | 0.0046 | 0.5753 |
682
+ | 0.1243 | 3500 | 0.0036 | - |
683
+ | 0.1421 | 4000 | 0.0039 | 0.5745 |
684
+ | 0.1598 | 4500 | 0.0036 | - |
685
+ | 0.1776 | 5000 | 0.0035 | 0.5637 |
686
+ | 0.1953 | 5500 | 0.0036 | - |
687
+ | 0.2131 | 6000 | 0.0027 | 0.5615 |
688
+ | 0.2308 | 6500 | 0.002 | - |
689
+ | 0.2486 | 7000 | 0.0019 | 0.5660 |
690
+ | 0.2664 | 7500 | 0.0017 | - |
691
+ | 0.2841 | 8000 | 0.0017 | 0.5622 |
692
+ | 0.3019 | 8500 | 0.0019 | - |
693
+ | 0.3196 | 9000 | 0.0017 | 0.5583 |
694
+ | 0.3374 | 9500 | 0.0012 | - |
695
+ | 0.3551 | 10000 | 0.0013 | 0.5547 |
696
+ | 0.3729 | 10500 | 0.0015 | - |
697
+ | 0.3907 | 11000 | 0.0011 | 0.5631 |
698
+ | 0.4084 | 11500 | 0.0012 | - |
699
+ | 0.4262 | 12000 | 0.0013 | 0.5630 |
700
+ | 0.4439 | 12500 | 0.001 | - |
701
+ | 0.4617 | 13000 | 0.0009 | 0.5607 |
702
+ | 0.4794 | 13500 | 0.0007 | - |
703
+ | 0.4972 | 14000 | 0.001 | 0.5590 |
704
+ | 0.5150 | 14500 | 0.001 | - |
705
+ | 0.5327 | 15000 | 0.0009 | 0.5572 |
706
+ | 0.5505 | 15500 | 0.0007 | - |
707
+ | 0.5682 | 16000 | 0.0006 | 0.5607 |
708
+ | 0.5860 | 16500 | 0.0007 | - |
709
+ | 0.6037 | 17000 | 0.0006 | 0.5675 |
710
+ | 0.6215 | 17500 | 0.0007 | - |
711
+ | 0.6392 | 18000 | 0.0009 | 0.5610 |
712
+ | 0.6570 | 18500 | 0.0008 | - |
713
+ | 0.6748 | 19000 | 0.0007 | 0.5583 |
714
+ | 0.6925 | 19500 | 0.0006 | - |
715
+ | 0.7103 | 20000 | 0.0006 | 0.5662 |
716
+ | 0.7280 | 20500 | 0.0007 | - |
717
+ | 0.7458 | 21000 | 0.0005 | 0.5659 |
718
+ | 0.7635 | 21500 | 0.0004 | - |
719
+ | 0.7813 | 22000 | 0.0006 | 0.5667 |
720
+ | 0.7991 | 22500 | 0.0006 | - |
721
+ | 0.8168 | 23000 | 0.0006 | 0.5644 |
722
+ | 0.8346 | 23500 | 0.0005 | - |
723
+ | 0.8523 | 24000 | 0.0003 | 0.5629 |
724
+ | 0.8701 | 24500 | 0.0005 | - |
725
+ | 0.8878 | 25000 | 0.0005 | 0.5642 |
726
+ | 0.9056 | 25500 | 0.0006 | - |
727
+ | 0.9234 | 26000 | 0.0006 | 0.5640 |
728
+ | 0.9411 | 26500 | 0.0004 | - |
729
+ | 0.9589 | 27000 | 0.0007 | 0.5634 |
730
+ | 0.9766 | 27500 | 0.0004 | - |
731
+ | 0.9944 | 28000 | 0.0005 | 0.5635 |
732
+ | 1.0 | 28158 | - | 0.5635 |
733
+
734
+
735
+ ### Framework Versions
736
+ - Python: 3.11.11
737
+ - Sentence Transformers: 4.0.1
738
+ - Transformers: 4.50.3
739
+ - PyTorch: 2.6.0+cu124
740
+ - Accelerate: 1.5.2
741
+ - Datasets: 3.5.0
742
+ - Tokenizers: 0.21.1
743
+
744
+ ## Citation
745
+
746
+ ### BibTeX
747
+
748
+ #### Sentence Transformers
749
+ ```bibtex
750
+ @inproceedings{reimers-2019-sentence-bert,
751
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
752
+ author = "Reimers, Nils and Gurevych, Iryna",
753
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
754
+ month = "11",
755
+ year = "2019",
756
+ publisher = "Association for Computational Linguistics",
757
+ url = "https://arxiv.org/abs/1908.10084",
758
+ }
759
+ ```
760
+
761
+ <!--
762
+ ## Glossary
763
+
764
+ *Clearly define terms in order to be accessible across audiences.*
765
+ -->
766
+
767
+ <!--
768
+ ## Model Card Authors
769
+
770
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
771
+ -->
772
+
773
+ <!--
774
+ ## Model Card Contact
775
+
776
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
777
+ -->
added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "</s>": 50001,
3
+ "<mask>": 50003,
4
+ "<s>": 50000,
5
+ "<unk>": 50002
6
+ }
config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attention_probs_dropout_prob": 0.1,
8
+ "bos_token_id": 50000,
9
+ "classifier_activation": "gelu",
10
+ "classifier_bias": false,
11
+ "classifier_dropout": 0.0,
12
+ "classifier_pooling": "cls",
13
+ "cls_token_id": 50281,
14
+ "decoder_bias": true,
15
+ "deterministic_flash_attn": false,
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 50001,
18
+ "global_attn_every_n_layers": 3,
19
+ "global_rope_theta": 160000.0,
20
+ "hidden_activation": "gelu",
21
+ "hidden_dropout_prob": 0.1,
22
+ "hidden_size": 768,
23
+ "initializer_cutoff_factor": 2.0,
24
+ "initializer_range": 0.02,
25
+ "intermediate_size": 3072,
26
+ "local_attention": 128,
27
+ "local_attention_rope_theta": 10000,
28
+ "local_attention_window": 128,
29
+ "local_rope_theta": 10000.0,
30
+ "max_position_embeddings": 2048,
31
+ "mlp_bias": false,
32
+ "mlp_dropout": 0.0,
33
+ "model_type": "modernbert",
34
+ "norm_bias": false,
35
+ "norm_eps": 1e-05,
36
+ "num_attention_heads": 12,
37
+ "num_hidden_layers": 12,
38
+ "pad_token_id": 0,
39
+ "reference_compile": true,
40
+ "repad_logits_with_grad": false,
41
+ "rope_theta": 160000,
42
+ "sep_token_id": 50282,
43
+ "sparse_pred_ignore_index": -100,
44
+ "sparse_prediction": false,
45
+ "torch_dtype": "float32",
46
+ "transformers_version": "4.50.3",
47
+ "type_vocab_size": 2,
48
+ "vocab_size": 50004
49
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "4.0.1",
4
+ "transformers": "4.50.3",
5
+ "pytorch": "2.6.0+cu124"
6
+ },
7
+ "prompts": {},
8
+ "default_prompt_name": null,
9
+ "similarity_fn_name": "cosine"
10
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f1f72bbfe8d3f5de1ac4763808bb610c40aaddcc39905532d47928deb1aecfc
3
+ size 606681112
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ }
14
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 2048,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "[PAD]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "[PAD]",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "[UNK]",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "[CLS]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "[SEP]",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "[MASK]",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "50000": {
45
+ "content": "<s>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "50001": {
53
+ "content": "</s>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "50002": {
61
+ "content": "<unk>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "50003": {
69
+ "content": "<mask>",
70
+ "lstrip": true,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ }
76
+ },
77
+ "bos_token": "<s>",
78
+ "clean_up_tokenization_spaces": false,
79
+ "cls_token": "<s>",
80
+ "eos_token": "</s>",
81
+ "errors": "replace",
82
+ "extra_special_tokens": {},
83
+ "mask_token": "<mask>",
84
+ "max_length": null,
85
+ "model_max_length": 1000000000000000019884624838656,
86
+ "pad_to_multiple_of": null,
87
+ "pad_token": "[PAD]",
88
+ "pad_token_type_id": 0,
89
+ "padding_side": "right",
90
+ "sep_token": "</s>",
91
+ "stride": 0,
92
+ "tokenizer_class": "RobertaTokenizer",
93
+ "trim_offsets": true,
94
+ "truncation_side": "right",
95
+ "truncation_strategy": "longest_first",
96
+ "unk_token": "<unk>"
97
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff