Multiple minor fixes (#1530)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""
|
||||
Usage:
|
||||
|
||||
python3 async_io.py
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""
|
||||
Usage:
|
||||
|
||||
python -m sglang.launch_server --model-path meta-llama/Llama-2-7b-chat-hf --port 30000
|
||||
python openai_batch_chat.py
|
||||
|
||||
Note: Before running this script,
|
||||
you should create the input.jsonl file with the following content:
|
||||
{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo-0125", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello world! List 3 NBA players and tell a story"}],"max_tokens": 300}}
|
||||
@@ -13,12 +15,10 @@ import os
|
||||
import time
|
||||
|
||||
import openai
|
||||
from openai import OpenAI
|
||||
|
||||
|
||||
class OpenAIBatchProcessor:
|
||||
def __init__(self, api_key):
|
||||
# client = OpenAI(api_key=api_key)
|
||||
def __init__(self):
|
||||
client = openai.Client(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
|
||||
|
||||
self.client = client
|
||||
@@ -81,8 +81,7 @@ class OpenAIBatchProcessor:
|
||||
|
||||
|
||||
# Initialize the OpenAIBatchProcessor
|
||||
api_key = os.environ.get("OPENAI_API_KEY")
|
||||
processor = OpenAIBatchProcessor(api_key)
|
||||
processor = OpenAIBatchProcessor()
|
||||
|
||||
# Process the batch job
|
||||
input_file_path = "input.jsonl"
|
||||
|
||||
@@ -10,16 +10,13 @@ you should create the input.jsonl file with the following content:
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
import openai
|
||||
from openai import OpenAI
|
||||
|
||||
|
||||
class OpenAIBatchProcessor:
|
||||
def __init__(self, api_key):
|
||||
# client = OpenAI(api_key=api_key)
|
||||
def __init__(self):
|
||||
client = openai.Client(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
|
||||
|
||||
self.client = client
|
||||
@@ -82,11 +79,10 @@ class OpenAIBatchProcessor:
|
||||
|
||||
|
||||
# Initialize the OpenAIBatchProcessor
|
||||
api_key = os.environ.get("OPENAI_API_KEY")
|
||||
processor = OpenAIBatchProcessor(api_key)
|
||||
processor = OpenAIBatchProcessor()
|
||||
|
||||
# Process the batch job
|
||||
input_file_path = "input_complete.jsonl"
|
||||
input_file_path = "input.jsonl"
|
||||
endpoint = "/v1/completions"
|
||||
completion_window = "24h"
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# launch server
|
||||
# python -m sglang.launch_server --model LxzGordon/URM-LLaMa-3.1-8B --is-embedding
|
||||
|
||||
import json
|
||||
|
||||
import requests
|
||||
|
||||
url = "http://127.0.0.1:30000"
|
||||
|
||||
Reference in New Issue
Block a user