Skip to main content

No project description provided

Project description

ml-task-fusion

跨服务器llm和stable diffusion任务调用分发.

Installation

pip install mltaskfusion

在 /etc/.ml-task-fusion/main.conf 中增加以下配置:

# redis 配置
REDIS_HOST="192.168.9.5"
REDIS_PASSWORD="123456"
REDIS_PORT=16379

# vllm 框架地址
VLLM_BASE_URL="http://118.145.131.117:8000/v1"

启动服务:

mltaskfusion-cli --models=vllm --config=/etc/.ml-task-fusion/main.conf

Usage

Basic Example

import os
from mltaskfusion.task.vllm import VllmData, VllmModel
from mltaskfusion.db import queue_client, QueueJobModel

os.environ['CONFIG_FILE'] = "/etc/.ml-task-fusion/main.conf"
queue_cli = queue_client(queue_name=VllmModel().queue_name)

prompt = """
OCR the text of the image. Extract the text of the following fields and put it in a JSON format: 'why choose us', 'about us', 'company profile'. 

If the 'why choose us', 'about us', 'company profile' fields do not appear in the image, simply return [].

Ignore Other: Ignore all other text information in the picture except for the above fields.

IMPORTANT: 
    1. YOU MUST RESPOND ONLY WITH VALID JSON. DO NOT INCLUDE ANY INTRODUCTION, EXPLANATION, OR EXTRA TEXT. ONLY PROVIDE THE JSON ARRAY.
    2. NO ADDITIONAL TEXT.

Output format:
    [
        {
            "field": "field name 1",
            "sections": [
                {
                    "title": "",
                    "content": "chunk1 text here"
                },
                {
                    "title": "",
                    "content": "chunk2 text here"
                }
            ]
        },
        {
            "field": "field name 2",
            "sections": [
                {
                    "title": "",
                    "content": "chunk3 text here"
                },
                {
                    "title": "",
                    "content": "chunk4 text here"
                }
            ]
        }
    ]                    
"""
data = VllmData(prompt=prompt, images=[], max_tokens=1024, id=helper.unique_id())
result = queue_cli.push_and_response(job=QueueJobModel(id=data.id, data=data.model_dump()), seconds=120)
print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mltaskfusion-0.1.6.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mltaskfusion-0.1.6-py2.py3-none-any.whl (14.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mltaskfusion-0.1.6.tar.gz.

File metadata

  • Download URL: mltaskfusion-0.1.6.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for mltaskfusion-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f8898f9c32f3fe004199dafbf7b4df732e68ffc8f9acff4978776b4d7f1471c2
MD5 7bffd9e7225961fe5abda84f5981c8c3
BLAKE2b-256 f3003c8b3c08881ab7dad9a598c885eed3442e0545bc9e596f2f8ff32a9b4c0f

See more details on using hashes here.

File details

Details for the file mltaskfusion-0.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: mltaskfusion-0.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for mltaskfusion-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8ae430a3ab9a79485275a98a08c4f3ccabd59f3388188d9a501abc59c1f57734
MD5 907e936e7b983a90c80725adb2a9d77c
BLAKE2b-256 b87e33931fd9ef144f55cd794fe2e91fa1b5c19d6189b3a000c6086940c96db2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page