Browse Source

测试GPU性能

罗俊辉 9 tháng trước cách đây
mục cha
commit
70f99f693e
3 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 1 1
      alg.toml
  2. 2 2
      alg_app.py
  3. 1 1
      routes/accountServer.py

+ 1 - 1
alg.toml

@@ -1,5 +1,5 @@
 reload = true
-bind = "0.0.0.0:6060"
+bind = "0.0.0.0:6062"
 workers = 4
 keep_alive_timeout = 120  # 保持连接的最大秒数,根据需要调整
 graceful_timeout = 30    # 重启或停止之前等待当前工作完成的时间

+ 2 - 2
alg_app.py

@@ -16,7 +16,7 @@ async def init():
     初始化模型
     """
     await AsyncMySQL.init_pool()
-    model = BertSimilarity(model_name_or_path="BAAI/bge-large-zh-v1.5")
+    model = BertSimilarity(model_name_or_path="BAAI/bge-large-zh-v1.5", device="cuda")
     print("模型加载成功")
     app_routes = AlgRoutes(AsyncMySQL, model)
     app.register_blueprint(app_routes)
@@ -32,4 +32,4 @@ async def close_db():
 
 
 if __name__ == '__main__':
-    app.run(debug=True, host="0.0.0.0", port=6060)
+    app.run()

+ 1 - 1
routes/accountServer.py

@@ -28,7 +28,7 @@ class AccountServer(object):
         nlp process
         """
         headers = {"Content-Type": "application/json"}
-        url = "http://localhost:6060/nlp"
+        url = "http://localhost:6062/nlp"
         body = {
             "data": {
                 "text_list_a": [i.replace("'", "") for i in title_list],