호스팅 된 OpenAI GPT / Google Vertex AI Palm2 / Gemini 또는 작업에 대한 로컬 올라마 모델을 평가하십시오.
임의의 작업을 YAML로 지역 또는 호스팅 언어 모델에 배포하십시오. 모델 Forge 작업은 다음과 같이 분류됩니다. 에이전트 , 선택 사후 처리기 및 평가자 . 작업에는 최고 수준의 프롬프트가 있습니다. 실제 작업입니다. 예를 들어, 다음을 작업 프롬프트로 사용할 수 있습니다. "다음 시그니처가있는 C에서 malloc 의 간단한 예제를 구현하십시오 : void* malloc(size_t size) . 다음으로, 에이전트의 응답에서 프로그램의 소스 코드 만 추출하기 위해 로컬 모델에 후 프로세서 요청을 포함시킬 수 있습니다. 마지막으로, 귀하의 평가자는 COT (사고) 기반 예제를 포함하여 이상적으로 작업의 전문가 역할을하도록 지시받습니다.
.jsonpython src/main.py 실행하십시오 git clone https://github.com/Brandon7CC/MODELFORGE
cd MODELFORGE/
python -m venv forge-env
source forge-env/bin/activate
pip install -r requirements.txt
python src/main.py -h
echo " Done! Next, you can try FizzBuzz with Ollama locally!npython src/main.py task_configs/FizzBuzz.yaml Fizzbuzz는 고전적인 "Can You Code"질문입니다. 간단하지만 개발자가 문제를 통해 어떻게 생각하는지에 대한 수준의 통찰력을 제공 할 수 있습니다. 예를 들어, Python에서는 제어 흐름, 람다 등의 사용 등 문제 설명이 있습니다.
1에서 n까지의 숫자를 표시하는 프로그램을 작성하십시오. 3 개의 배수의 경우 숫자 대신 "fizz"를 인쇄하고 5 개의 배수의 경우 "Buzz"를 인쇄하십시오. 3과 5의 배수 인 숫자의 경우 "fizzbuzz"를 인쇄하십시오.
다음으로 작업 구성 파일을 만들 것입니다 (이 작업은 이미 task_configs/FizzBuzz.yaml 에서 수행되었습니다). 그렇게하기 위해 우리는 "fizzbuzz"라는 최상위 작업을 정의하고 , 프롬프트와 문제를 해결하기 위해 모델을 원하는 횟수를 제공합니다.
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
Write a program to display numbers from 1 to n. For multiples of three, print "Fizz"
instead of the number, and for the multiples of five, print "Buzz". For numbers which
are multiples of both three and five, print "FizzBuzz".
Let's think step by step.이제 우리는 우리의 "에이전트" (우리의 임무를 완료하기위한 전문가 역할을 할 모델)을 정의합니다. 모델은 지원되는 호스팅 / 로컬 올라마 모델 (예 : Google의 Gemini, OpenAi의 GPT-4 또는 Ollama를 통한 Mistral AI의 Mixtral8x7b) 일 수 있습니다.
tasks :
- name : FizzBuzz
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : mixtral:8x7b-instruct-v0.1-q4_1
temperature : 0.98
system_prompt : |
You're an expert Python developer. Follow these requirement **exactly**:
- The code you produce is at the principal level;
- You follow modern object oriented programming patterns;
- You list your requirements and design a simple test before implementing.
Review the user's request and follow these requirements.선택적으로 우리는 "포스트 프로세서" 를 만들 수 있습니다. 우리는 에이전트가 평가 한 코드 만 평가되기를 원하므로 여기서는 후 프로세서 모델이 에이전트의 응답에서 소스 코드를 추출하게 할 것입니다.
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : gpt-4-1106-preview
temperature : 0.98
system_prompt : |
...
postprocessor :
base_model : mistral
temperature : 0.1
system_prompt : |
You have one job: return the source code provided in the user's message.
**ONLY** return the exact source code. Your response is not read by a human.마지막으로, 에이전트/사후 프로세서의 출력을 검토하는 전문가 역할을하는 "평가자" 모델을 원할 것입니다. 평가자의 임무는 참 / 거짓을 반환하는 것입니다. 또한, 우리는 최대 10 번 실패 할 수 있습니다. 다음은 약간의 마술이 등장했습니다 . 우리는 실패한 시도에 대한 간단한 요약을 포함합니다 - 다음에 에이전트에 대한 쿼리 내의 비판이 포함되어 있습니다. 이를 통해 에이전트는 훨씬 더 효과적인 방식으로 스스로 반복 할 수 있습니다. 여기서 우리는 평가자가 Fizzbuzz의 구현을 검토하기를 원합니다.
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : codellama
temperature : 0.98
system_prompt : |
...
postprocessor :
base_model : gemini-pro
temperature : 0.1
system_prompt : |
...
# Evaluators have defined system prompts to only return true / false for their domain.
evaluator :
base_model : gpt-4-1106-preview
temperature : 0.1
system_prompt : |
Assess if a given sample program correctly implements Fizz Buzz.
The program should display numbers from 1 to n. For multiples of three, it should
print "Fizz" instead of the number, for the multiples of five, it should print "Buzz",
and for numbers which are multiples of both three and five, it should print "FizzBuzz".
Guidelines for Evaluation
- Correctness: Verify that the program outputs "Fizz" for multiples of 3, "Buzz" for
multiples of 5, and "FizzBuzz" for numbers that are multiples of both 3 and 5. For
all other numbers, it should output the number itself.
- Range Handling: Check if the program correctly handles the range from 1 to n, where
n is the upper limit provided as input.
- Error Handling: Assess if the program includes basic error handling, such as ensuring
the input is a positive integer.이 작업은 Google DeepMind의 Funsearch 접근 방식에서 영감을 얻어 CAP 세트 문제에 대한 새로운 솔루션을 찾습니다. 거시적 수준에서 이것은 COT (사고 체인) 기반 예를 개발함으로써 수행되었으며, Palm2가 많은 양의 프로그램을 생성하도록 반복적으로 촉구 한 다음 해당 프로그램을 여러 수준에서 평가합니다.