Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法运行instruction.py #280

Open
2 tasks done
NCCurry30 opened this issue Jun 5, 2024 · 0 comments
Open
2 tasks done

无法运行instruction.py #280

NCCurry30 opened this issue Jun 5, 2024 · 0 comments

Comments

@NCCurry30
Copy link

NCCurry30 commented Jun 5, 2024

提交前必须检查以下项目 | The following items must be checked before submission

  • 请确保使用的是仓库最新代码(git pull),一些问题已被解决和修复。 | Make sure you are using the latest code from the repository (git pull), some issues have already been addressed and fixed.
  • 我已阅读项目文档FAQ章节并且已在Issue中对问题进行了搜索,没有找到相似问题和解决方案 | I have searched the existing issues / discussions

问题类型 | Type of problem

启动命令 | Startup command

操作系统 | Operating system

Linux

详细描述问题 | Detailed description of the problem

我希望运行codallama/instruction.py,但是我遇到了一个问题,请问我应该如何解决这个问题:

""" https://github.com/facebookresearch/codellama/blob/main/example_instructions.py """

from langchain.chat_models import ChatOpenAI
from langchain.schema import HumanMessage, SystemMessage

llm = ChatOpenAI(
    model_name="code-llama",
    openai_api_base="http://0.0.0.0:10810/v1",
    openai_api_key="xxx",
)


def test():
    instructions = [
        [
            HumanMessage(content="In Bash, how do I list all text files in the current directory (excluding subdirectories) that have been modified in the last month?")
        ],
        [
            HumanMessage(content="What is the difference between inorder and preorder traversal? Give an example in Python.")
        ],
        [
            SystemMessage(content="Provide answers in JavaScript"),
            HumanMessage(content="Write a function that computes the set of sums of all contiguous sublists of a given list.")
        ],
    ]

    for instruction in instructions:
        result = llm(instruction)
        for msg in instruction:
            print(f"{msg.type.capitalize()}: {msg.content}\n")

        print(
            f"> AI: {result.content}"
        )
        print("\n==================================\n")


if __name__ == "__main__":
    test()

image
image
但是遇到了报错,server 502
image

Dependencies

# 请在此处粘贴依赖情况
# Please paste the dependencies here

运行日志或截图 | Runtime logs or screenshots

# 请在此处粘贴运行日志
# Please paste the run log here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant