From af1f3410f6c64c0ffbd24fd9b454f9369822e5ac Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Sat, 14 Oct 2023 16:12:15 -0400 Subject: [PATCH] typos --- docs/blog/posts/distilation-part1.md | 3 ++- docs/distilation.md | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/blog/posts/distilation-part1.md b/docs/blog/posts/distilation-part1.md index c15b941..1b4b102 100644 --- a/docs/blog/posts/distilation-part1.md +++ b/docs/blog/posts/distilation-part1.md @@ -16,7 +16,7 @@ But the promise of LLMs is that they can do all of this in one go. So how do we ## Challenges in Fine-tuning -Fine-tuning a model isn't as straightforward as just writing `def f(a, b): return a * b` to teach a model three-digit multiplication. Substantial data preparation is required, making logging for data collection cumbersome. Luckily OpenAI not only provides a fine-tuning script but also one for function calling which simplies the process backed to structured outputs! More over, the finetune allows us to avoid passing the schema to the model, resulting in less tokens being used! +Fine-tuning a model isn't as straightforward as just writing `def f(a, b): return a * b` to teach a model three-digit multiplication. Substantial data preparation is required, making logging for data collection cumbersome. Luckily OpenAI not only provides a fine-tuning script but also one for function calling which simplies the process backed by structured outputs! More over, the finetune allows us to avoid passing the schema to the model, resulting in less tokens being used! ## Role of Instructor in Easing the Process @@ -28,6 +28,7 @@ Here's an example to illustrate its use: ```python import logging +import random from pydantic import BaseModel from instructor import Instructions diff --git a/docs/distilation.md b/docs/distilation.md index 796f6e6..e1c3dbc 100644 --- a/docs/distilation.md +++ b/docs/distilation.md @@ -27,15 +27,15 @@ instructions = Instructions( log_handlers=[logging.FileHandler("math_finetunes.jsonl")] ) -class Response(BaseModel): +class Multiply(BaseModel): a: int b: int result: int @instructions.distil -def fn(a: int, b: int) -> Response: +def fn(a: int, b: int) -> Multiply: resp = a + b - return Response(a=a, b=b, result=resp) + return Multiply(a=a, b=b, result=resp) ``` ## Custom Log Handlers for Data Collection @@ -85,9 +85,9 @@ instructions = Instructions( ) @instructions.distil(model='gpt-3.5-turbo:finetuned', swap=True) -def fn(a: int, b: int) -> Response: +def fn(a: int, b: int) -> Multiply: resp = a + b - return Response(a=a, b=b, result=resp) + return Multiply(a=a, b=b, result=resp) ``` This dynamic switching retains backward compatibility while improving efficiency, opening up exciting avenues for future developments. \ No newline at end of file