Mengevaluasi Hosted OpenAI GPT / Google Vertex AI Palm2 / Gemini atau model Ollama lokal terhadap tugas.
Mendistribusikan tugas sewenang -wenang sebagai yaml ke model bahasa lokal atau hosting. Dalam model forge tugas dipecah oleh: agen , postprocessor opsional, dan evaluator . Tugas memiliki prompt tingkat atas - pekerjaan yang sebenarnya untuk dilakukan. Misalnya, Anda dapat menggunakan yang berikut sebagai prompt tugas: "Menerapkan contoh sederhana malloc di C dengan tanda tangan berikut: void* malloc(size_t size) ". Selanjutnya, Anda dapat memasukkan permintaan postprocessor ke model lokal untuk mengekstrak hanya kode sumber program dari respons agen. Akhirnya, evaluator Anda akan diinstruksikan untuk bertindak sebagai ahli dalam tugas idealnya dengan contoh -contoh berbasis COT (rantai pemikiran) yang disertakan.
.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 adalah pertanyaan klasik "Can You Code". Ini sederhana, tetapi dapat memberikan tingkat wawasan tentang bagaimana seorang pengembang berpikir melalui suatu masalah. Misalnya, di Python, penggunaan aliran kontrol, lambdas, dll. Inilah pernyataan masalahnya:
Tulis program untuk menampilkan nomor dari 1 hingga n. Untuk kelipatan tiga, cetak "Fizz" alih -alih nomor, dan untuk kelipatan lima, cetak "buzz". Untuk angka yang merupakan kelipatan dari tiga dan lima, cetak "Fizzbuzz".
Selanjutnya, kami akan membuat file konfigurasi tugas kami (ini sudah dilakukan untuk Anda di task_configs/FizzBuzz.yaml ), tetapi kami akan memandu Anda melewatinya. Untuk melakukannya kita akan mendefinisikan tugas tingkat atas yang disebut "Fizzbuzz", berikan prompt dan berapa kali kita ingin dia model untuk menyelesaikan masalah.
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.Sekarang kami akan mendefinisikan "agen" kami - model yang akan bertindak sebagai ahli untuk menyelesaikan tugas kami. Model dapat berupa model Ollama yang diselenggarakan / lokal yang didukung (misalnya Google Gemini, Openai's GPT-4, atau Mixtral8x7b Mistral AI melalui 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.Secara opsional kami dapat membuat "postprocessor" . Kami hanya ingin kode diselesaikan oleh agen untuk dievaluasi jadi di sini kami akan meminta model postprocessor kami mengekstrak kode sumber dari respons agen.
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.Terakhir, Anda ingin model "evaluator" yang akan bertindak sebagai ahli dalam meninjau output dari agen/postprocessor. Pekerjaan evaluator adalah mengembalikan benar / salah. Selain itu, kita bisa gagal hingga 10 kali -menuntut kembali agen. Inilah sedikit keajaiban yang masuk - kami akan menyertakan ringkasan singkat dari upaya yang gagal - sebuah kritik dalam kueri berikutnya kepada agen. Ini memungkinkan agen untuk mengulangi dirinya sendiri dengan cara yang jauh lebih efektif . Di sini kami ingin evaluator kami meninjau implementasi 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.Karya ini terinspirasi oleh pendekatan FunSearch Google DeepMind untuk menemukan solusi baru untuk masalah topi. Pada tingkat makro ini dilakukan dengan mengembangkan contoh berbasis COT (rantai pemikiran), berulang kali mendorong PALM2 untuk menghasilkan sejumlah besar program, dan kemudian mengevaluasi program -program tersebut pada beberapa tingkatan.