一、初步接触api
在llama-factory的src文件夹中,我们发现了api.py文件,因此我们在终端直接执行api.py
通过本地的SSH隧道,我们能够在本地的6006端口进行api的访问,通过了解,这个是利用llama-factory中提供的包来实现的,且其中的模型为llama-factory本地提供的模型,通过资料查询,没能够获得如何针对本地模型使用。
api.py代码:
# Copyright 2024 the LlamaFactory team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS"