Sentence Similarity
sentence-transformers
Safetensors
roberta
feature-extraction
dense
Generated from Trainer
dataset_size:10000
loss:CosineSimilarityLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use wraithklu/codesentinel-clone-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use wraithklu/codesentinel-clone-detector with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("wraithklu/codesentinel-clone-detector") sentences = [ "private void createTree(DefaultMutableTreeNode top) throws MalformedURLException, ParserConfigurationException, SAXException, IOException {\n InputStream stream;\n URL url = new URL(SHIPS_URL + view.getBaseurl());\n try {\n stream = url.openStream();\n } catch (Exception e) {\n stream = getClass().getResourceAsStream(\"ships.xml\");\n }\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n DocumentBuilder parser = factory.newDocumentBuilder();\n Document doc = parser.parse(stream);\n NodeList races = doc.getElementsByTagName(\"race\");\n for (int i = 0; i < races.getLength(); i++) {\n Element race = (Element) races.item(i);\n top.add(buildRaceTree(race));\n }\n top.setUserObject(\"Ships\");\n view.getShipTree().repaint();\n view.getShipTree().expandRow(0);\n }", "private GenomicSequence fetch(Chromosome k, int start, int end) throws IOException {\n try {\n String chr = k.toString();\n if (chr.toLowerCase().startsWith(\"chr\")) chr = chr.substring(3);\n SAXParserFactory f = SAXParserFactory.newInstance();\n f.setNamespaceAware(false);\n f.setValidating(false);\n SAXParser parser = f.newSAXParser();\n URL url = new URL(\"http://genome.ucsc.edu/cgi-bin/das/\" + genomeVersion + \"/dna?segment=\" + URLEncoder.encode(chr, \"UTF-8\") + \":\" + (start + 1) + \",\" + (end));\n DASHandler handler = new DASHandler();\n InputStream in = url.openStream();\n parser.parse(in, handler);\n in.close();\n GenomicSequence seq = new GenomicSequence();\n seq.sequence = handler.bytes.toByteArray();\n seq.start = start;\n seq.end = end;\n if (seq.sequence.length != seq.length()) throw new IOException(\"bad bound \" + seq + \" \" + seq.sequence.length + \" \" + seq.length());\n return seq;\n } catch (IOException err) {\n throw err;\n } catch (Exception e) {\n throw new IOException(e);\n }\n }", "public static void main(String[] args) throws Exception {\n FileChannel fc = new FileOutputStream(\"data.txt\").getChannel();\n fc.write(ByteBuffer.wrap(\"some text \".getBytes()));\n fc.close();\n fc = new RandomAccessFile(\"data.txt\", \"rw\").getChannel();\n fc.position(fc.size());\n fc.write(ByteBuffer.wrap(\"some more\".getBytes()));\n fc.close();\n fc = new FileInputStream(\"data.txt\").getChannel();\n ByteBuffer buff = ByteBuffer.allocate(BSIZE);\n fc.read(buff);\n buff.flip();\n while (buff.hasRemaining()) {\n PrintUtil.prt((char) buff.get());\n }\n }", "private FileLog(LOG_LEVEL displayLogLevel, LOG_LEVEL logLevel, String logPath) {\n this.logLevel = logLevel;\n this.displayLogLevel = displayLogLevel;\n if (null != logPath) {\n logFile = new File(logPath, \"current.log\");\n log(LOG_LEVEL.DEBUG, \"FileLog\", \"Initialising logfile \" + logFile.getAbsolutePath() + \" .\");\n try {\n if (logFile.exists()) {\n if (!logFile.renameTo(new File(logPath, System.currentTimeMillis() + \".log\"))) {\n File newFile = new File(logPath, System.currentTimeMillis() + \".log\");\n if (newFile.exists()) {\n log(LOG_LEVEL.WARN, \"FileLog\", \"The file (\" + newFile.getAbsolutePath() + newFile.getName() + \") already exists, will overwrite it.\");\n newFile.delete();\n }\n newFile.createNewFile();\n FileInputStream inStream = new FileInputStream(logFile);\n FileOutputStream outStream = new FileOutputStream(newFile);\n byte buffer[] = null;\n int offSet = 0;\n while (inStream.read(buffer, offSet, 2048) != -1) {\n outStream.write(buffer);\n offSet += 2048;\n }\n inStream.close();\n outStream.close();\n logFile.delete();\n logFile = new File(logPath, \"current.log\");\n }\n }\n logFile.createNewFile();\n } catch (IOException e) {\n logFile = null;\n }\n } else {\n logFile = null;\n }\n }" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Welcome to the community
The community tab is the place to discuss and collaborate with the HF community!