1456995462
Implemented a full-stack web application for fine-tuning LLMs on email data, optimized for Apple Silicon (M4 Pro with 24GB RAM). Features: - Mail import with drag & drop support (.mbox, .eml, .txt) - Automated mail cleaning and preprocessing - Interactive labeling interface with keyboard shortcuts - Training data export to JSONL format - MLX-based LoRA fine-tuning with live updates - Model evaluation and comparison interface - Server-Sent Events for real-time training progress - Dark theme UI optimized for extended use Technical Stack: - Backend: FastAPI with SQLite database - Frontend: Vanilla HTML/CSS/JavaScript (no external dependencies) - ML Framework: MLX for Apple Silicon optimization - Models: Support for Mistral 7B and Llama 3 8B via MLX Components: - data_manager.py: SQLite operations for mail storage and labeling - mail_parser.py: Parser for multiple mail formats with cleaning - training.py: MLX training wrapper with LoRA support - inference.py: Model loading and inference for evaluation - main.py: FastAPI backend with REST API and SSE - Frontend: Complete UI with all features Documentation: - Comprehensive README with installation and usage guide - Quick-start guide for rapid setup - Example mails for testing - Troubleshooting and best practices Ready for local deployment and fine-tuning workflows.
601 lines
10 KiB
CSS
601 lines
10 KiB
CSS
/* Mail Fine-Tuning App Styles */
|
|
|
|
:root {
|
|
--bg-primary: #1a1a1a;
|
|
--bg-secondary: #2d2d2d;
|
|
--bg-tertiary: #3a3a3a;
|
|
--text-primary: #e0e0e0;
|
|
--text-secondary: #b0b0b0;
|
|
--accent-primary: #4a9eff;
|
|
--accent-success: #4caf50;
|
|
--accent-warning: #ff9800;
|
|
--accent-danger: #f44336;
|
|
--border-color: #444;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: var(--bg-primary);
|
|
color: var(--text-primary);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.app-container {
|
|
display: flex;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Sidebar */
|
|
.sidebar {
|
|
width: 250px;
|
|
background: var(--bg-secondary);
|
|
padding: 2rem 1rem;
|
|
border-right: 1px solid var(--border-color);
|
|
}
|
|
|
|
.sidebar h1 {
|
|
font-size: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
color: var(--accent-primary);
|
|
}
|
|
|
|
.nav-menu {
|
|
list-style: none;
|
|
}
|
|
|
|
.nav-link {
|
|
display: block;
|
|
padding: 0.75rem 1rem;
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
border-radius: 4px;
|
|
margin-bottom: 0.5rem;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.nav-link:hover {
|
|
background: var(--bg-tertiary);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.nav-link.active {
|
|
background: var(--accent-primary);
|
|
color: white;
|
|
}
|
|
|
|
/* Main Content */
|
|
.main-content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 2rem;
|
|
}
|
|
|
|
.view {
|
|
display: none;
|
|
}
|
|
|
|
.view.active {
|
|
display: block;
|
|
}
|
|
|
|
h2 {
|
|
margin-bottom: 1.5rem;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
h3 {
|
|
margin-bottom: 1rem;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
padding: 0.6rem 1.2rem;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 0.9rem;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--accent-primary);
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #3a8eef;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: var(--bg-tertiary);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: #4a4a4a;
|
|
}
|
|
|
|
.btn-success {
|
|
background: var(--accent-success);
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: var(--accent-danger);
|
|
color: white;
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Upload Section */
|
|
.dropzone {
|
|
border: 2px dashed var(--border-color);
|
|
border-radius: 8px;
|
|
padding: 3rem;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.dropzone:hover {
|
|
border-color: var(--accent-primary);
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
.dropzone.dragover {
|
|
border-color: var(--accent-primary);
|
|
background: var(--bg-tertiary);
|
|
}
|
|
|
|
.hint {
|
|
font-size: 0.85rem;
|
|
color: var(--text-secondary);
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
/* Section Header */
|
|
.section-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
/* Mail List */
|
|
.mail-list {
|
|
background: var(--bg-secondary);
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
max-height: 500px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.mail-item {
|
|
background: var(--bg-tertiary);
|
|
padding: 1rem;
|
|
margin-bottom: 0.5rem;
|
|
border-radius: 4px;
|
|
border-left: 3px solid transparent;
|
|
}
|
|
|
|
.mail-item.labeled {
|
|
border-left-color: var(--accent-success);
|
|
}
|
|
|
|
.mail-item.unlabeled {
|
|
border-left-color: var(--accent-warning);
|
|
}
|
|
|
|
.mail-item.skip {
|
|
border-left-color: var(--text-secondary);
|
|
}
|
|
|
|
.mail-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.mail-subject {
|
|
font-weight: bold;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.mail-meta {
|
|
font-size: 0.85rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.mail-body {
|
|
font-size: 0.9rem;
|
|
color: var(--text-secondary);
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
}
|
|
|
|
.mail-actions {
|
|
margin-top: 0.5rem;
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.mail-actions button {
|
|
padding: 0.4rem 0.8rem;
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
/* Labeling Interface */
|
|
#labeling-container {
|
|
background: var(--bg-secondary);
|
|
border-radius: 8px;
|
|
padding: 2rem;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
.current-mail {
|
|
background: var(--bg-tertiary);
|
|
padding: 1.5rem;
|
|
border-radius: 4px;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
color: var(--text-primary);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-group input,
|
|
.form-group select,
|
|
.form-group textarea {
|
|
width: 100%;
|
|
padding: 0.6rem;
|
|
background: var(--bg-primary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 4px;
|
|
color: var(--text-primary);
|
|
font-family: inherit;
|
|
}
|
|
|
|
.form-group textarea {
|
|
resize: vertical;
|
|
min-height: 100px;
|
|
}
|
|
|
|
.form-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
/* Progress Bar */
|
|
.progress-bar {
|
|
background: var(--bg-secondary);
|
|
border-radius: 4px;
|
|
height: 30px;
|
|
position: relative;
|
|
margin-bottom: 1rem;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-fill {
|
|
background: var(--accent-primary);
|
|
height: 100%;
|
|
transition: width 0.3s;
|
|
}
|
|
|
|
.progress-text {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
font-weight: bold;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
/* Keyboard Hints */
|
|
.keyboard-hints {
|
|
font-size: 0.85rem;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
kbd {
|
|
background: var(--bg-tertiary);
|
|
padding: 0.2rem 0.5rem;
|
|
border-radius: 3px;
|
|
border: 1px solid var(--border-color);
|
|
font-family: monospace;
|
|
}
|
|
|
|
/* Stats Grid */
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.stat-card {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
text-align: center;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 2rem;
|
|
font-weight: bold;
|
|
color: var(--accent-primary);
|
|
}
|
|
|
|
.stat-label {
|
|
color: var(--text-secondary);
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
/* Export Section */
|
|
.export-section {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.export-controls {
|
|
display: flex;
|
|
gap: 1rem;
|
|
align-items: center;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.export-controls input {
|
|
width: 80px;
|
|
padding: 0.4rem;
|
|
background: var(--bg-primary);
|
|
border: 1px solid var(--border-color);
|
|
color: var(--text-primary);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
#export-result {
|
|
margin-top: 1rem;
|
|
padding: 1rem;
|
|
background: var(--bg-tertiary);
|
|
border-radius: 4px;
|
|
display: none;
|
|
}
|
|
|
|
#export-result.show {
|
|
display: block;
|
|
}
|
|
|
|
/* Models List */
|
|
.models-list {
|
|
background: var(--bg-secondary);
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.model-item {
|
|
background: var(--bg-tertiary);
|
|
padding: 1rem;
|
|
margin-bottom: 0.5rem;
|
|
border-radius: 4px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.model-download {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.info-text {
|
|
color: var(--text-secondary);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.code-example {
|
|
background: var(--bg-primary);
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
font-family: monospace;
|
|
color: var(--accent-primary);
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
/* Training Status */
|
|
.training-status {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
margin: 1.5rem 0;
|
|
}
|
|
|
|
.status-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
|
|
.status-item {
|
|
background: var(--bg-tertiary);
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.status-item label {
|
|
display: block;
|
|
color: var(--text-secondary);
|
|
font-size: 0.85rem;
|
|
margin-bottom: 0.3rem;
|
|
}
|
|
|
|
.status-item .value {
|
|
font-size: 1.2rem;
|
|
font-weight: bold;
|
|
color: var(--accent-primary);
|
|
}
|
|
|
|
/* Training Charts */
|
|
.training-charts {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 1.5rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.chart-container {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.chart-container h4 {
|
|
margin-bottom: 1rem;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
canvas {
|
|
width: 100% !important;
|
|
height: 200px !important;
|
|
}
|
|
|
|
/* Evaluation */
|
|
.comparison-results {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 1.5rem;
|
|
margin-top: 1.5rem;
|
|
}
|
|
|
|
.result-box {
|
|
background: var(--bg-secondary);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.result-content {
|
|
background: var(--bg-primary);
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
min-height: 150px;
|
|
white-space: pre-wrap;
|
|
font-family: monospace;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
/* Filter Controls */
|
|
.filter-controls {
|
|
display: flex;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.filter-controls select {
|
|
padding: 0.5rem;
|
|
background: var(--bg-tertiary);
|
|
border: 1px solid var(--border-color);
|
|
color: var(--text-primary);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* Toast Notifications */
|
|
#toast-container {
|
|
position: fixed;
|
|
top: 1rem;
|
|
right: 1rem;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.toast {
|
|
background: var(--bg-secondary);
|
|
border: 1px solid var(--border-color);
|
|
border-left: 4px solid var(--accent-primary);
|
|
padding: 1rem 1.5rem;
|
|
border-radius: 4px;
|
|
margin-bottom: 0.5rem;
|
|
min-width: 300px;
|
|
animation: slideIn 0.3s ease;
|
|
}
|
|
|
|
.toast.success {
|
|
border-left-color: var(--accent-success);
|
|
}
|
|
|
|
.toast.error {
|
|
border-left-color: var(--accent-danger);
|
|
}
|
|
|
|
.toast.warning {
|
|
border-left-color: var(--accent-warning);
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
transform: translateX(400px);
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
transform: translateX(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
/* Scrollbar */
|
|
::-webkit-scrollbar {
|
|
width: 8px;
|
|
height: 8px;
|
|
}
|
|
|
|
::-webkit-scrollbar-track {
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
background: var(--bg-tertiary);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb:hover {
|
|
background: #4a4a4a;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
.sidebar {
|
|
width: 200px;
|
|
}
|
|
|
|
.comparison-results,
|
|
.training-charts {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.stats-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|