Giter Club home page Giter Club logo

m3e-base-api's Introduction

m3e-base-api

这个项目基于 Colab Notebook,提供 m3e-base 的类 OpenAI 的 API 调用,支持在 CPU/GPU 环境下运行,可以通过 Docker 部署。

快速开始

以下指南假设你已经安装了 Docker 和 Docker Compose。如果使用 CUDA,还需要安装 NVIDIA Container Toolkit (安装指南)。

构建和运行

  1. 克隆仓库

    git clone https://github.com/zzlphysics/m3e-base-api.git
    cd m3e-base-api
  2. 构建 Docker 镜像

    docker build -t m3e-base-api .

    或者使用 Docker Compose:

    docker-compose up --build
  3. 运行容器

    直接使用 Docker:

    docker run -d -p 6000:6000 -e PORT=6000 -e DEVICE=cpu m3e-base-api

    docker run -d -p 6000:6000 -e PORT=6000 -e DEVICE=cuda --gpus all m3e-base-api

    或者使用 Docker Compose:

    docker-compose up

使用 API

发送 POST 请求到 /v1/embeddings,包含 JSON 格式的文本数据:

curl -X POST http://localhost:6000/v1/embeddings \
     -H "Content-Type: application/json" \
     -d '{"input": "Hello, world!"}'

配置

环境变量

  • PORT:Flask 服务监听的端口(默认为 6000)。
  • DEVICE:用于运行模型的设备,可以是 cpucuda(默认为 cpu)。

Docker Compose

docker-compose.yml 文件中,你可以修改服务设置,包括端口映射和环境变量。

许可证

MIT

m3e-base-api's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.