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