| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> |
| <title>MATRIX/MA DATASETS - by webXOS</title> |
| |
| |
| <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap" rel="stylesheet"> |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
| <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script> |
| <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> |
| |
| <style> |
| |
| :root { |
| --terminal-black: #000000; |
| --terminal-green: #00FF00; |
| --terminal-red: #FF0000; |
| --terminal-gray: #1E1E1E; |
| --terminal-light-gray: #2D2D2D; |
| --terminal-medium-gray: #3A3A3A; |
| --terminal-border: #7A7A7A; |
| --terminal-yellow: #FFFF00; |
| --terminal-blue: #0000FF; |
| |
| |
| --clean-bg: rgba(10, 10, 12, 0.98); |
| --clean-text: #E0E0E0; |
| --clean-accent: #00FF88; |
| --clean-border: #333344; |
| --clean-header: rgba(20, 20, 30, 0.95); |
| --hf-purple: #7C3AED; |
| } |
| |
| * { |
| margin: 0; |
| padding: 0; |
| box-sizing: border-box; |
| font-family: 'JetBrains Mono', 'Courier New', monospace; |
| -webkit-tap-highlight-color: transparent; |
| } |
| |
| body { |
| background-color: var(--terminal-black); |
| color: var(--terminal-green); |
| height: 100vh; |
| overflow: hidden; |
| display: flex; |
| flex-direction: column; |
| touch-action: manipulation; |
| } |
| |
| |
| .hf-window { |
| position: fixed; |
| top: 50%; |
| left: 50%; |
| transform: translate(-50%, -50%); |
| width: 90%; |
| max-width: 1200px; |
| height: 85%; |
| background: var(--clean-bg); |
| border: 1px solid var(--clean-border); |
| border-radius: 8px; |
| box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7); |
| display: none; |
| flex-direction: column; |
| z-index: 10000; |
| overflow: hidden; |
| } |
| |
| .hf-window.active { |
| display: flex; |
| } |
| |
| .hf-header { |
| background: var(--clean-header); |
| padding: 12px 20px; |
| border-bottom: 1px solid var(--clean-border); |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| color: var(--clean-accent); |
| font-weight: 500; |
| } |
| |
| .hf-title { |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| } |
| |
| .hf-title i { |
| color: var(--hf-purple); |
| } |
| |
| .hf-controls { |
| display: flex; |
| gap: 8px; |
| } |
| |
| .hf-btn { |
| background: rgba(124, 58, 237, 0.1); |
| border: 1px solid rgba(124, 58, 237, 0.3); |
| color: var(--hf-purple); |
| padding: 6px 12px; |
| border-radius: 4px; |
| cursor: pointer; |
| font-size: 0.8rem; |
| transition: all 0.2s; |
| } |
| |
| .hf-btn:hover { |
| background: rgba(124, 58, 237, 0.2); |
| } |
| |
| .hf-btn.primary { |
| background: rgba(0, 255, 136, 0.1); |
| border-color: rgba(0, 255, 136, 0.3); |
| color: var(--clean-accent); |
| } |
| |
| .hf-btn.danger { |
| background: rgba(255, 0, 0, 0.1); |
| border-color: rgba(255, 0, 0, 0.3); |
| color: #ff6666; |
| } |
| |
| .hf-btn.close { |
| background: rgba(255, 0, 0, 0.1); |
| border-color: rgba(255, 0, 0, 0.3); |
| color: #ff6666; |
| } |
| |
| .hf-container { |
| flex: 1; |
| display: flex; |
| overflow: hidden; |
| padding: 20px; |
| gap: 20px; |
| } |
| |
| .config-panel { |
| flex: 1; |
| display: flex; |
| flex-direction: column; |
| background: rgba(5, 5, 10, 0.8); |
| border: 1px solid var(--clean-border); |
| border-radius: 6px; |
| overflow: hidden; |
| min-width: 300px; |
| } |
| |
| .config-header { |
| padding: 10px 15px; |
| background: rgba(15, 15, 25, 0.9); |
| border-bottom: 1px solid var(--clean-border); |
| color: var(--hf-purple); |
| font-size: 0.85rem; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| |
| .config-content { |
| flex: 1; |
| padding: 15px; |
| overflow-y: auto; |
| color: var(--clean-text); |
| } |
| |
| .config-section { |
| margin-bottom: 20px; |
| padding: 10px; |
| background: rgba(20, 20, 30, 0.3); |
| border-radius: 4px; |
| } |
| |
| .section-title { |
| color: var(--hf-purple); |
| font-size: 0.9rem; |
| margin-bottom: 10px; |
| display: flex; |
| align-items: center; |
| gap: 8px; |
| } |
| |
| .config-input { |
| margin-bottom: 12px; |
| } |
| |
| .config-input label { |
| display: block; |
| font-size: 0.8rem; |
| color: var(--clean-text); |
| margin-bottom: 4px; |
| } |
| |
| .config-input input, .config-input select { |
| width: 100%; |
| background: rgba(30, 30, 40, 0.8); |
| border: 1px solid var(--clean-border); |
| color: var(--clean-text); |
| padding: 6px 10px; |
| border-radius: 3px; |
| font-size: 0.8rem; |
| } |
| |
| .config-input input:focus, .config-input select:focus { |
| outline: 1px solid var(--hf-purple); |
| } |
| |
| .slider-container { |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| } |
| |
| .slider-value { |
| min-width: 40px; |
| text-align: center; |
| font-size: 0.8rem; |
| } |
| |
| input[type="range"] { |
| flex: 1; |
| height: 4px; |
| background: rgba(30, 30, 40, 0.8); |
| border-radius: 2px; |
| outline: none; |
| -webkit-appearance: none; |
| } |
| |
| input[type="range"]::-webkit-slider-thumb { |
| -webkit-appearance: none; |
| width: 16px; |
| height: 16px; |
| background: var(--hf-purple); |
| border-radius: 50%; |
| cursor: pointer; |
| } |
| |
| .checkbox-group { |
| display: flex; |
| flex-direction: column; |
| gap: 6px; |
| margin-top: 5px; |
| } |
| |
| .checkbox-item { |
| display: flex; |
| align-items: center; |
| gap: 6px; |
| font-size: 0.8rem; |
| } |
| |
| .checkbox-item input[type="checkbox"] { |
| width: 14px; |
| height: 14px; |
| } |
| |
| .terminal-panel { |
| flex: 2; |
| display: flex; |
| flex-direction: column; |
| background: rgba(5, 5, 10, 0.8); |
| border: 1px solid var(--clean-border); |
| border-radius: 6px; |
| overflow: hidden; |
| } |
| |
| .terminal-header { |
| padding: 10px 15px; |
| background: rgba(15, 15, 25, 0.9); |
| border-bottom: 1px solid var(--clean-border); |
| color: var(--hf-purple); |
| font-size: 0.85rem; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| |
| .terminal-output { |
| flex: 1; |
| padding: 15px; |
| overflow-y: auto; |
| font-size: 0.85rem; |
| line-height: 1.4; |
| color: var(--clean-text); |
| } |
| |
| .terminal-line { |
| margin-bottom: 3px; |
| word-break: break-word; |
| white-space: pre-wrap; |
| animation: fadeIn 0.2s ease; |
| } |
| |
| .terminal-line.command { |
| color: var(--hf-purple); |
| } |
| |
| .terminal-line.output { |
| color: var(--clean-text); |
| } |
| |
| .terminal-line.error { |
| color: #ff6666; |
| } |
| |
| .terminal-line.success { |
| color: var(--clean-accent); |
| } |
| |
| .terminal-line.info { |
| color: #66ccff; |
| } |
| |
| .terminal-line.warning { |
| color: #ffcc00; |
| } |
| |
| .terminal-line.hf { |
| color: var(--hf-purple); |
| } |
| |
| .terminal-input { |
| padding: 10px 15px; |
| background: rgba(15, 15, 25, 0.9); |
| border-top: 1px solid var(--clean-border); |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| } |
| |
| .input-prompt { |
| color: var(--hf-purple); |
| font-weight: bold; |
| } |
| |
| #hfInput { |
| flex: 1; |
| background: transparent; |
| border: none; |
| color: var(--clean-text); |
| font-family: 'JetBrains Mono', monospace; |
| font-size: 0.9rem; |
| outline: none; |
| } |
| |
| .progress-container { |
| margin-top: 15px; |
| padding: 10px; |
| background: rgba(20, 20, 30, 0.5); |
| border-radius: 4px; |
| border: 1px solid var(--clean-border); |
| } |
| |
| .progress-header { |
| display: flex; |
| justify-content: space-between; |
| margin-bottom: 8px; |
| font-size: 0.8rem; |
| } |
| |
| .progress-bar { |
| height: 8px; |
| background: rgba(30, 30, 40, 0.8); |
| border-radius: 4px; |
| overflow: hidden; |
| } |
| |
| .progress-fill { |
| height: 100%; |
| background: linear-gradient(90deg, var(--hf-purple), var(--clean-accent)); |
| transition: width 0.3s ease; |
| width: 0%; |
| } |
| |
| .progress-stats { |
| display: grid; |
| grid-template-columns: repeat(2, 1fr); |
| gap: 8px; |
| margin-top: 10px; |
| font-size: 0.75rem; |
| } |
| |
| .stat-item { |
| display: flex; |
| justify-content: space-between; |
| } |
| |
| .stat-label { |
| color: #aaa; |
| } |
| |
| .stat-value { |
| color: var(--clean-text); |
| } |
| |
| |
| .loading-screen { |
| position: fixed; |
| top: 0; left: 0; width: 100%; height: 100%; |
| background: var(--terminal-black); |
| display: flex; align-items: center; justify-content: center; |
| z-index: 9999; flex-direction: column; |
| font-size: 1.2rem; |
| text-align: center; |
| } |
| |
| .webxos-logo { |
| font-size: 6rem; |
| font-weight: bold; |
| margin-bottom: 20px; |
| color: var(--hf-purple); |
| animation: glow 2s infinite alternate; |
| } |
| |
| .loading-bar { |
| width: 400px; height: 20px; |
| background: var(--terminal-light-gray); |
| margin-top: 40px; |
| border-radius: 10px; |
| overflow: hidden; |
| border: 2px solid var(--hf-purple); |
| } |
| |
| .loading-fill { |
| width: 0%; height: 100%; |
| background: var(--hf-purple); |
| transition: width 0.3s; |
| } |
| |
| |
| .taskbar { |
| height: 42px; |
| background: var(--terminal-gray); |
| border-top: 1px solid #fff; |
| display: flex; |
| align-items: center; |
| padding: 0 6px; |
| box-shadow: 0 -1px 3px rgba(0,0,0,0.5); |
| z-index: 1000; |
| position: fixed; |
| bottom: 0; |
| width: 100%; |
| } |
| |
| .start-btn { |
| background: var(--terminal-black); |
| border: 1px outset var(--hf-purple); |
| padding: 4px 14px; |
| font-weight: bold; |
| color: var(--hf-purple); |
| cursor: pointer; |
| margin-right: 8px; |
| font-size: 1rem; |
| min-height: 32px; |
| } |
| |
| .task-icon { |
| width: 32px; height: 32px; |
| background: var(--terminal-light-gray); |
| border: 1px solid var(--terminal-medium-gray); |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| cursor: pointer; |
| font-size: 1rem; |
| color: var(--hf-purple); |
| margin-right: 6px; |
| } |
| |
| .task-icon.active { |
| background: var(--hf-purple); |
| color: black; |
| } |
| |
| .clock { |
| margin-left: auto; |
| font-size: 1rem; |
| padding: 0 10px; |
| } |
| |
| |
| @media (max-width: 768px) { |
| .hf-container { |
| flex-direction: column; |
| padding: 10px; |
| } |
| |
| .hf-window { |
| width: 95%; |
| height: 90%; |
| } |
| |
| .config-panel { |
| min-width: unset; |
| } |
| |
| .webxos-logo { |
| font-size: 4rem; |
| } |
| |
| .loading-bar { |
| width: 90%; |
| } |
| } |
| |
| @keyframes fadeIn { |
| from { opacity: 0; transform: translateY(-5px); } |
| to { opacity: 1; transform: translateY(0); } |
| } |
| |
| @keyframes glow { |
| 0% { text-shadow: 0 0 10px rgba(124, 58, 237, 0.5); } |
| 100% { text-shadow: 0 0 20px rgba(124, 58, 237, 0.8), 0 0 30px rgba(124, 58, 237, 0.6); } |
| } |
| </style> |
| </head> |
| <body> |
| |
| <div class="hf-window" id="hfWindow"> |
| <div class="hf-header"> |
| <div class="hf-title"> |
| <i class="fas fa-database"></i> |
| <span>MATRIX/MA DATASETS by webXOS</span> |
| </div> |
| <div class="hf-controls"> |
| <button class="hf-btn primary" onclick="hfGenerator.generateDataset()"> |
| <i class="fas fa-play"></i> Generate Dataset |
| </button> |
| <button class="hf-btn" onclick="hfGenerator.exportDataset()" id="exportBtn" disabled> |
| <i class="fas fa-file-export"></i> Export ZIP |
| </button> |
| <button class="hf-btn close" onclick="closeHFWindow()"> |
| <i class="fas fa-times"></i> Close |
| </button> |
| </div> |
| </div> |
| <div class="hf-container"> |
| <div class="config-panel"> |
| <div class="config-header"> |
| <span>DATASET CONFIGURATION</span> |
| <span id="configStatus">READY</span> |
| </div> |
| <div class="config-content"> |
| <div class="config-section"> |
| <div class="section-title"> |
| <i class="fas fa-sliders-h"></i> |
| <span>Dataset Parameters</span> |
| </div> |
| <div class="config-input"> |
| <label>Dataset Name</label> |
| <input type="text" id="datasetName" value="matrix_operations" placeholder="Enter dataset name"> |
| </div> |
| <div class="config-input"> |
| <label>Number of Samples</label> |
| <div class="slider-container"> |
| <input type="range" id="sampleCount" min="10" max="5000" value="500" step="10"> |
| <span class="slider-value" id="sampleCountValue">500</span> |
| </div> |
| </div> |
| <div class="config-input"> |
| <label>Matrix Dimensions</label> |
| <div class="slider-container"> |
| <input type="range" id="matrixSize" min="2" max="16" value="8" step="2"> |
| <span class="slider-value" id="matrixSizeValue">8×8</span> |
| </div> |
| </div> |
| <div class="config-input"> |
| <label>Data Format</label> |
| <select id="dataFormat"> |
| <option value="jsonl">JSON Lines (.jsonl)</option> |
| <option value="csv">CSV (.csv)</option> |
| <option value="json">JSON (.json)</option> |
| </select> |
| </div> |
| <div class="config-input"> |
| <label>Train/Test Split</label> |
| <div class="slider-container"> |
| <input type="range" id="trainSplit" min="50" max="100" value="80" step="5"> |
| <span class="slider-value" id="trainSplitValue">80% Train</span> |
| </div> |
| </div> |
| </div> |
| |
| <div class="config-section"> |
| <div class="section-title"> |
| <i class="fas fa-cogs"></i> |
| <span>Operations</span> |
| </div> |
| <div class="checkbox-group"> |
| <div class="checkbox-item"> |
| <input type="checkbox" id="opMatmul" checked> |
| <label for="opMatmul">Matrix Multiplication</label> |
| </div> |
| <div class="checkbox-item"> |
| <input type="checkbox" id="opAdd" checked> |
| <label for="opAdd">Matrix Addition</label> |
| </div> |
| <div class="checkbox-item"> |
| <input type="checkbox" id="opTranspose"> |
| <label for="opTranspose">Matrix Transpose</label> |
| </div> |
| <div class="checkbox-item"> |
| <input type="checkbox" id="opInverse"> |
| <label for="opInverse">Matrix Inverse</label> |
| </div> |
| </div> |
| </div> |
| |
| <div class="config-section"> |
| <div class="section-title"> |
| <i class="fas fa-file-alt"></i> |
| <span>Metadata</span> |
| </div> |
| <div class="config-input"> |
| <label>Description</label> |
| <input type="text" id="datasetDesc" value="Synthetic matrix operations dataset for ML training" placeholder="Dataset description"> |
| </div> |
| <div class="config-input"> |
| <label>License</label> |
| <select id="datasetLicense"> |
| <option value="apache-2.0">Apache 2.0</option> |
| <option value="mit">MIT</option> |
| <option value="cc-by-4.0">CC-BY-4.0</option> |
| <option value="cc-by-sa-4.0">CC-BY-SA-4.0</option> |
| </select> |
| </div> |
| </div> |
| |
| <div class="progress-container"> |
| <div class="progress-header"> |
| <span>Generation Progress</span> |
| <span id="progressPercent">0%</span> |
| </div> |
| <div class="progress-bar"> |
| <div class="progress-fill" id="progressFill"></div> |
| </div> |
| <div class="progress-stats"> |
| <div class="stat-item"> |
| <span class="stat-label">Samples:</span> |
| <span class="stat-value" id="statSamples">0/500</span> |
| </div> |
| <div class="stat-item"> |
| <span class="stat-label">Size:</span> |
| <span class="stat-value" id="statSize">0 KB</span> |
| </div> |
| <div class="stat-item"> |
| <span class="stat-label">Time:</span> |
| <span class="stat-value" id="statTime">0s</span> |
| </div> |
| <div class="stat-item"> |
| <span class="stat-label">Format:</span> |
| <span class="stat-value" id="statFormat">jsonl</span> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| <div class="terminal-panel"> |
| <div class="terminal-header"> |
| <span>GENERATION TERMINAL</span> |
| <span id="terminalStatus">READY</span> |
| </div> |
| <div class="terminal-output" id="terminalOutput"> |
| <div class="terminal-line hf">⟩⟩ MATRIXMA DATASETS Dataset Generator v2.2</div> |
| <div class="terminal-line output">Fixed Hugging Face schema compatibility</div> |
| <div class="terminal-line output">All exports validated for HF Hub upload</div> |
| <div class="terminal-line output">Configure parameters and click "Generate Dataset"</div> |
| </div> |
| <div class="terminal-input"> |
| <div class="input-prompt">⟩⟩</div> |
| <input type="text" id="hfInput" placeholder="Enter command (help for options)..." autocomplete="off"> |
| <button class="hf-btn" onclick="hfGenerator.executeCommand()">Execute</button> |
| </div> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="loading-screen" id="loadingScreen"> |
| <div class="webxos-logo">MATRIX/MA DATASETS</div> |
| <div>v2.2 - by webXOS 2026</div> |
| <div class="loading-bar"><div class="loading-fill" id="loadingFill"></div></div> |
| </div> |
|
|
| |
| <div class="taskbar" id="taskbar" style="display: none;"> |
| <button class="start-btn" onclick="openHFWindow()">MATRIX MULTIPLIER DATASET GEN</button> |
| <div class="task-icon" onclick="openHFWindow()"> |
| <i class="fas fa-database"></i> |
| </div> |
| <div class="clock" id="clock">00:00:00</div> |
| </div> |
|
|
| <script> |
| |
| class HFDatasetGenerator { |
| constructor() { |
| this.tfReady = false; |
| this.isGenerating = false; |
| this.dataset = { train: [], test: [] }; |
| this.metadata = { |
| name: "matrix_operations", |
| description: "Synthetic matrix operations dataset", |
| license: "apache-2.0", |
| format: "jsonl", |
| generated_at: null, |
| splits: { train: 0, test: 0 } |
| }; |
| this.stats = { |
| samples: 0, |
| totalSamples: 500, |
| startTime: 0, |
| sizeKB: 0, |
| backend: 'unknown' |
| }; |
| |
| this.init(); |
| this.setupConfigListeners(); |
| } |
| |
| async init() { |
| this.printTerminal("Initializing HF Dataset Generator v2.2 (HF Schema Fixed)...", "hf"); |
| this.printTerminal("Fixed schema compatibility for Hugging Face Hub", "success"); |
| |
| try { |
| |
| try { |
| await tf.setBackend('webgl'); |
| await tf.ready(); |
| this.stats.backend = 'webgl'; |
| this.printTerminal(`✓ TensorFlow.js backend: WebGL (GPU)`, "success"); |
| } catch (webglError) { |
| this.printTerminal(`WebGL failed: ${webglError.message}`, "warning"); |
| this.printTerminal("Falling back to CPU backend...", "warning"); |
| await tf.setBackend('cpu'); |
| await tf.ready(); |
| this.stats.backend = 'cpu'; |
| this.printTerminal(`✓ TensorFlow.js backend: CPU`, "info"); |
| } |
| |
| this.tfReady = true; |
| this.printTerminal("System ready for Hugging Face compatible dataset generation", "success"); |
| this.updateStatus("IDLE"); |
| |
| } catch (error) { |
| this.printTerminal(`Initialization error: ${error.message}`, "error"); |
| } |
| } |
| |
| setupConfigListeners() { |
| |
| document.getElementById('sampleCount').addEventListener('input', (e) => { |
| const value = e.target.value; |
| document.getElementById('sampleCountValue').textContent = value; |
| this.stats.totalSamples = parseInt(value); |
| document.getElementById('statSamples').textContent = `0/${value}`; |
| }); |
| |
| document.getElementById('matrixSize').addEventListener('input', (e) => { |
| const size = e.target.value; |
| document.getElementById('matrixSizeValue').textContent = `${size}×${size}`; |
| }); |
| |
| document.getElementById('trainSplit').addEventListener('input', (e) => { |
| const value = e.target.value; |
| document.getElementById('trainSplitValue').textContent = `${value}% Train`; |
| }); |
| |
| |
| document.getElementById('dataFormat').addEventListener('change', (e) => { |
| const format = e.target.value; |
| document.getElementById('statFormat').textContent = format; |
| }); |
| } |
| |
| async generateDataset() { |
| if (this.isGenerating) { |
| this.printTerminal("Dataset generation already in progress", "warning"); |
| return; |
| } |
| |
| this.isGenerating = true; |
| this.dataset = { train: [], test: [] }; |
| this.updateStatus("GENERATING"); |
| |
| |
| const config = this.getConfig(); |
| const trainSplit = config.trainSplit; |
| const trainCount = Math.floor(config.sampleCount * (trainSplit / 100)); |
| const testCount = config.sampleCount - trainCount; |
| |
| this.metadata = { |
| name: config.name, |
| description: config.description, |
| license: config.license, |
| format: config.format, |
| generated_at: new Date().toISOString(), |
| operations: config.operations, |
| matrix_size: config.matrixSize, |
| backend: this.stats.backend, |
| splits: { train: trainCount, test: testCount } |
| }; |
| |
| this.stats = { |
| samples: 0, |
| totalSamples: config.sampleCount, |
| startTime: performance.now(), |
| sizeKB: 0, |
| backend: this.stats.backend |
| }; |
| |
| this.printTerminal(`Starting dataset generation: ${config.name}`, "hf"); |
| this.printTerminal(`Backend: ${this.stats.backend.toUpperCase()}`, "info"); |
| this.printTerminal(`Samples: ${config.sampleCount} (Train: ${trainCount}, Test: ${testCount})`, "info"); |
| this.printTerminal(`Matrix: ${config.matrixSize}×${config.matrixSize}`, "info"); |
| this.printTerminal(`Operations: ${config.operations.join(', ')}`, "info"); |
| this.printTerminal(`Format: ${config.format}`, "info"); |
| |
| |
| this.updateProgress(0); |
| document.getElementById('exportBtn').disabled = true; |
| |
| |
| for (let i = 0; i < config.sampleCount; i++) { |
| if (!this.isGenerating) break; |
| |
| const sample = await this.generateSample(config.matrixSize, config.operations); |
| |
| |
| if (i < trainCount) { |
| this.dataset.train.push(sample); |
| } else { |
| this.dataset.test.push(sample); |
| } |
| |
| this.stats.samples = i + 1; |
| |
| |
| if ((i + 1) % 10 === 0 || i === config.sampleCount - 1) { |
| const progress = ((i + 1) / config.sampleCount) * 100; |
| this.updateProgress(progress); |
| |
| |
| const elapsed = (performance.now() - this.stats.startTime) / 1000; |
| const size = this.calculateSize(); |
| document.getElementById('statTime').textContent = `${elapsed.toFixed(1)}s`; |
| document.getElementById('statSize').textContent = `${size} KB`; |
| document.getElementById('statSamples').textContent = `${i + 1}/${config.sampleCount}`; |
| |
| if ((i + 1) % 100 === 0) { |
| this.printTerminal(`Generated ${i + 1}/${config.sampleCount} samples`, "output"); |
| } |
| } |
| |
| |
| if (i % 20 === 0) await new Promise(resolve => setTimeout(resolve, 0)); |
| } |
| |
| if (this.isGenerating) { |
| const elapsed = ((performance.now() - this.stats.startTime) / 1000).toFixed(2); |
| const size = this.calculateSize(); |
| |
| this.printTerminal(`Dataset generation complete!`, "success"); |
| this.printTerminal(`✓ ${config.sampleCount} samples in ${elapsed}s`, "success"); |
| this.printTerminal(`✓ ${trainCount} train samples, ${testCount} test samples`, "success"); |
| this.printTerminal(`✓ Total size: ${size} KB`, "success"); |
| this.printTerminal(`✓ Ready for Hugging Face Hub upload`, "success"); |
| |
| this.updateStatus("COMPLETE"); |
| document.getElementById('exportBtn').disabled = false; |
| this.showDatasetSummary(); |
| } |
| |
| this.isGenerating = false; |
| } |
| |
| async generateSample(matrixSize, operations) { |
| const sampleId = `sample_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; |
| const sample = { |
| id: sampleId, |
| timestamp: new Date().toISOString(), |
| matrix_size: matrixSize, |
| operations: [] |
| }; |
| |
| |
| const matrixA = tf.randomNormal([matrixSize, matrixSize], 0, 1); |
| const matrixB = tf.randomNormal([matrixSize, matrixSize], 0, 1); |
| |
| |
| for (const op of operations) { |
| let result, time, operationData = { type: op }; |
| |
| try { |
| const start = performance.now(); |
| |
| switch(op) { |
| case 'matmul': |
| result = tf.matMul(matrixA, matrixB); |
| await result.data(); |
| time = performance.now() - start; |
| operationData.time_ms = time; |
| operationData.matrix_a = Array.from(matrixA.dataSync()); |
| operationData.matrix_b = Array.from(matrixB.dataSync()); |
| operationData.result = Array.from(result.dataSync()); |
| result.dispose(); |
| break; |
| |
| case 'add': |
| result = tf.add(matrixA, matrixB); |
| await result.data(); |
| time = performance.now() - start; |
| operationData.time_ms = time; |
| operationData.matrix_a = Array.from(matrixA.dataSync()); |
| operationData.matrix_b = Array.from(matrixB.dataSync()); |
| operationData.result = Array.from(result.dataSync()); |
| result.dispose(); |
| break; |
| |
| case 'transpose': |
| result = tf.transpose(matrixA); |
| await result.data(); |
| time = performance.now() - start; |
| operationData.time_ms = time; |
| operationData.matrix = Array.from(matrixA.dataSync()); |
| operationData.result = Array.from(result.dataSync()); |
| result.dispose(); |
| break; |
| |
| case 'inverse': |
| |
| const identity = tf.eye(matrixSize); |
| const perturbation = tf.randomNormal([matrixSize, matrixSize], 0, 0.1); |
| const invertibleMatrix = tf.add(identity, perturbation); |
| |
| try { |
| result = tf.linalg.inv(invertibleMatrix); |
| await result.data(); |
| time = performance.now() - start; |
| operationData.time_ms = time; |
| operationData.matrix = Array.from(invertibleMatrix.dataSync()); |
| operationData.result = Array.from(result.dataSync()); |
| result.dispose(); |
| } catch (invError) { |
| operationData.time_ms = time; |
| operationData.matrix = Array.from(invertibleMatrix.dataSync()); |
| operationData.result = []; |
| operationData.error = "Matrix not invertible"; |
| } |
| |
| identity.dispose(); |
| perturbation.dispose(); |
| invertibleMatrix.dispose(); |
| break; |
| } |
| |
| sample.operations.push(operationData); |
| |
| } catch (error) { |
| this.printTerminal(`Error in operation ${op}: ${error.message}`, "error"); |
| operationData.error = error.message; |
| sample.operations.push(operationData); |
| } |
| } |
| |
| |
| matrixA.dispose(); |
| matrixB.dispose(); |
| |
| return sample; |
| } |
| |
| getConfig() { |
| const selectedOps = []; |
| |
| if (document.getElementById('opMatmul').checked) selectedOps.push('matmul'); |
| if (document.getElementById('opAdd').checked) selectedOps.push('add'); |
| if (document.getElementById('opTranspose').checked) selectedOps.push('transpose'); |
| if (document.getElementById('opInverse').checked) selectedOps.push('inverse'); |
| |
| return { |
| name: document.getElementById('datasetName').value, |
| sampleCount: parseInt(document.getElementById('sampleCount').value), |
| matrixSize: parseInt(document.getElementById('matrixSize').value), |
| format: document.getElementById('dataFormat').value, |
| description: document.getElementById('datasetDesc').value, |
| license: document.getElementById('datasetLicense').value, |
| trainSplit: parseInt(document.getElementById('trainSplit').value), |
| operations: selectedOps |
| }; |
| } |
| |
| calculateSize() { |
| const allData = [...this.dataset.train, ...this.dataset.test]; |
| const jsonString = JSON.stringify(allData); |
| return (new TextEncoder().encode(jsonString).length / 1024).toFixed(2); |
| } |
| |
| async exportDataset() { |
| if (this.dataset.train.length === 0 && this.dataset.test.length === 0) { |
| this.printTerminal("No dataset to export. Generate a dataset first.", "warning"); |
| return; |
| } |
| |
| this.printTerminal("Preparing dataset for Hugging Face export...", "hf"); |
| this.updateStatus("EXPORTING"); |
| |
| const config = this.getConfig(); |
| const zip = new JSZip(); |
| |
| |
| const datasetFolder = zip.folder(config.name); |
| |
| |
| switch(config.format) { |
| case 'jsonl': |
| if (this.dataset.train.length > 0) { |
| const trainJsonl = this.dataset.train.map(s => JSON.stringify(s)).join('\n'); |
| datasetFolder.file("train.jsonl", trainJsonl); |
| } |
| if (this.dataset.test.length > 0) { |
| const testJsonl = this.dataset.test.map(s => JSON.stringify(s)).join('\n'); |
| datasetFolder.file("test.jsonl", testJsonl); |
| } |
| break; |
| |
| case 'json': |
| if (this.dataset.train.length > 0) { |
| datasetFolder.file("train.json", JSON.stringify(this.dataset.train, null, 2)); |
| } |
| if (this.dataset.test.length > 0) { |
| datasetFolder.file("test.json", JSON.stringify(this.dataset.test, null, 2)); |
| } |
| break; |
| |
| case 'csv': |
| |
| if (this.dataset.train.length > 0) { |
| const trainCsv = this.convertToCSV(this.dataset.train); |
| datasetFolder.file("train.csv", trainCsv); |
| } |
| if (this.dataset.test.length > 0) { |
| const testCsv = this.convertToCSV(this.dataset.test); |
| datasetFolder.file("test.csv", testCsv); |
| } |
| break; |
| } |
| |
| |
| const readmeContent = this.generateReadme(); |
| datasetFolder.file("README.md", readmeContent); |
| |
| const datasetCard = this.generateDatasetCard(); |
| datasetFolder.file("dataset_card.md", datasetCard); |
| |
| const metadata = { |
| ...this.metadata, |
| samples: this.dataset.train.length + this.dataset.test.length, |
| train_samples: this.dataset.train.length, |
| test_samples: this.dataset.test.length, |
| size_kb: this.calculateSize() |
| }; |
| datasetFolder.file("metadata.json", JSON.stringify(metadata, null, 2)); |
| |
| |
| const loadScript = this.generateLoadScript(config); |
| datasetFolder.file("load_dataset.py", loadScript); |
| |
| |
| try { |
| const content = await zip.generateAsync({ type: "blob" }); |
| const filename = `${config.name}_hf_dataset.zip`; |
| |
| const a = document.createElement("a"); |
| const url = URL.createObjectURL(content); |
| a.href = url; |
| a.download = filename; |
| document.body.appendChild(a); |
| a.click(); |
| document.body.removeChild(a); |
| URL.revokeObjectURL(url); |
| |
| this.printTerminal(`✓ Dataset exported as ${filename}`, "success"); |
| this.printTerminal("Ready for Hugging Face Hub upload:", "hf"); |
| this.printTerminal(" cd " + config.name, "output"); |
| this.printTerminal(" git init", "output"); |
| this.printTerminal(" git lfs install", "output"); |
| this.printTerminal(" git add .", "output"); |
| this.printTerminal(' git commit -m "Add dataset"', "output"); |
| this.printTerminal(` git push https://huggingface.co/datasets/your-username/${config.name}`, "output"); |
| |
| this.updateStatus("EXPORTED"); |
| |
| } catch (error) { |
| this.printTerminal(`Export error: ${error.message}`, "error"); |
| this.updateStatus("ERROR"); |
| } |
| } |
| |
| convertToCSV(samples) { |
| |
| const rows = []; |
| |
| |
| const headers = ['id', 'timestamp', 'matrix_size', 'operations_count']; |
| rows.push(headers.join(',')); |
| |
| |
| for (const sample of samples) { |
| const row = [ |
| `"${sample.id}"`, |
| `"${sample.timestamp}"`, |
| sample.matrix_size, |
| sample.operations.length |
| ]; |
| rows.push(row.join(',')); |
| } |
| |
| return rows.join('\n'); |
| } |
| |
| generateReadme() { |
| const config = this.getConfig(); |
| const totalSamples = this.dataset.train.length + this.dataset.test.length; |
| const totalBytes = this.calculateSize() * 1024; |
| |
| |
| return `--- |
| language: |
| - en |
| task_categories: |
| - matrix-computation |
| - synthetic-data-generation |
| tags: |
| - matrix-operations |
| - synthetic-data |
| - machine-learning |
| - mathematics |
| license: ${config.license} |
| dataset_info: |
| features: |
| - name: id |
| dtype: string |
| - name: timestamp |
| dtype: string |
| - name: matrix_size |
| dtype: int32 |
| - name: operations |
| list: |
| - name: type |
| dtype: string |
| - name: time_ms |
| dtype: float32 |
| - name: matrix_a |
| sequence: float32 |
| - name: matrix_b |
| sequence: float32 |
| - name: matrix |
| sequence: float32 |
| - name: result |
| sequence: float32 |
| - name: error |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: ${Math.round(totalBytes * (this.dataset.train.length / totalSamples))} |
| num_examples: ${this.dataset.train.length} |
| - name: test |
| num_bytes: ${Math.round(totalBytes * (this.dataset.test.length / totalSamples))} |
| num_examples: ${this.dataset.test.length} |
| download_size: ${Math.round(totalBytes)} |
| dataset_size: ${Math.round(totalBytes)} |
| pretty_name: "${config.name}" |
| size_categories: |
| - ${totalSamples < 1000 ? 'n<1K' : totalSamples < 10000 ? '1K<n<10K' : '10K<n<100K'} |
| --- |
| |
| # ${config.name} |
| |
| ${config.description} |
| |
| ## Dataset Details |
| |
| - **Generated:** ${new Date().toISOString()} |
| - **Total Samples:** ${totalSamples} |
| - **Splits:** Train (${this.dataset.train.length}), Test (${this.dataset.test.length}) |
| - **Matrix Size:** ${config.matrixSize}×${config.matrixSize} |
| - **Operations:** ${config.operations.join(', ') || 'None selected'} |
| - **Backend:** ${this.stats.backend.toUpperCase()} |
| - **Format:** ${config.format} |
| |
| ## Usage |
| |
| \`\`\`python |
| from datasets import load_dataset |
| |
| # Load the dataset |
| dataset = load_dataset("${config.name}") |
| |
| # Access train and test splits |
| train_dataset = dataset["train"] |
| test_dataset = dataset["test"] |
| \`\`\` |
| |
| ## Example |
| |
| \`\`\`python |
| import datasets |
| |
| # Load dataset |
| ds = datasets.load_dataset("${config.name}") |
| |
| # Get first example |
| example = ds["train"][0] |
| print(f"ID: {example['id']}") |
| print(f"Matrix Size: {example['matrix_size']}") |
| print(f"Operations: {len(example['operations'])}") |
| \`\`\` |
| |
| ## Citation |
| |
| If you use this dataset in research, please cite: |
| |
| \`\`\`bibtex |
| @dataset{${config.name.replace(/[^a-z0-9]/gi, '_').toLowerCase()}_${new Date().getFullYear()}, |
| title = {${config.name}}, |
| author = {Generated by HF Dataset Generator v2.2}, |
| year = {${new Date().getFullYear()}}, |
| publisher = {Hugging Face}, |
| url = {https://huggingface.co/datasets/your-username/${config.name}} |
| } |
| \`\`\` |
| |
| ## License |
| |
| ${config.license} |
| `; |
| } |
| |
| generateDatasetCard() { |
| const config = this.getConfig(); |
| const totalSamples = this.dataset.train.length + this.dataset.test.length; |
| |
| return `# Dataset Card for ${config.name} |
| |
| ## Dataset Description |
| |
| - **Homepage:** [Add homepage URL if available] |
| - **Repository:** [Add repository URL] |
| - **Point of Contact:** [Add contact name/email] |
| |
| ### Dataset Summary |
| |
| ${config.description} |
| |
| This dataset was automatically generated using the HF Dataset Generator v2.2 with TensorFlow.js backend (${this.stats.backend}). |
| |
| ### Supported Tasks |
| |
| - Matrix operation prediction |
| - Computational performance benchmarking |
| - Synthetic data for ML training |
| - Algorithm validation and testing |
| |
| ### Languages |
| |
| English |
| |
| ## Dataset Structure |
| |
| ### Data Instances |
| |
| Each instance contains: |
| - Unique sample ID |
| - Generation timestamp |
| - Matrix size (n×n) |
| - List of operations performed with: |
| - Operation type |
| - Execution time in milliseconds |
| - Input matrices |
| - Result matrices |
| - Error messages (if any) |
| |
| ### Data Fields |
| |
| - \`id\`: Unique identifier (string) |
| - \`timestamp\`: Generation timestamp (string) |
| - \`matrix_size\`: Dimension of matrices (int32) |
| - \`operations\`: List of operations performed (list of dicts) |
| |
| ### Data Splits |
| |
| - **Train:** ${this.dataset.train.length} samples |
| - **Test:** ${this.dataset.test.length} samples |
| |
| ## Dataset Creation |
| |
| ### Curation Rationale |
| |
| This dataset was created to provide synthetic matrix operation data for machine learning research, benchmarking computational kernels, and testing numerical algorithms. |
| |
| ### Source Data |
| |
| Synthetically generated using TensorFlow.js matrix operations with random normal distributions. |
| |
| ### Annotations |
| |
| No human annotations. |
| |
| ### Personal and Sensitive Information |
| |
| None. All data is synthetically generated. |
| |
| ## Considerations for Using the Data |
| |
| ### Social Impact |
| |
| This dataset enables research in computational mathematics, machine learning optimization, and numerical analysis education. |
| |
| ### Discussion of Biases |
| |
| Matrices are randomly generated from normal distributions (mean=0, std=1). Real-world matrices may have different distributions. |
| |
| ### Other Known Limitations |
| |
| 1. Matrix inverse may fail for singular matrices |
| 2. Performance timing varies by hardware (${this.stats.backend} backend) |
| 3. Limited to square matrices |
| |
| ## Additional Information |
| |
| ### Dataset Curators |
| |
| Generated automatically by HF Dataset Generator v2.2 |
| |
| ### Licensing Information |
| |
| ${config.license} License |
| |
| ### Contributions |
| |
| Thanks to TensorFlow.js and Hugging Face communities. |
| `; |
| } |
| |
| generateLoadScript(config) { |
| return `#!/usr/bin/env python3 |
| """ |
| Script to load and verify the ${config.name} dataset |
| """ |
| |
| import json |
| from pathlib import Path |
| |
| def load_and_verify_dataset(): |
| dataset_path = Path(".") |
| |
| print(f"Loading {config.name} dataset...") |
| |
| # Load train split |
| train_data = [] |
| if (dataset_path / "train.jsonl").exists(): |
| with open(dataset_path / "train.jsonl", "r") as f: |
| for line in f: |
| train_data.append(json.loads(line)) |
| print(f"Loaded {len(train_data)} train samples") |
| |
| # Load test split |
| test_data = [] |
| if (dataset_path / "test.jsonl").exists(): |
| with open(dataset_path / "test.jsonl", "r") as f: |
| for line in f: |
| test_data.append(json.loads(line)) |
| print(f"Loaded {len(test_data)} test samples") |
| |
| # Basic validation |
| print("\\nDataset Validation:") |
| print(f"Total samples: {len(train_data) + len(test_data)}") |
| |
| if train_data: |
| sample = train_data[0] |
| print(f"Sample keys: {list(sample.keys())}") |
| print(f"Matrix size: {sample.get('matrix_size')}") |
| print(f"Operations count: {len(sample.get('operations', []))}") |
| |
| print("\\nDataset ready for use!") |
| print("To upload to Hugging Face Hub:") |
| print(f" git push https://huggingface.co/datasets/your-username/{config.name}") |
| |
| if __name__ == "__main__": |
| load_and_verify_dataset() |
| `; |
| } |
| |
| showDatasetSummary() { |
| const config = this.getConfig(); |
| const size = this.calculateSize(); |
| const elapsed = ((performance.now() - this.stats.startTime) / 1000).toFixed(2); |
| const totalSamples = this.dataset.train.length + this.dataset.test.length; |
| |
| let summary = ` |
| === DATASET SUMMARY === |
| |
| Name: ${config.name} |
| Description: ${config.description} |
| Total Samples: ${totalSamples} |
| Train/Test: ${this.dataset.train.length}/${this.dataset.test.length} |
| Matrix Size: ${config.matrixSize}×${config.matrixSize} |
| Operations: ${config.operations.join(', ') || 'None'} |
| Format: ${config.format} |
| Backend: ${this.stats.backend.toUpperCase()} |
| Size: ${size} KB |
| Generation Time: ${elapsed}s |
| License: ${config.license} |
| |
| ✓ Hugging Face compatible schema |
| ✓ Ready for HF Hub upload |
| ✓ Includes train/test splits |
| ✓ Validated YAML structure |
| `.trim(); |
| |
| this.printTerminal(summary, "success"); |
| } |
| |
| |
| printTerminal(message, type = "output") { |
| const output = document.getElementById('terminalOutput'); |
| const line = document.createElement('div'); |
| line.className = `terminal-line ${type}`; |
| line.textContent = message; |
| output.appendChild(line); |
| output.scrollTop = output.scrollHeight; |
| |
| |
| const lines = output.querySelectorAll('.terminal-line'); |
| if (lines.length > 300) { |
| for (let i = 0; i < 100; i++) { |
| if (lines[i]) lines[i].remove(); |
| } |
| } |
| } |
| |
| updateStatus(text) { |
| document.getElementById('terminalStatus').textContent = text; |
| document.getElementById('configStatus').textContent = text; |
| } |
| |
| updateProgress(percent) { |
| document.getElementById('progressFill').style.width = `${percent}%`; |
| document.getElementById('progressPercent').textContent = `${Math.round(percent)}%`; |
| } |
| |
| executeCommand() { |
| const input = document.getElementById('hfInput'); |
| const command = input.value.trim().toLowerCase(); |
| |
| if (!command) return; |
| |
| this.printTerminal(`⟩⟩ ${command}`, "command"); |
| |
| switch(command) { |
| case 'generate': |
| case 'gen': |
| this.generateDataset(); |
| break; |
| case 'export': |
| case 'zip': |
| this.exportDataset(); |
| break; |
| case 'clear': |
| this.clearTerminal(); |
| break; |
| case 'help': |
| this.showHelp(); |
| break; |
| case 'status': |
| this.showStatus(); |
| break; |
| case 'stop': |
| this.stopGeneration(); |
| break; |
| case 'schema': |
| this.printTerminal("Using correct Hugging Face YAML schema with 'list' and 'sequence' types", "info"); |
| break; |
| default: |
| this.printTerminal(`Unknown command: ${command}`, "error"); |
| this.printTerminal("Type 'help' for available commands", "info"); |
| } |
| |
| input.value = ''; |
| input.focus(); |
| } |
| |
| showHelp() { |
| const help = ` |
| Available Commands: |
| ------------------- |
| generate / gen - Generate dataset with current configuration |
| export / zip - Export dataset as ZIP (HF compatible) |
| stop - Stop dataset generation |
| status - Show generation status |
| schema - Show schema information |
| clear - Clear terminal |
| help - Show this help message |
| `.trim(); |
| |
| help.split('\n').forEach(line => { |
| this.printTerminal(line, "output"); |
| }); |
| } |
| |
| showStatus() { |
| let status = `Generation Status: ${this.isGenerating ? 'RUNNING' : 'IDLE'}\n`; |
| status += `TensorFlow Backend: ${this.stats.backend.toUpperCase()}\n`; |
| status += `Samples Generated: ${this.dataset.train.length + this.dataset.test.length}\n`; |
| status += `Train Samples: ${this.dataset.train.length}\n`; |
| status += `Test Samples: ${this.dataset.test.length}\n`; |
| |
| if (this.dataset.train.length > 0) { |
| const config = this.getConfig(); |
| status += `\nCurrent Configuration:\n`; |
| status += `- Name: ${config.name}\n`; |
| status += `- Matrix Size: ${config.matrixSize}×${config.matrixSize}\n`; |
| status += `- Format: ${config.format}\n`; |
| status += `- Operations: ${config.operations.join(', ') || 'None'}\n`; |
| status += `- Train Split: ${config.trainSplit}%\n`; |
| } |
| |
| this.printTerminal(status, "output"); |
| } |
| |
| stopGeneration() { |
| if (this.isGenerating) { |
| this.isGenerating = false; |
| this.printTerminal("Dataset generation stopped by user", "warning"); |
| this.updateStatus("STOPPED"); |
| } else { |
| this.printTerminal("No generation in progress", "info"); |
| } |
| } |
| |
| clearTerminal() { |
| document.getElementById('terminalOutput').innerHTML = ` |
| <div class="terminal-line hf">⟩⟩ Hugging Face Dataset Generator v2.2</div> |
| <div class="terminal-line output">Fixed Hugging Face schema compatibility</div> |
| <div class="terminal-line output">All exports validated for HF Hub upload</div> |
| <div class="terminal-line output">Terminal cleared</div> |
| `; |
| } |
| } |
| |
| |
| let hfGenerator = null; |
| |
| function openHFWindow() { |
| document.getElementById('hfWindow').classList.add('active'); |
| if (!hfGenerator) { |
| hfGenerator = new HFDatasetGenerator(); |
| } |
| } |
| |
| function closeHFWindow() { |
| document.getElementById('hfWindow').classList.remove('active'); |
| } |
| |
| document.addEventListener('DOMContentLoaded', function() { |
| |
| const loadingFill = document.getElementById('loadingFill'); |
| const loadingScreen = document.getElementById('loadingScreen'); |
| const taskbar = document.getElementById('taskbar'); |
| |
| let loadProgress = 0; |
| const loadInterval = setInterval(() => { |
| loadProgress += 2; |
| loadingFill.style.width = loadProgress + '%'; |
| |
| if (loadProgress >= 100) { |
| clearInterval(loadInterval); |
| setTimeout(() => { |
| loadingScreen.style.display = 'none'; |
| taskbar.style.display = 'flex'; |
| hfGenerator = new HFDatasetGenerator(); |
| |
| |
| setTimeout(() => { |
| openHFWindow(); |
| }, 300); |
| }, 500); |
| } |
| }, 30); |
| |
| |
| function updateClock() { |
| const now = new Date(); |
| const time = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' }); |
| document.getElementById('clock').textContent = time; |
| } |
| setInterval(updateClock, 1000); |
| updateClock(); |
| |
| |
| document.addEventListener('keydown', (e) => { |
| |
| if (e.ctrlKey && e.key === 'g') { |
| e.preventDefault(); |
| if (hfGenerator) hfGenerator.generateDataset(); |
| } |
| |
| |
| if (e.ctrlKey && e.key === 'e') { |
| e.preventDefault(); |
| if (hfGenerator) hfGenerator.exportDataset(); |
| } |
| |
| |
| if (e.key === 'Escape') { |
| closeHFWindow(); |
| } |
| |
| |
| if (e.key.length === 1 && !e.ctrlKey && !e.metaKey) { |
| const input = document.getElementById('hfInput'); |
| if (document.getElementById('hfWindow').classList.contains('active')) { |
| input.focus(); |
| } |
| } |
| }); |
| |
| |
| const hfInput = document.getElementById('hfInput'); |
| hfInput.addEventListener('keypress', (e) => { |
| if (e.key === 'Enter') { |
| if (hfGenerator) hfGenerator.executeCommand(); |
| } |
| }); |
| |
| |
| document.getElementById('sampleCount').dispatchEvent(new Event('input')); |
| document.getElementById('matrixSize').dispatchEvent(new Event('input')); |
| document.getElementById('trainSplit').dispatchEvent(new Event('input')); |
| }); |
| </script> |
| </body> |
| </html> |
|
|