modelscope / modelscope

ModelScope: bring the notion of Model-as-a-Service to life.
https://www.modelscope.cn/
Apache License 2.0
6.9k stars 711 forks source link

RexUniNLU模型多线程调用报错 #846

Closed zhangkesheng closed 4 months ago

zhangkesheng commented 5 months ago
import time

from fastapi import FastAPI
from modelscope.pipelines import pipeline
from pydantic import BaseModel

semantic_cls = pipeline('rex-uninlu',
                        model='damo/nlp_deberta_rex-uninlu_chinese-base',
                        model_revision='v1.2.1')

app = FastAPI()

class Item(BaseModel):
    input: str
    fields: object

@app.post("/damo/rex-uninlu")
def uie(item: Item):
    start = time.time()
    return {
        'data': semantic_cls(input=item.input, schema=item.fields),
        'took': time.time() - start
    }

用FastAPI对外提供了接口, 在阿里云FC里部署, 实例并发度10, 多线程调用的时候就会出现下面的报错 图片 Pipeline related: @Firmament-cyou @wenmengzhou

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 5 days with no activity.