feat(models): load models from JSON configuration
- load models from JSON configuration - resolve security issue - update dependencies - optimize imports in graph.py and monitor.py
This commit is contained in:
parent
ba2a610ac5
commit
36306e5b12
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"Example-Model-22B-FP8-dynamic": "http://112.83.15.44:8883",
|
||||
"Mistral-7B-bf16": "http://57.214.142.199:8090"
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
numpy~=2.1.1
|
||||
numpy~=1.26.4
|
||||
uvicorn~=0.30.6
|
||||
requests~=2.32.3
|
||||
pandas~=2.2.3
|
||||
plotly~=5.24.1
|
||||
flask~=3.0.3
|
||||
zstd~=1.5.5.1
|
||||
scipy~=1.13.1
|
||||
asgiref~=3.8.1
|
||||
setuptools~=74.1.3
|
||||
|
|
16
setup.py
16
setup.py
|
@ -1,12 +1,12 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='vAnalytics',
|
||||
version='v1.0.0',
|
||||
packages=[''],
|
||||
url='https://github.com/leafspark/vAnalytics',
|
||||
license='apache-2.0',
|
||||
author='leafspark',
|
||||
author_email='',
|
||||
description='time series analytics for vLLM'
|
||||
name="vAnalytics",
|
||||
version="v1.0.0",
|
||||
packages=[""],
|
||||
url="https://github.com/leafspark/vAnalytics",
|
||||
license="apache-2.0",
|
||||
author="leafspark",
|
||||
author_email="",
|
||||
description="time series analytics for vLLM",
|
||||
)
|
||||
|
|
34
src/graph.py
34
src/graph.py
|
@ -1,22 +1,18 @@
|
|||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import numpy as np
|
||||
import os
|
||||
import pandas as pd
|
||||
import plotly.graph_objects as go
|
||||
import plotly.offline as pyo
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import plotly.graph_objects as go
|
||||
import plotly.offline as pyo
|
||||
from flask import Flask, render_template, request, send_file
|
||||
from functools import lru_cache
|
||||
from plotly.subplots import make_subplots
|
||||
from plotly.subplots import make_subplots
|
||||
from scipy.interpolate import make_interp_spline
|
||||
|
||||
# Set up logging with a higher level
|
||||
logging.basicConfig(
|
||||
|
@ -259,7 +255,7 @@ def index():
|
|||
|
||||
plot_div = None
|
||||
error_message = None
|
||||
if selected_model:
|
||||
if selected_model in valid_model_names:
|
||||
try:
|
||||
fig = create_plots(selected_model)
|
||||
if fig is not None:
|
||||
|
@ -273,22 +269,16 @@ def index():
|
|||
"An error occurred while creating the plot. Please try again later."
|
||||
)
|
||||
|
||||
if selected_model in valid_model_names:
|
||||
command = [
|
||||
"python",
|
||||
"get_data.py",
|
||||
"--hours",
|
||||
"24",
|
||||
f".\\data\\{selected_model}.sqlite",
|
||||
]
|
||||
result = subprocess.run(command, capture_output=True, text=True)
|
||||
else:
|
||||
logging.error(f"Invalid model selected: {selected_model}")
|
||||
error_message = "Invalid model selected. Please choose a valid model."
|
||||
result = None
|
||||
|
||||
command = [
|
||||
"python",
|
||||
"get_data.py",
|
||||
"--hours",
|
||||
"24",
|
||||
f".\\data\\{selected_model}.sqlite",
|
||||
]
|
||||
result = subprocess.run(command, capture_output=True, text=True)
|
||||
else:
|
||||
logging.error(f"Invalid model selected: {selected_model}")
|
||||
result = None
|
||||
|
||||
return render_template(
|
||||
|
|
|
@ -4,11 +4,8 @@ import os
|
|||
import json
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import zstd
|
||||
import sqlite3
|
||||
|
||||
print("Starting monitor.")
|
||||
|
||||
# Set up basic configuration for logging
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
|
@ -16,15 +13,12 @@ logging.basicConfig(
|
|||
filename="monitor.log", # Log to a file named monitor.log
|
||||
filemode="a",
|
||||
) # Append to the log file
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
|
||||
# Model information
|
||||
models = {
|
||||
"Example-Model-22B-FP8-dynamic": "http://112.83.15.44:8883",
|
||||
"Mistral-7B-bf16": "http://57.214.142.199:8090",
|
||||
}
|
||||
print("Starting monitor.")
|
||||
|
||||
# Load model info
|
||||
with open("models.json", "r") as file:
|
||||
models = json.load(file)
|
||||
|
||||
|
||||
def call_metrics_endpoint(model_name, base_url):
|
||||
|
|
Loading…
Reference in New Issue