ประเมินโฮสต์ OpenAI GPT / Google Vertex AI PALM2 / GEMINI หรือรุ่น Ollama ท้องถิ่นกับงาน
แจกจ่ายงานโดยพลการเป็น yaml ให้กับโมเดลภาษาท้องถิ่นหรือโฮสต์ ในโมเดลงานปลอมจะถูกแบ่งย่อยโดย: ตัวแทน , postprocessor เสริมและ ผู้ประเมิน งานมีพรอมต์ระดับสูงสุด - งานจริงที่ต้องทำ ตัวอย่างเช่นคุณสามารถใช้สิ่งต่อไปนี้เป็นงานพร้อมท์งาน: "ใช้ตัวอย่างง่ายๆของ malloc ใน c ด้วยลายเซ็นต่อไปนี้: void* malloc(size_t size) " ถัดไปคุณสามารถรวมคำขอ postprocessor ไปยังโมเดลท้องถิ่นเพื่อแยกเฉพาะซอร์สโค้ดของโปรแกรมจากการตอบกลับของตัวแทน ในที่สุดผู้ประเมินของคุณจะได้รับคำสั่งให้ทำหน้าที่เป็นผู้เชี่ยวชาญในงานอย่างเหมาะสมกับตัวอย่างตัวอย่างที่ใช้ 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 Code" คลาสสิก มันง่าย แต่สามารถให้ระดับข้อมูลเชิงลึกเกี่ยวกับวิธีที่นักพัฒนาคิดผ่านปัญหา ตัวอย่างเช่นใน Python การใช้กระแสควบคุมแลมบ์ดาส ฯลฯ นี่คือคำสั่งปัญหา:
เขียนโปรแกรมเพื่อแสดงหมายเลขจาก 1 ถึง n สำหรับทวีคูณของสามให้พิมพ์ "Fizz" แทนหมายเลขและสำหรับทวีคูณของห้าพิมพ์ "Buzz" สำหรับตัวเลขที่ทวีคูณของทั้งสามและห้าพิมพ์ "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.ตอนนี้เราจะกำหนด "ตัวแทน" ของเรา - โมเดลที่จะทำหน้าที่เป็นผู้เชี่ยวชาญในการทำงานให้เสร็จ โมเดลสามารถเป็นรุ่นที่ได้รับการสนับสนุน / Local Ollama (เช่น Gemini ของ Google, GPT-4 ของ Openai หรือ MiStral AI ของ MixTral8x7b ผ่าน Ollama)
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.ทางเลือก เราสามารถสร้าง "postprocessor" เราจะต้องการให้รหัสเสร็จสิ้นโดยตัวแทนที่จะได้รับการประเมินดังนั้นที่นี่เราจะให้โมเดล postprocessor ของเราแยกซอร์สโค้ดจากการตอบกลับของตัวแทน
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.สุดท้ายคุณจะต้องการโมเดล "ผู้ประเมินผล" ซึ่งจะทำหน้าที่เป็นผู้เชี่ยวชาญในการตรวจสอบผลลัพธ์จากตัวแทน/postprocessor งานของผู้ประเมินคือการส่งคืนจริง / เท็จ นอกจากนี้เราสามารถ ล้มเหลวได้ถึง 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 ในการค้นหาวิธีแก้ปัญหาใหม่สำหรับปัญหาชุด CAP ในระดับมหภาคสิ่งนี้ทำโดยการพัฒนาตัวอย่างที่ใช้ COT (ห่วงโซ่ความคิด) ซ้ำ ๆ กระตุ้นให้ PALM2 สร้างโปรแกรมจำนวนมากจากนั้นประเมินโปรแกรมเหล่านั้นในหลายระดับ