修复部分模板模板

This commit is contained in:
pengluan 2022-06-06 20:06:37 +08:00
parent 93d9567f47
commit 88902a4392
12 changed files with 25 additions and 42 deletions

View File

@ -32,7 +32,7 @@ RUN pip install Pillow pysnooper opencv-python
RUN pip3 install https://github.com/danielgatis/darknetpy/raw/master/dist/darknetpy-4.1-cp36-cp36m-linux_x86_64.whl
WORKDIR /app
#RUN wget https://pengluan-76009.sz.gfp.tencent-cloud.com/github/yolov3.zip && unzip yolov3.zip
#RUN wget https://pengluan-76009.sz.gfp.tencent-cloud.com/github/yolov3.zip && apt install unzip && unzip yolov3.zip && rm yolov3.zip
COPY . /app/
ENTRYPOINT ["python", "server-web.py"]
# docker run --name darknet --privileged -it --rm -v $PWD:/app -p 8080:8080 --entrypoint='' ai.tencentmusic.com/tme-public/target-detection bash

View File

@ -36,11 +36,13 @@ app = Flask(__name__,
UPLOAD_FOLDER = "UPLOAD_FOLDER"
myfont = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc', 20)
YOLO_BASE_DIR = os.getenv('YOLO_BASE_DIR','yolo')
YOLO_DATA_PATH = os.getenv('YOLO_DATA_PATH','yolo/coco.data')
YOLO_CFG_PATH = os.getenv('YOLO_CFG_PATH','yolo/yolov3.cfg')
YOLO_WEIGHTS_PATH = os.getenv('YOLO_WEIGHTS_PATH','yolo/yolov3.weights')
class ImageDetector(object):
def __init__(self):
self.detector = Detector(YOLO_BASE_DIR+'/coco.data',YOLO_BASE_DIR+'/yolov3.cfg',YOLO_BASE_DIR+'/yolov3.weights')
self.detector = Detector(YOLO_DATA_PATH,YOLO_CFG_PATH,YOLO_WEIGHTS_PATH)
# @pysnooper.snoop()
def classify_image(self, image_path):

View File

@ -22,9 +22,7 @@ RUN echo "alias ll='ls -alF'" >> /root/.bashrc && \
RUN pip install kubernetes==12.0.1 pysnooper psutil
COPY job/deploy-service/* /app/
#COPY job/pkgs/config/ubuntu-sources.list /etc/apt/sources.list
#COPY job/pkgs/config/pip.conf /root/.pip/pip.conf
COPY job/pkgs /app/job/pkgs
WORKDIR /app
ENV PYTHONPATH=/app:$PYTHONPATH

View File

@ -2,7 +2,6 @@
import os,sys
base_dir = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(base_dir)
import argparse
import datetime
import json
@ -13,14 +12,12 @@ import pysnooper
import os,sys
import re
import requests
import psutil
import copy
import os
KFJ_CREATOR = os.getenv('KFJ_CREATOR', 'admin')
host = 'http://kubeflow-dashboard.infra'
# host = 'http://127.0.0.1:80'
# host = 'http://9.135.92.226'
KFJ_TASK_PROJECT_NAME = os.getenv('KFJ_TASK_PROJECT_NAME','public')
host = os.getenv('HOST','http://kubeflow-dashboard.infra').strip('/')
@pysnooper.snoop()
def deploy(**kwargs):

View File

@ -21,4 +21,4 @@ done
python3 setup_args.py --train_cfg "$train_cfg" --data_cfg "$data_cfg" --weights "$weights"
/app/darknet/darknet detector train /app/darknet/cfg/data.cfg /app/darknet/cfg/train.cfg $weights 2>&1 | tee /mnt/uthermai/tmp/darknet/t.log
/app/darknet/darknet detector train /app/darknet/cfg/data.cfg /app/darknet/cfg/train.cfg $weights 2>&1

View File

@ -1404,7 +1404,7 @@
},
"object-detection-on-darknet":{
"project_name":"多媒体类模板",
"image_name":"mirrors.tencent.com/uthermai/object_detection_on_darknet:v1",
"image_name":"ai.tencentmusic.com/tme-public/object_detection_on_darknet:v1",
"image_describe":"yolo目标识别",
"job_template_name":"object-detection-on-darknet",
"job_template_describe":"yolo目标识别",
@ -1449,13 +1449,13 @@
"--weights": {
"type": "str",
"item_type": "str",
"label": "权重文件",
"label": "预训练模型权重文件",
"require": 1,
"choice": [],
"range": "",
"default": "",
"placeholder": "",
"describe": "权重文件",
"describe": "预训练模型权重文件",
"editable": 1,
"condition": "",
"sub_args": {}
@ -1471,7 +1471,7 @@
"job_template_describe":"模型部署推理服务",
"job_template_command":"",
"job_template_volume":"",
"job_template_account":"",
"job_template_account":"kubeflow-pipeline",
"job_template_env":"",
"job_template_expand":{
"index":1,
@ -1553,24 +1553,6 @@
}
},
"部署信息":{
"--project_name":{
"type":"str",
"item_type":"str",
"label":"部署项目名",
"require":1,
"choice":[
],
"range":"",
"default":"public",
"placeholder":"",
"describe":"部署项目名",
"editable":1,
"condition":"",
"sub_args":{
}
},
"--service_type":{
"type":"str",
"item_type":"str",

File diff suppressed because one or more lines are too long

View File

@ -75,7 +75,7 @@ class Notebook(Model,AuditMixinNullable,MyappModelBase):
if SERVICE_EXTERNAL_IP:
service_ports = 10000 + 10 * self.id
host = "http://%s:%s"%(SERVICE_EXTERNAL_IP,str(service_ports))
url='/#/mnt/%s'%self.created_by.username
url = '/notebook/jupyter/%s/lab/tree/mnt/%s'%(self.name,self.created_by.username)
return Markup(f'<a target=_blank href="{host}{url}">{self.name}</a>')
@property

View File

@ -667,6 +667,8 @@ instance_group [
# @pysnooper.snoop(watch_explode=('item',))
def pre_update(self, item):
if not item.volume_mount:
item.volume_mount=item.project.volume_mount
item.name = item.name.replace("_","-")
# 修改了名称的话,要把之前的删掉
self.use_expand(item)

View File

@ -485,6 +485,7 @@ class Notebook_ModelView_Base():
k8s_client = py_k8s.K8s(item.cluster.get('KUBECONFIG',''))
k8s_client.delete_pods(namespace=item.namespace,pod_name=item.name)
k8s_client.delete_service(namespace=item.namespace,name=item.name)
k8s_client.delete_service(namespace=item.namespace, name=(item.name + "-external").lower()[:60].strip('-'))
crd_info = conf.get("CRD_INFO", {}).get('virtualservice', {})
if crd_info:
k8s_client.delete_crd(group=crd_info['group'], version=crd_info['version'],

View File

@ -225,6 +225,7 @@ def dag_to_pipeline(pipeline,dbsession,**kwargs):
container_envs.append(V1EnvVar("KFJ_TASK_RESOURCE_CPU", str(task.resource_cpu)))
container_envs.append(V1EnvVar("KFJ_TASK_RESOURCE_MEMORY", str(task.resource_memory)))
container_envs.append(V1EnvVar("KFJ_TASK_RESOURCE_GPU", str(task.resource_gpu.replace("+",''))))
container_envs.append(V1EnvVar("KFJ_TASK_PROJECT_NAME", str(pipeline.project.name)))
container_envs.append(V1EnvVar("GPU_TYPE", os.environ.get("GPU_TYPE", "NVIDIA")))
container_envs.append(V1EnvVar("USERNAME", pipeline.created_by.username))

View File

@ -423,6 +423,7 @@ class Task_ModelView_Base():
task_env += 'KFJ_TASK_RESOURCE_CPU=' + str(task.resource_cpu) + "\n"
task_env += 'KFJ_TASK_RESOURCE_MEMORY=' + str(task.resource_memory) + "\n"
task_env += 'KFJ_TASK_RESOURCE_GPU=' + str(task.resource_gpu.replace('+', '')) + "\n"
task_env += 'KFJ_TASK_PROJECT_NAME=' + str(task.pipeline.project.name) + "\n"
task_env += 'KFJ_PIPELINE_ID=' + str(task.pipeline_id) + "\n"
task_env += 'KFJ_RUN_ID=' + run_id + "\n"
task_env += 'KFJ_CREATOR=' + str(task.pipeline.created_by.username) + "\n"