from openai import OpenAI # autodl 中指令 # # Set OpenAI's API key and API base to use vLLM's API server. openai_api_key = "EMPTY" openai_api_base = "http://localhost:8000/v1" client = OpenAI( api_key=openai_api_key, base_url=openai_api_base, ) zly='[QUESTION]总是为别人找想,总是在友情中卑微?[DESCRIPTION]我总是在友谊中很卑微,[LABEL]人际,朋友,人际边界' chat_response = client.chat.completions.create( model="/media/ldx/的机械硬盘/models/Llama3-8B-Chinese-Chat-lzy-all-nn", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": zly}, ] ) print("Chat response:", chat_response.choices) #环境lora #微调代码,启动服务器 #CUDA_VISIBLE_DEVICES=0 API_PORT=8000 llamafactory-cli api --model_name_or_path /media/ldx/的机械硬盘/models/Llama3-8B-Chinese-Chat-cq --template llama3 --infer_backend vllm --vllm_enforce_eager
llamafactory-cli api方法
于 2024-08-01 17:40:03 首次发布