Sentence Similarity
sentence-transformers
Safetensors
plbart
feature-extraction
Generated from Trainer
dataset_size:33411
loss:BatchAllTripletLoss
Instructions to use buelfhood/SOCO-Java-PLBART-ST with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use buelfhood/SOCO-Java-PLBART-ST with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("buelfhood/SOCO-Java-PLBART-ST") sentences = [ "\nimport java.io.*;\nimport java.net.*;\n\npublic class Copier\n{\n private URL target;\n\n public Copier( String fileName)\n {\n try\n {\n String line;\n BufferedReader ;\n\t BufferedWriter bout;\n target = new URL( \"http://www.cs.rmit.edu./students\");\n\t InputStream hm = target.openStream();\n\t HttpURLConnection urlcon = ( HttpURLConnection) target.openConnection();\n bf = new BufferedReader( new InputStreamReader( target.openStream()));\n\t bout = new BufferedWriter(new FileWriter(fileName));\n while((line = bf.readLine()) != null)\n {\n bout.write( line+\"\\n\"); \n }\n\t \n\t bout.print();\n }\n catch( Exception e)\n {\n System.out.println(\"Something wrong! \"+e);\n System.exit(0);\n }\n }\n public static void main (String[] args)\n {\n Copier c = new Copier(\"response.html\");\n }\n}\n\n \n \n\n \n\n\n \n\n\t\n", "import java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class Dictionary\n{\n\tpublic static void main (String args[])\n\t{\n\t\t\n\t\t\n Calendar cal = Calendar.getInstance();\n Date now=cal.getTime();\n double startTime = now.getTime();\n\n\t\tString password=getPassword(startTime);\n\t\tSystem.out.println(\"The password is \" + password);\n\t}\n\n\tpublic static String getPassword(double startTime)\n\t{\n\t\tString password=\"\";\n\t\tint requests=0;\n\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tFileReader fRead = new FileReader(\"/usr/share/lib/dict/words\");\n\t\t\tBufferedReader buf = new BufferedReader(fRead);\n\n\t\t\tpassword=buf.readLine();\n\n\t\t\twhile (password != null)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (password.length()<=3)\n\t\t\t\t{\n\t\t\t\t\trequests++;\n\t\t\t\t\tif (testPassword(password, startTime, requests))\n\t\t\t\t\t\treturn password;\n\t\t\t\t}\n\n\t\t\t\tpassword = buf.readLine();\n\n\t\t\t}\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\n\t\t}\n\n\t\treturn password;\n\t}\n\n\tprivate static boolean testPassword(String password, double startTime, int requests)\n\t{\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\t\n\t\t\tURL url=new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n\n\t\t\tHttpURLConnection connection;\n\n \t\tString userPassword = \":\" + password;\n\n \t\t\n \t\tString encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tconnection = (HttpURLConnection) url.openConnection();\n\t\t\t\t\n\t\t\t\tconnection.setRequestProperty(\"Authorization\", \" \" + encoding);\n\n\t\t\t\t\n\t\t\t\tint status=connection.getResponseCode();\n\n\t\t\t\tSystem.out.println(password + requests);\n\n\t\t\t\tif (status==200)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"It took \" + getTime(startTime) + \" milliseconds find the password.\");\n\t\t\t\t\tSystem.out.println(\" were \" + requests + \" requests .\");\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\tcatch (IOException ioe)\n\t\t\t{\n\t\t\t\tSystem.out.print(ioe);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\n\t\tcatch (IOException MalformedURLException)\n\t\t{\n\t\t\tSystem.out.print(\"Invalid URL\");\n\t\t\treturn false;\n\t\t}\n\t}\n\n\n\tprivate static double getTime(double startTime)\n\t{\n\t\t\n\t\t\n Calendar cal = Calendar.getInstance();\n Date now=cal.getTime();\n double endTime = now.getTime();\n\n return endTime-startTime;\n\n\t}\n\n}\n", "import java.io.*;\nimport java.net.*;\nimport java.util.*;\nimport java.*;\n\n\npublic class WatchDog {\n\n\npublic static final int interval = 79200000;\n\npublic static void main(String[] args) {\n WatchDog wd = new WatchDog();\n Thread thread = new Thread();\n URLConnection conn = null;\n DataInputStream data = null;\n DataInputStream in = null;\n String line;\n String lines;\n String buffer = new String();\n String buffers = new String();\n String url = new String(\"http://www.cs.rmit.edu./students/\");\n boolean change;\n\ttry{\n\tURL myurl = new URL(url);\n conn = myurl.openConnection();\n conn.connect();\n Object content = null;\n \n System.out.println(\"Connection opened......\");\n System.out.println(\"Retrieving data from URL\");\n data = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n System.out.println(\" data from the URL......\");\n content = myurl.getContent();\n BufferedReader reader = null;\n\treader = new BufferedReader(new InputStreamReader((InputStream) content));\n\n \n while ((line = data.readLine()) != null)\n\n {\n System.out.println(line);\n FileWriter outnew = new FileWriter(\"watchdogresult.html\");\n outnew.write(line);\n }\n System.out.println(\"Waiting for any change....\");\n thread.sleep(79200000);\n conn = myurl.openConnection();\n conn.connect();\n in = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n while ((lines = in.readLine()) != null)\n {\n\n\t FileWriter newf = new FileWriter(\"watchdogresult.tmp\");\n newf.write(buffers);\n }\n\tchange = true;\n if(change);\n else{\n\tchange = false;\n \n\twd.mail();\n\t}\n}\n catch (InterruptedException e) {}\n catch (IOException e) {\n e.printStackTrace();\n String r = new String(e.getMessage());\n if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n }\n else\n System.out.println(\"Other problems\");\n }\n }\n\n\npublic void mail(){\n\n try {\n\n String from = new String(\"Watchdog Reporter\");\n String email = new String(\"@cs.rmit.edu.\");\n String subject = new String(\" is a change in \");\n\n \n URL u = new URL(\"mailto:\" + email);\n URLConnection c = u.openConnection();\n c.setDoInput(false);\n c.setDoOutput(true);\n System.out.println(\"Connecting...\");\n System.out.flush();\n c.connect();\n PrintWriter out =\n new PrintWriter(new OutputStreamWriter(c.getOutputStream()));\n\n \n out.println(\"From: \\\"\" + from + \"\\\" <\" +\n System.getProperty(\"user.name\") + \"@\" +\n InetAddress.getLocalHost().getHostName() + \">\");\n out.println(\": \" );\n out.println(\"Subject: \" + subject);\n out.println(); \n\n \n String line = new String(\"Watchdog observe that is a change in the web .\");\n out.close();\n System.out.println(\"Message sent.\");\n System.out.flush();\n }\n catch (Exception e) {\n System.err.println(e);\n }\n\n }\n\n}\n\n", "\n\n\n\n \n\n\nclass BasicAuth {\n\n public BasicAuth() {}\n\n\n private static byte[] cvtTable = {\n (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E',\n (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J',\n (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O',\n (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T',\n (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y',\n (byte)'Z',\n (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e',\n (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j',\n (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o',\n (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t',\n (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y',\n (byte)'z',\n (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',\n (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',\n (byte)'+', (byte)'/'\n };\n\n static String encode(String name,\n String passwd) {\n byte input[] = (name + \":\" + passwd).getBytes();\n byte[] output = new byte[((input.length / 3) + 1) * 4];\n int ridx = 0;\n int chunk = 0;\n\n for (int i = 0; i < input.length; i += 3) {\n int left = input.length - i;\n\n\n if (left > 2) {\n chunk = (input[i] << 16)|\n (input[i + 1] << 8) |\n input[i + 2];\n output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n output[ridx++] = cvtTable[(chunk&0x3F000) >>12];\n output[ridx++] = cvtTable[(chunk&0xFC0) >> 6];\n output[ridx++] = cvtTable[(chunk&0x3F)];\n } else if (left == 2) {\n\n chunk = (input[i] << 16) |\n (input[i + 1] << 8);\n output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n output[ridx++] = cvtTable[(chunk&0x3F000) >>12];\n output[ridx++] = cvtTable[(chunk&0xFC0) >> 6];\n output[ridx++] = '=';\n } else {\n\n chunk = input[i] << 16;\n output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n output[ridx++] = cvtTable[(chunk&0x3F000) >>12];\n output[ridx++] = '=';\n output[ridx++] = '=';\n }\n }\n return new String(output);\n }\n}" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Add new SentenceTransformer model
Browse files- 1_Pooling/config.json +10 -0
- README.md +0 -0
- config.json +33 -0
- config_sentence_transformers.json +10 -0
- model.safetensors +3 -0
- modules.json +14 -0
- sentence_bert_config.json +4 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +20 -0
- tokenizer_config.json +88 -0
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 768,
|
| 3 |
+
"pooling_mode_cls_token": false,
|
| 4 |
+
"pooling_mode_mean_tokens": true,
|
| 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
|
The diff for this file is too large to render.
See raw diff
|
|
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_dropout": 0.0,
|
| 3 |
+
"activation_function": "gelu",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"PLBartModel"
|
| 6 |
+
],
|
| 7 |
+
"attention_dropout": 0.1,
|
| 8 |
+
"bos_token_id": 0,
|
| 9 |
+
"classifier_dropout": 0.0,
|
| 10 |
+
"d_model": 768,
|
| 11 |
+
"decoder_attention_heads": 12,
|
| 12 |
+
"decoder_ffn_dim": 3072,
|
| 13 |
+
"decoder_layerdrop": 0.0,
|
| 14 |
+
"decoder_layers": 6,
|
| 15 |
+
"dropout": 0.1,
|
| 16 |
+
"encoder_attention_heads": 12,
|
| 17 |
+
"encoder_ffn_dim": 3072,
|
| 18 |
+
"encoder_layerdrop": 0.0,
|
| 19 |
+
"encoder_layers": 6,
|
| 20 |
+
"eos_token_id": 2,
|
| 21 |
+
"forced_eos_token_id": 2,
|
| 22 |
+
"init_std": 0.02,
|
| 23 |
+
"is_encoder_decoder": true,
|
| 24 |
+
"max_position_embeddings": 1024,
|
| 25 |
+
"model_type": "plbart",
|
| 26 |
+
"num_hidden_layers": 6,
|
| 27 |
+
"pad_token_id": 1,
|
| 28 |
+
"scale_embedding": true,
|
| 29 |
+
"torch_dtype": "float32",
|
| 30 |
+
"transformers_version": "4.52.4",
|
| 31 |
+
"use_cache": true,
|
| 32 |
+
"vocab_size": 50005
|
| 33 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"sentence_transformers": "4.1.0",
|
| 4 |
+
"transformers": "4.52.4",
|
| 5 |
+
"pytorch": "2.6.0+cu124"
|
| 6 |
+
},
|
| 7 |
+
"prompts": {},
|
| 8 |
+
"default_prompt_name": null,
|
| 9 |
+
"similarity_fn_name": "cosine"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd99edc3dfe621785a721e293ec659528479dd59afc84a115e63fdc4904b56bc
|
| 3 |
+
size 556911200
|
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": 512,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
sentencepiece.bpe.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f72f5d040a176945623a255484d24066f8c0da89a294359154e226efbe494b80
|
| 3 |
+
size 985833
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"__java__",
|
| 4 |
+
"__python__",
|
| 5 |
+
"__en_XX__"
|
| 6 |
+
],
|
| 7 |
+
"bos_token": "<s>",
|
| 8 |
+
"cls_token": "<s>",
|
| 9 |
+
"eos_token": "</s>",
|
| 10 |
+
"mask_token": {
|
| 11 |
+
"content": "<mask>",
|
| 12 |
+
"lstrip": true,
|
| 13 |
+
"normalized": true,
|
| 14 |
+
"rstrip": false,
|
| 15 |
+
"single_word": false
|
| 16 |
+
},
|
| 17 |
+
"pad_token": "<pad>",
|
| 18 |
+
"sep_token": "</s>",
|
| 19 |
+
"unk_token": "<unk>"
|
| 20 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<pad>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"50001": {
|
| 36 |
+
"content": "__java__",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"50002": {
|
| 44 |
+
"content": "__python__",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"50003": {
|
| 52 |
+
"content": "__en_XX__",
|
| 53 |
+
"lstrip": false,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
},
|
| 59 |
+
"50004": {
|
| 60 |
+
"content": "<mask>",
|
| 61 |
+
"lstrip": true,
|
| 62 |
+
"normalized": true,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"special": true
|
| 66 |
+
}
|
| 67 |
+
},
|
| 68 |
+
"additional_special_tokens": [
|
| 69 |
+
"__java__",
|
| 70 |
+
"__python__",
|
| 71 |
+
"__en_XX__"
|
| 72 |
+
],
|
| 73 |
+
"bos_token": "<s>",
|
| 74 |
+
"clean_up_tokenization_spaces": true,
|
| 75 |
+
"cls_token": "<s>",
|
| 76 |
+
"eos_token": "</s>",
|
| 77 |
+
"extra_special_tokens": {},
|
| 78 |
+
"language_codes": "base",
|
| 79 |
+
"mask_token": "<mask>",
|
| 80 |
+
"model_max_length": 512,
|
| 81 |
+
"pad_token": "<pad>",
|
| 82 |
+
"sep_token": "</s>",
|
| 83 |
+
"sp_model_kwargs": {},
|
| 84 |
+
"src_lang": null,
|
| 85 |
+
"tgt_lang": null,
|
| 86 |
+
"tokenizer_class": "PLBartTokenizer",
|
| 87 |
+
"unk_token": "<unk>"
|
| 88 |
+
}
|