update1
This commit is contained in:
parent
e5c9bc7fe9
commit
8f8ff4d595
|
|
@ -2,3 +2,4 @@
|
|||
!*
|
||||
!*/*
|
||||
cache_db.json
|
||||
cache_tree.json
|
||||
|
|
|
|||
|
|
@ -388,7 +388,23 @@
|
|||
const h1_element = document.getElementById('code-path');
|
||||
// h1_element.textContent = code_path.slice('src/'.length);
|
||||
// debugger;
|
||||
h1_element.textContent = project_name + "/" + code_path.slice('src/'.length);
|
||||
// let mycodepath = project_name + "/" + code_path.slice('src/'.length);
|
||||
// `?full=true#${manchor}`
|
||||
let myhtml = `<a href="tree.html?full=true#/">${project_name}</a>`;
|
||||
let myslices = code_path.slice('src/'.length).split('/')
|
||||
// debugger;
|
||||
let accpath = ""
|
||||
for (let i in myslices) {
|
||||
s = myslices[i];
|
||||
accpath += ("/" + s)
|
||||
var maccpath = accpath
|
||||
if (i != (myslices.length - 1)) {
|
||||
maccpath = accpath + "/"
|
||||
}
|
||||
myhtml += `/<a href="tree.html?full=true#${maccpath}">${s}</a>`
|
||||
}
|
||||
|
||||
h1_element.innerHTML = myhtml;
|
||||
pre_elem.className = `language-${language}`
|
||||
pre_elem.id = "mycode";
|
||||
pre_elem.setAttribute("data-src", code_path);
|
||||
|
|
@ -413,7 +429,7 @@
|
|||
}());
|
||||
</script>
|
||||
<style>
|
||||
/*
|
||||
/*
|
||||
html, body{
|
||||
background-color: transparent;
|
||||
} */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -11,6 +11,8 @@
|
|||
<title>Search Code By Comment</title>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript">
|
||||
/**
|
||||
* FlexSearch.js v0.7.31 (Bundle)
|
||||
|
|
@ -284,6 +286,7 @@
|
|||
|
||||
.codelink:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.codelink {
|
||||
|
|
@ -317,7 +320,8 @@
|
|||
html,
|
||||
body {
|
||||
/*max-width: 900px;*/
|
||||
font-family: 'Roboto', sans-serif;
|
||||
/* font-family: 'Roboto', sans-serif; */
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
||||
height: 100%;
|
||||
/* margin: 0; */
|
||||
padding: 0;
|
||||
|
|
@ -374,20 +378,15 @@
|
|||
<script src="https://cdn.jsdelivr.net/npm/prismjs@v1.x/components/prism-core.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs@v1.x/plugins/autoloader/prism-autoloader.min.js"></script>
|
||||
<header class="container">
|
||||
<h2><a id="github-link" class="github-icon"><i class="fab fa-github"></i></a> Document Index<span
|
||||
class="repository-url"> of:
|
||||
<span id="partial-repository-url"></span></span></h2>
|
||||
<h2>Document Index<span class="repository-url"> of:
|
||||
<span id="partial-repository-url"></span></span>
|
||||
<div style="float: right;">
|
||||
<a id="github-link" class="github-icon"><i class="fab fa-github"></i></a>
|
||||
<a id="brief-link" href="tree.html"><i class="bi bi-text-right"></i></a>
|
||||
</div>
|
||||
</h2>
|
||||
<!-- <div class="search-input-container"> -->
|
||||
<input type="text" id="searchInput" placeholder="Search...">
|
||||
<!-- deprecate button. use enter instead. -->
|
||||
<!-- <button id="searchButton" type="button"> -->
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search"
|
||||
viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0" />
|
||||
</svg>
|
||||
</button>
|
||||
</div> -->
|
||||
</header>
|
||||
<ul id="searchResults"></ul>
|
||||
<script type="text/javascript" defer>
|
||||
|
|
@ -457,7 +456,34 @@
|
|||
|
||||
|
||||
const data = data_var // obviously not constant.
|
||||
|
||||
const data_total_length = Object.keys(data).length;
|
||||
// debugger
|
||||
var sourceCodePaths_v = [];
|
||||
var sourceCodeIndexRanges_v = {};
|
||||
const file_total_count = Object.keys(file_mapping).length;
|
||||
for (let i = 0; i < file_total_count; i++) {
|
||||
sourceCodePaths_v.push(file_mapping[i].filepath)
|
||||
const entry_left = file_mapping[i].entry_id
|
||||
var entry_right;
|
||||
if ((i + 1) > (file_total_count - 1)) {
|
||||
entry_right = data_total_length
|
||||
}
|
||||
else {
|
||||
// console.log(i, i + 1, file_total_count)
|
||||
entry_right = file_mapping[i + 1].entry_id
|
||||
}
|
||||
if (entry_right == entry_left) {
|
||||
console.log(i, i + 1, file_total_count, entry_left, entry_right);
|
||||
debugger
|
||||
}
|
||||
sourceCodeIndexRanges_v[file_mapping[i].filepath] = {
|
||||
left: entry_left,
|
||||
right: entry_right
|
||||
}
|
||||
}
|
||||
const sourceCodePaths = sourceCodePaths_v;
|
||||
const sourceCodeIndexRanges = sourceCodeIndexRanges_v;
|
||||
|
||||
// Create a new FlexSearch instance with the required configuration
|
||||
const doc = new FlexSearch.Document({
|
||||
|
|
@ -516,21 +542,38 @@
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
const searchHighlightTerms = getHighlightTerms(searchSubTerms);
|
||||
|
||||
/*function highlightTerm(innerContent){
|
||||
var newContent = innerContent;
|
||||
for (var it of searchHighlightTerms){
|
||||
newContent = newContent.replaceAll(it, `<span class="highlight">${it}</span>`);
|
||||
}
|
||||
return newContent;
|
||||
}*/
|
||||
const results = doc.search(searchTerm, RESULT_LIMIT); // Limiting to 5 results for demonstration
|
||||
const detail_types = ["code", "comment"];
|
||||
|
||||
// Display the search results
|
||||
const searchResults = document.getElementById('searchResults');
|
||||
searchResults.innerHTML = '';
|
||||
if (searchTerm.length == 0) { return }
|
||||
var isFileSearch = false;
|
||||
|
||||
if (searchTerm.startsWith("/")) {
|
||||
if (sourceCodePaths.indexOf(searchTerm) != -1) { isFileSearch = true; }
|
||||
}
|
||||
var searchHighlightTerms;
|
||||
var results;
|
||||
|
||||
if (isFileSearch) {
|
||||
searchHighlightTerms = [];
|
||||
const queryFileRange = sourceCodeIndexRanges[searchTerm];
|
||||
var results_v = [];
|
||||
var ids = []
|
||||
for (var i = queryFileRange.left; i < queryFileRange.right; i++) {
|
||||
ids.push(i);
|
||||
}
|
||||
var it = { field: 'content', result: ids }
|
||||
results_v.push(it)
|
||||
results = results_v;
|
||||
} else {
|
||||
searchHighlightTerms = getHighlightTerms(searchSubTerms);
|
||||
results = doc.search(searchTerm, RESULT_LIMIT); // Limiting to 5 results for demonstration
|
||||
}
|
||||
// console.log(isFileSearch,results);
|
||||
|
||||
const detail_types = ["code", "comment"];
|
||||
|
||||
var searchResultItems = {};
|
||||
var searchResultItemIds = [];
|
||||
results.forEach(result => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"url": {
|
||||
"full": "https://github.com/james4ever0/CLIP",
|
||||
"partial": "james4ever0/CLIP"
|
||||
"full": "https://github.com/openai/CLIP",
|
||||
"partial": "openai/CLIP"
|
||||
},
|
||||
"file_mapping": {
|
||||
"0": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,134 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
.directory:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
:target {
|
||||
background-color: yellow !important;
|
||||
}
|
||||
|
||||
.folded::before {
|
||||
content: '\25B6';
|
||||
margin-right: 8px;
|
||||
/* Add space between marker and text */
|
||||
}
|
||||
|
||||
.expanded::before {
|
||||
content: '\25BC';
|
||||
margin-right: 8px;
|
||||
/* Add space between marker and text */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function toggleVisibility(element) {
|
||||
let mclass = element.getAttribute("class");
|
||||
if (mclass == "expanded") {
|
||||
element.setAttribute('class', 'folded');
|
||||
} else {
|
||||
element.setAttribute('class', 'expanded');
|
||||
}
|
||||
const siblings = element.parentNode.children;
|
||||
for (const sibling of siblings) {
|
||||
if (sibling !== element) {
|
||||
sibling.style.display = (sibling.style.display === 'none') ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.partial-repository-url {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<article class="markdown-body">
|
||||
<h2>Project Structure<span hierarchy="0" class="partial-repository-url"> of: openai/CLIP</span><div style="float: right;"><a href="index.html"><i class="bi bi-search"></i></a></div></h2>
|
||||
<ul>
|
||||
<li><span hierarchy="0" class="expanded" onclick="toggleVisibility(this)" ><strong class="directory" id="/"><code>CLIP</code></strong> <em>CLIP model experiments, data, and utilities</em></span><ul>
|
||||
<li><a href="index.html?q=/README.md" id="/README.md"><code>README.md</code></a> <em>CLIP feature extraction for CIFAR100 and logistic regression</em></li>
|
||||
<li><span hierarchy="1" class="expanded" onclick="toggleVisibility(this)" ><strong class="directory" id="/clip/"><code>clip</code></strong> <em>CLIP model and tokenizer downloader</em></span><ul>
|
||||
<li><a href="index.html?q=/clip/__init__.py" id="/clip/__init__.py"><code><strong>init</strong>.py</code></a> <em>Imports "clip" module functions and classes.</em></li>
|
||||
<li><a href="index.html?q=/clip/clip.py" id="/clip/clip.py"><code>clip.py</code></a> <em>CLIP model downloader and tokenizer.</em></li>
|
||||
<li><a href="index.html?q=/clip/model.py" id="/clip/model.py"><code>model.py</code></a> <em>CLIP models, deep learning, attention mechanisms, ConvNeuralNetworks, VisionTransformers.</em></li>
|
||||
<li><a href="index.html?q=/clip/simple_tokenizer.py" id="/clip/simple_tokenizer.py"><code>simple_tokenizer.py</code></a> <em>SimpleTokenizer: BPE-based text tokenization, cleaning, encoding, and decoding.</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><span hierarchy="1" class="expanded" onclick="toggleVisibility(this)" ><strong class="directory" id="/data/"><code>data</code></strong> <em>Geo-Tagged, Rendered SST2, YFCC100M Dataset Directory</em></span><ul>
|
||||
<li><a href="index.html?q=/data/country211.md" id="/data/country211.md"><code>country211.md</code></a> <em>Download, Extract & Classify Country211 Geo-Tagged Images</em></li>
|
||||
<li><a href="index.html?q=/data/rendered-sst2.md" id="/data/rendered-sst2.md"><code>rendered-sst2.md</code></a> <em>Rendered SST2 dataset: Image Classification.</em></li>
|
||||
<li><a href="index.html?q=/data/yfcc100m.md" id="/data/yfcc100m.md"><code>yfcc100m.md</code></a> <em>YFCC100M dataset: 14M+ images, Creative Commons licenses.</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="index.html?q=/hubconf.py" id="/hubconf.py"><code>hubconf.py</code></a> <em>Create CLIP model entry points, convert PIL images to tensors.</em></li>
|
||||
<li><a href="index.html?q=/model-card.md" id="/model-card.md"><code>model-card.md</code></a> <em>Multimodal AI for vision, classification, biases.</em></li>
|
||||
<li><span hierarchy="1" class="expanded" onclick="toggleVisibility(this)" ><strong class="directory" id="/notebooks/"><code>notebooks</code></strong> <em>Notebooks: Machine Learning Experiments</em></span><ul>
|
||||
<li><a href="index.html?q=/notebooks/Interacting_with_CLIP.py" id="/notebooks/Interacting_with_CLIP.py"><code>Interacting_with_CLIP.py</code></a> <em>Interacting with CLIP: Image-Text Similarity Analysis</em></li>
|
||||
<li><a href="index.html?q=/notebooks/Prompt_Engineering_for_ImageNet.py" id="/notebooks/Prompt_Engineering_for_ImageNet.py"><code>Prompt_Engineering_for_ImageNet.py</code></a> <em>Zero-shot ImageNet classification with CLIP model.</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="index.html?q=/requirements.txt" id="/requirements.txt"><code>requirements.txt</code></a> <em>Install necessary packages for project.</em></li>
|
||||
<li><a href="index.html?q=/setup.py" id="/setup.py"><code>setup.py</code></a> <em>Set up Python package 'clip' with setuptools.</em></li>
|
||||
<li><span hierarchy="1" class="expanded" onclick="toggleVisibility(this)" ><strong class="directory" id="/tests/"><code>tests</code></strong></span><ul>
|
||||
<li><a href="index.html?q=/tests/test_consistency.py" id="/tests/test_consistency.py"><code>test_consistency.py</code></a> <em>CLIP model consistency test.</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</article>
|
||||
<script type="text/javascript">
|
||||
function getQueryParams() {
|
||||
var search = window.location.search.substring(1); // Remove leading '?'
|
||||
var queryParams = {};
|
||||
search.split('&').forEach(function (pair) {
|
||||
var parts = pair.split('=');
|
||||
var key = decodeURIComponent(parts[0]);
|
||||
var value = decodeURIComponent(parts[1]);
|
||||
queryParams[key] = value;
|
||||
});
|
||||
return queryParams;
|
||||
}
|
||||
|
||||
const queryParams = getQueryParams(window.location.search);
|
||||
const show_full = queryParams.full == "true";
|
||||
if (!show_full) {
|
||||
const spans = document.querySelectorAll('span');
|
||||
for (let span of spans) {
|
||||
if (span.getAttribute("hierarchy") == '0') { continue }
|
||||
|
||||
toggleVisibility(span);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue