mcli-framework 7.12.2__py3-none-any.whl โ 7.12.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mcli-framework might be problematic. Click here for more details.
- mcli/app/__init__.py +0 -2
- mcli/app/commands_cmd.py +30 -26
- mcli/app/completion_helpers.py +5 -5
- mcli/app/init_cmd.py +10 -10
- mcli/app/lock_cmd.py +29 -24
- mcli/app/main.py +2 -8
- mcli/app/model/model.py +5 -10
- mcli/app/store_cmd.py +8 -8
- mcli/app/video/__init__.py +0 -2
- mcli/app/video/video.py +1 -14
- mcli/chat/chat.py +90 -108
- mcli/chat/command_rag.py +0 -4
- mcli/chat/enhanced_chat.py +32 -41
- mcli/chat/system_controller.py +37 -37
- mcli/chat/system_integration.py +4 -5
- mcli/cli.py +2 -3
- mcli/lib/api/api.py +4 -9
- mcli/lib/api/daemon_client.py +19 -20
- mcli/lib/api/daemon_client_local.py +1 -3
- mcli/lib/api/daemon_decorator.py +6 -6
- mcli/lib/api/mcli_decorators.py +4 -8
- mcli/lib/auth/__init__.py +0 -1
- mcli/lib/auth/auth.py +4 -5
- mcli/lib/auth/mcli_manager.py +7 -12
- mcli/lib/auth/token_util.py +5 -5
- mcli/lib/config/__init__.py +29 -1
- mcli/lib/config/config.py +0 -1
- mcli/lib/custom_commands.py +1 -1
- mcli/lib/discovery/command_discovery.py +15 -15
- mcli/lib/erd/erd.py +7 -7
- mcli/lib/files/files.py +1 -1
- mcli/lib/fs/__init__.py +31 -1
- mcli/lib/fs/fs.py +12 -13
- mcli/lib/lib.py +0 -1
- mcli/lib/logger/logger.py +7 -10
- mcli/lib/performance/optimizer.py +25 -27
- mcli/lib/performance/rust_bridge.py +22 -27
- mcli/lib/performance/uvloop_config.py +0 -1
- mcli/lib/pickles/__init__.py +0 -1
- mcli/lib/pickles/pickles.py +0 -2
- mcli/lib/secrets/commands.py +0 -2
- mcli/lib/secrets/manager.py +0 -1
- mcli/lib/secrets/repl.py +2 -3
- mcli/lib/secrets/store.py +1 -2
- mcli/lib/services/data_pipeline.py +34 -34
- mcli/lib/services/lsh_client.py +38 -40
- mcli/lib/shell/shell.py +2 -2
- mcli/lib/toml/__init__.py +0 -1
- mcli/lib/ui/styling.py +0 -1
- mcli/lib/ui/visual_effects.py +33 -41
- mcli/lib/watcher/watcher.py +0 -1
- mcli/ml/__init__.py +1 -1
- mcli/ml/api/__init__.py +1 -1
- mcli/ml/api/app.py +8 -9
- mcli/ml/api/middleware.py +10 -10
- mcli/ml/api/routers/__init__.py +1 -1
- mcli/ml/api/routers/admin_router.py +3 -3
- mcli/ml/api/routers/auth_router.py +17 -18
- mcli/ml/api/routers/backtest_router.py +2 -2
- mcli/ml/api/routers/data_router.py +2 -2
- mcli/ml/api/routers/model_router.py +14 -15
- mcli/ml/api/routers/monitoring_router.py +2 -2
- mcli/ml/api/routers/portfolio_router.py +2 -2
- mcli/ml/api/routers/prediction_router.py +10 -9
- mcli/ml/api/routers/trade_router.py +2 -2
- mcli/ml/api/routers/websocket_router.py +6 -7
- mcli/ml/api/schemas.py +2 -2
- mcli/ml/auth/__init__.py +1 -1
- mcli/ml/auth/auth_manager.py +22 -23
- mcli/ml/auth/models.py +17 -17
- mcli/ml/auth/permissions.py +17 -17
- mcli/ml/backtesting/__init__.py +1 -1
- mcli/ml/backtesting/backtest_engine.py +31 -35
- mcli/ml/backtesting/performance_metrics.py +12 -14
- mcli/ml/backtesting/run.py +1 -2
- mcli/ml/cache.py +35 -36
- mcli/ml/cli/__init__.py +1 -1
- mcli/ml/cli/main.py +21 -24
- mcli/ml/config/__init__.py +1 -1
- mcli/ml/config/settings.py +28 -29
- mcli/ml/configs/__init__.py +1 -1
- mcli/ml/configs/dvc_config.py +14 -15
- mcli/ml/configs/mlflow_config.py +12 -13
- mcli/ml/configs/mlops_manager.py +19 -21
- mcli/ml/dashboard/__init__.py +4 -4
- mcli/ml/dashboard/app.py +20 -30
- mcli/ml/dashboard/app_supabase.py +16 -19
- mcli/ml/dashboard/app_training.py +11 -14
- mcli/ml/dashboard/cli.py +2 -2
- mcli/ml/dashboard/common.py +2 -3
- mcli/ml/dashboard/components/__init__.py +1 -1
- mcli/ml/dashboard/components/charts.py +13 -11
- mcli/ml/dashboard/components/metrics.py +7 -7
- mcli/ml/dashboard/components/tables.py +12 -9
- mcli/ml/dashboard/overview.py +2 -2
- mcli/ml/dashboard/pages/__init__.py +1 -1
- mcli/ml/dashboard/pages/cicd.py +15 -18
- mcli/ml/dashboard/pages/debug_dependencies.py +7 -7
- mcli/ml/dashboard/pages/monte_carlo_predictions.py +11 -18
- mcli/ml/dashboard/pages/predictions_enhanced.py +24 -32
- mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -24
- mcli/ml/dashboard/pages/test_portfolio.py +3 -6
- mcli/ml/dashboard/pages/trading.py +16 -18
- mcli/ml/dashboard/pages/workflows.py +20 -30
- mcli/ml/dashboard/utils.py +9 -9
- mcli/ml/dashboard/warning_suppression.py +3 -3
- mcli/ml/data_ingestion/__init__.py +1 -1
- mcli/ml/data_ingestion/api_connectors.py +41 -46
- mcli/ml/data_ingestion/data_pipeline.py +36 -46
- mcli/ml/data_ingestion/stream_processor.py +43 -46
- mcli/ml/database/__init__.py +1 -1
- mcli/ml/database/migrations/env.py +2 -2
- mcli/ml/database/models.py +22 -24
- mcli/ml/database/session.py +14 -14
- mcli/ml/experimentation/__init__.py +1 -1
- mcli/ml/experimentation/ab_testing.py +45 -46
- mcli/ml/features/__init__.py +1 -1
- mcli/ml/features/ensemble_features.py +22 -27
- mcli/ml/features/recommendation_engine.py +30 -30
- mcli/ml/features/stock_features.py +29 -32
- mcli/ml/features/test_feature_engineering.py +10 -11
- mcli/ml/logging.py +4 -4
- mcli/ml/mlops/__init__.py +1 -1
- mcli/ml/mlops/data_versioning.py +29 -30
- mcli/ml/mlops/experiment_tracker.py +24 -24
- mcli/ml/mlops/model_serving.py +31 -34
- mcli/ml/mlops/pipeline_orchestrator.py +27 -35
- mcli/ml/models/__init__.py +5 -6
- mcli/ml/models/base_models.py +23 -23
- mcli/ml/models/ensemble_models.py +31 -31
- mcli/ml/models/recommendation_models.py +18 -19
- mcli/ml/models/test_models.py +14 -16
- mcli/ml/monitoring/__init__.py +1 -1
- mcli/ml/monitoring/drift_detection.py +32 -36
- mcli/ml/monitoring/metrics.py +2 -2
- mcli/ml/optimization/__init__.py +1 -1
- mcli/ml/optimization/optimize.py +1 -2
- mcli/ml/optimization/portfolio_optimizer.py +30 -32
- mcli/ml/predictions/__init__.py +1 -1
- mcli/ml/preprocessing/__init__.py +1 -1
- mcli/ml/preprocessing/data_cleaners.py +22 -23
- mcli/ml/preprocessing/feature_extractors.py +23 -26
- mcli/ml/preprocessing/ml_pipeline.py +23 -23
- mcli/ml/preprocessing/test_preprocessing.py +7 -8
- mcli/ml/scripts/populate_sample_data.py +0 -4
- mcli/ml/serving/serve.py +1 -2
- mcli/ml/tasks.py +17 -17
- mcli/ml/tests/test_integration.py +29 -30
- mcli/ml/tests/test_training_dashboard.py +21 -21
- mcli/ml/trading/__init__.py +1 -1
- mcli/ml/trading/migrations.py +5 -5
- mcli/ml/trading/models.py +21 -23
- mcli/ml/trading/paper_trading.py +16 -13
- mcli/ml/trading/risk_management.py +17 -18
- mcli/ml/trading/trading_service.py +25 -28
- mcli/ml/training/__init__.py +1 -1
- mcli/ml/training/train.py +0 -1
- mcli/public/oi/oi.py +1 -2
- mcli/self/completion_cmd.py +6 -10
- mcli/self/logs_cmd.py +19 -24
- mcli/self/migrate_cmd.py +22 -20
- mcli/self/redis_cmd.py +10 -11
- mcli/self/self_cmd.py +10 -18
- mcli/self/store_cmd.py +10 -12
- mcli/self/visual_cmd.py +9 -14
- mcli/self/zsh_cmd.py +2 -4
- mcli/workflow/daemon/async_command_database.py +23 -24
- mcli/workflow/daemon/async_process_manager.py +27 -29
- mcli/workflow/daemon/client.py +27 -33
- mcli/workflow/daemon/daemon.py +32 -36
- mcli/workflow/daemon/enhanced_daemon.py +24 -33
- mcli/workflow/daemon/process_cli.py +11 -12
- mcli/workflow/daemon/process_manager.py +23 -26
- mcli/workflow/daemon/test_daemon.py +4 -5
- mcli/workflow/dashboard/dashboard_cmd.py +0 -1
- mcli/workflow/doc_convert.py +15 -17
- mcli/workflow/gcloud/__init__.py +0 -1
- mcli/workflow/gcloud/gcloud.py +11 -8
- mcli/workflow/git_commit/ai_service.py +14 -15
- mcli/workflow/lsh_integration.py +9 -11
- mcli/workflow/model_service/client.py +26 -31
- mcli/workflow/model_service/download_and_run_efficient_models.py +10 -14
- mcli/workflow/model_service/lightweight_embedder.py +25 -35
- mcli/workflow/model_service/lightweight_model_server.py +26 -32
- mcli/workflow/model_service/lightweight_test.py +7 -10
- mcli/workflow/model_service/model_service.py +80 -91
- mcli/workflow/model_service/ollama_efficient_runner.py +14 -18
- mcli/workflow/model_service/openai_adapter.py +23 -23
- mcli/workflow/model_service/pdf_processor.py +21 -26
- mcli/workflow/model_service/test_efficient_runner.py +12 -16
- mcli/workflow/model_service/test_example.py +11 -13
- mcli/workflow/model_service/test_integration.py +3 -5
- mcli/workflow/model_service/test_new_features.py +7 -8
- mcli/workflow/notebook/converter.py +1 -1
- mcli/workflow/notebook/notebook_cmd.py +5 -6
- mcli/workflow/notebook/schema.py +0 -1
- mcli/workflow/notebook/validator.py +7 -3
- mcli/workflow/openai/openai.py +1 -2
- mcli/workflow/registry/registry.py +4 -1
- mcli/workflow/repo/repo.py +6 -7
- mcli/workflow/scheduler/cron_parser.py +16 -19
- mcli/workflow/scheduler/job.py +10 -10
- mcli/workflow/scheduler/monitor.py +15 -15
- mcli/workflow/scheduler/persistence.py +17 -18
- mcli/workflow/scheduler/scheduler.py +37 -38
- mcli/workflow/secrets/__init__.py +1 -1
- mcli/workflow/sync/test_cmd.py +0 -1
- mcli/workflow/wakatime/__init__.py +5 -9
- mcli/workflow/wakatime/wakatime.py +1 -2
- {mcli_framework-7.12.2.dist-info โ mcli_framework-7.12.4.dist-info}/METADATA +1 -1
- mcli_framework-7.12.4.dist-info/RECORD +279 -0
- mcli_framework-7.12.2.dist-info/RECORD +0 -279
- {mcli_framework-7.12.2.dist-info โ mcli_framework-7.12.4.dist-info}/WHEEL +0 -0
- {mcli_framework-7.12.2.dist-info โ mcli_framework-7.12.4.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.12.2.dist-info โ mcli_framework-7.12.4.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.12.2.dist-info โ mcli_framework-7.12.4.dist-info}/top_level.txt +0 -0
|
@@ -9,13 +9,9 @@ directly from the internet without requiring Ollama or heavy dependencies.
|
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
11
|
import shutil
|
|
12
|
-
import subprocess
|
|
13
12
|
import sys
|
|
14
|
-
import tarfile
|
|
15
|
-
import tempfile
|
|
16
13
|
import threading
|
|
17
14
|
import time
|
|
18
|
-
import zipfile
|
|
19
15
|
from pathlib import Path
|
|
20
16
|
from typing import Any, Dict, List, Optional
|
|
21
17
|
|
|
@@ -26,7 +22,6 @@ import requests
|
|
|
26
22
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
|
27
23
|
|
|
28
24
|
# Import only what we need to avoid circular imports
|
|
29
|
-
from mcli.lib.logger.logger import get_logger
|
|
30
25
|
|
|
31
26
|
# Ultra-lightweight models (under 1B parameters)
|
|
32
27
|
LIGHTWEIGHT_MODELS = {
|
|
@@ -99,7 +94,7 @@ LIGHTWEIGHT_MODELS = {
|
|
|
99
94
|
|
|
100
95
|
|
|
101
96
|
class LightweightModelDownloader:
|
|
102
|
-
"""Downloads and manages lightweight models"""
|
|
97
|
+
"""Downloads and manages lightweight models."""
|
|
103
98
|
|
|
104
99
|
def __init__(self, models_dir: str = "./lightweight_models"):
|
|
105
100
|
self.models_dir = Path(models_dir)
|
|
@@ -108,7 +103,7 @@ class LightweightModelDownloader:
|
|
|
108
103
|
self.session.headers.update({"User-Agent": "MCLI-Lightweight-Model-Server/1.0"})
|
|
109
104
|
|
|
110
105
|
def download_file(self, url: str, filepath: Path, description: str = "file") -> bool:
|
|
111
|
-
"""Download a file with progress tracking"""
|
|
106
|
+
"""Download a file with progress tracking."""
|
|
112
107
|
try:
|
|
113
108
|
print(f"๐ฅ Downloading {description}...")
|
|
114
109
|
response = self.session.get(url, stream=True)
|
|
@@ -137,7 +132,7 @@ class LightweightModelDownloader:
|
|
|
137
132
|
return False
|
|
138
133
|
|
|
139
134
|
def download_model(self, model_key: str) -> Optional[str]:
|
|
140
|
-
"""Download a complete model"""
|
|
135
|
+
"""Download a complete model."""
|
|
141
136
|
model_info = LIGHTWEIGHT_MODELS[model_key]
|
|
142
137
|
|
|
143
138
|
print(f"\n๐ Downloading {model_info['name']}...")
|
|
@@ -182,13 +177,12 @@ class LightweightModelDownloader:
|
|
|
182
177
|
self.download_file(url, filepath, file_type)
|
|
183
178
|
except Exception:
|
|
184
179
|
print(f"โ ๏ธ Optional file {file_type} not available (this is OK)")
|
|
185
|
-
pass
|
|
186
180
|
|
|
187
181
|
print(f"โ
Successfully downloaded {model_info['name']}")
|
|
188
182
|
return str(model_dir)
|
|
189
183
|
|
|
190
184
|
def get_downloaded_models(self) -> List[str]:
|
|
191
|
-
"""Get list of downloaded models"""
|
|
185
|
+
"""Get list of downloaded models."""
|
|
192
186
|
models = []
|
|
193
187
|
# Check for nested structure like prajjwal1/bert-tiny
|
|
194
188
|
for org_dir in self.models_dir.iterdir():
|
|
@@ -204,7 +198,7 @@ class LightweightModelDownloader:
|
|
|
204
198
|
|
|
205
199
|
|
|
206
200
|
class LightweightModelServer:
|
|
207
|
-
"""Lightweight model server without heavy dependencies"""
|
|
201
|
+
"""Lightweight model server without heavy dependencies."""
|
|
208
202
|
|
|
209
203
|
def __init__(self, models_dir: str = "./lightweight_models", port: int = 8080):
|
|
210
204
|
self.models_dir = Path(models_dir)
|
|
@@ -215,7 +209,7 @@ class LightweightModelServer:
|
|
|
215
209
|
self.running = False
|
|
216
210
|
|
|
217
211
|
def start_server(self):
|
|
218
|
-
"""Start the lightweight server"""
|
|
212
|
+
"""Start the lightweight server."""
|
|
219
213
|
if self.running:
|
|
220
214
|
print("โ ๏ธ Server already running")
|
|
221
215
|
return
|
|
@@ -233,7 +227,7 @@ class LightweightModelServer:
|
|
|
233
227
|
print(f"๐ API available at: http://localhost:{self.port}")
|
|
234
228
|
|
|
235
229
|
def load_existing_models(self):
|
|
236
|
-
"""Load all downloaded models into memory"""
|
|
230
|
+
"""Load all downloaded models into memory."""
|
|
237
231
|
downloaded_models = self.downloader.get_downloaded_models()
|
|
238
232
|
for model_key in downloaded_models:
|
|
239
233
|
if model_key in LIGHTWEIGHT_MODELS and model_key not in self.loaded_models:
|
|
@@ -249,7 +243,7 @@ class LightweightModelServer:
|
|
|
249
243
|
return len(self.loaded_models)
|
|
250
244
|
|
|
251
245
|
def _run_server(self):
|
|
252
|
-
"""Run the HTTP server"""
|
|
246
|
+
"""Run the HTTP server."""
|
|
253
247
|
import urllib.parse
|
|
254
248
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
255
249
|
|
|
@@ -259,7 +253,7 @@ class LightweightModelServer:
|
|
|
259
253
|
super().__init__(*args, **kwargs)
|
|
260
254
|
|
|
261
255
|
def do_GET(self):
|
|
262
|
-
"""Handle GET requests"""
|
|
256
|
+
"""Handle GET requests."""
|
|
263
257
|
parsed_path = urllib.parse.urlparse(self.path)
|
|
264
258
|
path = parsed_path.path
|
|
265
259
|
|
|
@@ -292,7 +286,7 @@ class LightweightModelServer:
|
|
|
292
286
|
self._send_response(404, {"error": "Not found"})
|
|
293
287
|
|
|
294
288
|
def do_POST(self):
|
|
295
|
-
"""Handle POST requests"""
|
|
289
|
+
"""Handle POST requests."""
|
|
296
290
|
parsed_path = urllib.parse.urlparse(self.path)
|
|
297
291
|
path = parsed_path.path
|
|
298
292
|
|
|
@@ -306,7 +300,7 @@ class LightweightModelServer:
|
|
|
306
300
|
self._send_response(404, {"error": "Not found"})
|
|
307
301
|
|
|
308
302
|
def _handle_generate(self, model_name):
|
|
309
|
-
"""Handle text generation requests"""
|
|
303
|
+
"""Handle text generation requests."""
|
|
310
304
|
loaded_models = getattr(self.server_instance, "loaded_models", {})
|
|
311
305
|
if model_name not in loaded_models:
|
|
312
306
|
self._send_response(404, {"error": f"Model {model_name} not found"})
|
|
@@ -331,7 +325,7 @@ class LightweightModelServer:
|
|
|
331
325
|
self._send_response(500, {"error": str(e)})
|
|
332
326
|
|
|
333
327
|
def _handle_ollama_generate(self):
|
|
334
|
-
"""Handle Ollama-compatible generation requests"""
|
|
328
|
+
"""Handle Ollama-compatible generation requests."""
|
|
335
329
|
try:
|
|
336
330
|
content_length = int(self.headers.get("Content-Length", 0))
|
|
337
331
|
post_data = self.rfile.read(content_length)
|
|
@@ -401,7 +395,7 @@ class LightweightModelServer:
|
|
|
401
395
|
self._send_response(500, {"error": str(e)})
|
|
402
396
|
|
|
403
397
|
def _handle_ollama_tags(self):
|
|
404
|
-
"""Handle Ollama-compatible model listing requests"""
|
|
398
|
+
"""Handle Ollama-compatible model listing requests."""
|
|
405
399
|
try:
|
|
406
400
|
loaded_models = getattr(self.server_instance, "loaded_models", {})
|
|
407
401
|
|
|
@@ -418,7 +412,7 @@ class LightweightModelServer:
|
|
|
418
412
|
"digest": f"sha256:{'0' * 64}", # Placeholder digest
|
|
419
413
|
"details": {
|
|
420
414
|
"parent_model": "",
|
|
421
|
-
"format": "
|
|
415
|
+
"format": "ggu",
|
|
422
416
|
"family": "bert",
|
|
423
417
|
"families": ["bert"],
|
|
424
418
|
"parameter_size": model_info.get("parameters", "0M"),
|
|
@@ -434,7 +428,7 @@ class LightweightModelServer:
|
|
|
434
428
|
self._send_response(500, {"error": str(e)})
|
|
435
429
|
|
|
436
430
|
def _generate_response(self, prompt: str, model_name: str) -> str:
|
|
437
|
-
"""Generate a response based on the prompt and model"""
|
|
431
|
+
"""Generate a response based on the prompt and model."""
|
|
438
432
|
# For now, provide intelligent responses based on prompt analysis
|
|
439
433
|
prompt_lower = prompt.lower()
|
|
440
434
|
|
|
@@ -476,7 +470,7 @@ class LightweightModelServer:
|
|
|
476
470
|
return f"I'm your local AI assistant running the {model_name} model. I can help with system management, command creation, file operations, task scheduling, and general assistance. I'm designed to be helpful while running entirely on your machine for privacy. How can I assist you today?"
|
|
477
471
|
|
|
478
472
|
def _send_response(self, status_code, data):
|
|
479
|
-
"""Send JSON response"""
|
|
473
|
+
"""Send JSON response."""
|
|
480
474
|
self.send_response(status_code)
|
|
481
475
|
self.send_header("Content-Type", "application/json")
|
|
482
476
|
self.send_header("Access-Control-Allow-Origin", "*")
|
|
@@ -502,7 +496,7 @@ class LightweightModelServer:
|
|
|
502
496
|
print(f"โ Server error: {e}")
|
|
503
497
|
|
|
504
498
|
def download_and_load_model(self, model_key: str) -> bool:
|
|
505
|
-
"""Download and load a model"""
|
|
499
|
+
"""Download and load a model."""
|
|
506
500
|
try:
|
|
507
501
|
# Download model
|
|
508
502
|
model_path = self.downloader.download_model(model_key)
|
|
@@ -526,7 +520,7 @@ class LightweightModelServer:
|
|
|
526
520
|
return False
|
|
527
521
|
|
|
528
522
|
def list_models(self):
|
|
529
|
-
"""List available and downloaded models"""
|
|
523
|
+
"""List available and downloaded models."""
|
|
530
524
|
print("\n๐ Available Lightweight Models:")
|
|
531
525
|
print("=" * 60)
|
|
532
526
|
|
|
@@ -538,7 +532,7 @@ class LightweightModelServer:
|
|
|
538
532
|
print()
|
|
539
533
|
|
|
540
534
|
def get_system_info(self) -> Dict[str, Any]:
|
|
541
|
-
"""Get system information"""
|
|
535
|
+
"""Get system information."""
|
|
542
536
|
import psutil
|
|
543
537
|
|
|
544
538
|
return {
|
|
@@ -550,7 +544,7 @@ class LightweightModelServer:
|
|
|
550
544
|
}
|
|
551
545
|
|
|
552
546
|
def recommend_model(self) -> str:
|
|
553
|
-
"""Recommend the best model based on system capabilities"""
|
|
547
|
+
"""Recommend the best model based on system capabilities."""
|
|
554
548
|
system_info = self.get_system_info()
|
|
555
549
|
|
|
556
550
|
print("๐ System Analysis:")
|
|
@@ -567,7 +561,7 @@ class LightweightModelServer:
|
|
|
567
561
|
return "distilbert-base-uncased" # Standard small model
|
|
568
562
|
|
|
569
563
|
def stop_server(self) -> bool:
|
|
570
|
-
"""Stop the lightweight server"""
|
|
564
|
+
"""Stop the lightweight server."""
|
|
571
565
|
if not self.running:
|
|
572
566
|
print("โ ๏ธ Server is not running")
|
|
573
567
|
return False
|
|
@@ -581,7 +575,7 @@ class LightweightModelServer:
|
|
|
581
575
|
return False
|
|
582
576
|
|
|
583
577
|
def delete_model(self, model_key: str) -> bool:
|
|
584
|
-
"""Delete a downloaded model"""
|
|
578
|
+
"""Delete a downloaded model."""
|
|
585
579
|
try:
|
|
586
580
|
model_dir = self.models_dir / model_key
|
|
587
581
|
|
|
@@ -605,7 +599,7 @@ class LightweightModelServer:
|
|
|
605
599
|
|
|
606
600
|
|
|
607
601
|
def create_simple_client():
|
|
608
|
-
"""Create a simple client script for testing"""
|
|
602
|
+
"""Create a simple client script for testing."""
|
|
609
603
|
client_script = '''#!/usr/bin/env python3
|
|
610
604
|
"""
|
|
611
605
|
Simple client for the lightweight model server
|
|
@@ -689,7 +683,7 @@ def main(
|
|
|
689
683
|
create_client: bool,
|
|
690
684
|
download_only: bool,
|
|
691
685
|
):
|
|
692
|
-
"""Lightweight model server for extremely small and efficient models"""
|
|
686
|
+
"""Lightweight model server for extremely small and efficient models."""
|
|
693
687
|
|
|
694
688
|
print("๐ MCLI Lightweight Model Server")
|
|
695
689
|
print("=" * 50)
|
|
@@ -733,11 +727,11 @@ def main(
|
|
|
733
727
|
print(f"\n๐ Starting lightweight server on port {port}...")
|
|
734
728
|
server.start_server()
|
|
735
729
|
|
|
736
|
-
print(
|
|
730
|
+
print("\n๐ Usage:")
|
|
737
731
|
print(f" - API: http://localhost:{port}")
|
|
738
732
|
print(f" - Health: http://localhost:{port}/health")
|
|
739
733
|
print(f" - Models: http://localhost:{port}/models")
|
|
740
|
-
print(
|
|
734
|
+
print(" - Test: python lightweight_client.py")
|
|
741
735
|
|
|
742
736
|
try:
|
|
743
737
|
# Keep server running
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Test script for the lightweight model server.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
import os
|
|
7
6
|
import sys
|
|
8
7
|
import time
|
|
9
8
|
from pathlib import Path
|
|
@@ -15,7 +14,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
def test_lightweight_models():
|
|
18
|
-
"""Test the lightweight models configuration"""
|
|
17
|
+
"""Test the lightweight models configuration."""
|
|
19
18
|
print("๐งช Testing lightweight models configuration...")
|
|
20
19
|
|
|
21
20
|
try:
|
|
@@ -44,7 +43,7 @@ def test_lightweight_models():
|
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
def test_downloader():
|
|
47
|
-
"""Test the downloader functionality"""
|
|
46
|
+
"""Test the downloader functionality."""
|
|
48
47
|
print("\n๐งช Testing downloader functionality...")
|
|
49
48
|
|
|
50
49
|
try:
|
|
@@ -76,7 +75,7 @@ def test_downloader():
|
|
|
76
75
|
|
|
77
76
|
|
|
78
77
|
def test_server():
|
|
79
|
-
"""Test the server functionality"""
|
|
78
|
+
"""Test the server functionality."""
|
|
80
79
|
print("\n๐งช Testing server functionality...")
|
|
81
80
|
|
|
82
81
|
try:
|
|
@@ -88,7 +87,7 @@ def test_server():
|
|
|
88
87
|
|
|
89
88
|
# Test system info
|
|
90
89
|
system_info = server.get_system_info()
|
|
91
|
-
print(
|
|
90
|
+
print("โ
System info collected:")
|
|
92
91
|
print(f" - CPU cores: {system_info['cpu_count']}")
|
|
93
92
|
print(f" - Memory: {system_info['memory_gb']:.1f} GB")
|
|
94
93
|
print(f" - Free disk: {system_info['disk_free_gb']:.1f} GB")
|
|
@@ -105,12 +104,10 @@ def test_server():
|
|
|
105
104
|
|
|
106
105
|
|
|
107
106
|
def test_http_server():
|
|
108
|
-
"""Test the HTTP server functionality"""
|
|
107
|
+
"""Test the HTTP server functionality."""
|
|
109
108
|
print("\n๐งช Testing HTTP server...")
|
|
110
109
|
|
|
111
110
|
try:
|
|
112
|
-
import threading
|
|
113
|
-
import time
|
|
114
111
|
|
|
115
112
|
from mcli.workflow.model_service.lightweight_model_server import LightweightModelServer
|
|
116
113
|
|
|
@@ -162,7 +159,7 @@ def test_http_server():
|
|
|
162
159
|
|
|
163
160
|
|
|
164
161
|
def test_model_download():
|
|
165
|
-
"""Test model download functionality"""
|
|
162
|
+
"""Test model download functionality."""
|
|
166
163
|
print("\n๐งช Testing model download...")
|
|
167
164
|
|
|
168
165
|
try:
|
|
@@ -199,7 +196,7 @@ def test_model_download():
|
|
|
199
196
|
|
|
200
197
|
|
|
201
198
|
def main():
|
|
202
|
-
"""Run all tests"""
|
|
199
|
+
"""Run all tests."""
|
|
203
200
|
print("๐ Testing Lightweight Model Server")
|
|
204
201
|
print("=" * 50)
|
|
205
202
|
|