From 84d5c95d28d31d42fecb8f725c965087a768e6ed Mon Sep 17 00:00:00 2001 From: Andrei Ivanouski Date: Thu, 7 Aug 2025 13:20:19 +0300 Subject: [PATCH] fix: correct typos and formatting in documentation --- README.md | 4 +- awesome-gpt-oss.md | 6 +-- gpt_oss/tools/apply_patch.md | 90 +++++++++++++++++++++--------------- 3 files changed, 58 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 7d4f279..42c49bd 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Both models were trained using our [harmony response format][harmony] and should - **Full chain-of-thought:** Provides complete access to the model's reasoning process, facilitating easier debugging and greater trust in outputs. This information is not intended to be shown to end users. - **Fine-tunable:** Fully customize models to your specific use case through parameter fine-tuning. - **Agentic capabilities:** Use the models' native capabilities for function calling, [web browsing](#browser), [Python code execution](#python), and Structured Outputs. -- **Native MXFP4 quantization:** The models are trained with native MXFP4 precision for the MoE layer, allowing `gpt-oss-120b` to run on a single H100 GPU and `gpt-oss-20b` to run within 16GB of memory.. +- **Native MXFP4 quantization:** The models are trained with native MXFP4 precision for the MoE layer, allowing `gpt-oss-120b` to run on a single H100 GPU and `gpt-oss-20b` to run within 16GB of memory. ### Inference examples @@ -227,7 +227,7 @@ To perform inference you'll need to first convert the SafeTensor weights from Hu python gpt_oss/metal/scripts/create-local-model.py -s -d ``` -Or downloaded the pre-converted weight: +Or download the pre-converted weight: ```shell huggingface-cli download openai/gpt-oss-120b --include "metal/*" --local-dir gpt-oss-120b/metal/ diff --git a/awesome-gpt-oss.md b/awesome-gpt-oss.md index c8a57a2..04dbe33 100644 --- a/awesome-gpt-oss.md +++ b/awesome-gpt-oss.md @@ -8,7 +8,7 @@ This is a list of guides and resources to help you get started with the gpt-oss - [Local](#local) - [Server](#server) - [Cloud](#cloud) -- [Examples / Tutorials](#examples--tutorials) +- [Examples & Tutorials](#examples--tutorials) - [Tools](#tools) ## Inference @@ -68,8 +68,8 @@ This is a list of guides and resources to help you get started with the gpt-oss ## Tools -- [Example `python` tool for gpt-oss](./gpt_oss/tools/python_docker/) -- [Example `browser` tool for gpt-oss](./gpt_oss/tools/simple_browser/) +- [`python` tool for gpt-oss](./gpt_oss/tools/python_docker/) +- [`browser` tool for gpt-oss](./gpt_oss/tools/simple_browser/) ## Contributing diff --git a/gpt_oss/tools/apply_patch.md b/gpt_oss/tools/apply_patch.md index ea6c9c5..9410545 100644 --- a/gpt_oss/tools/apply_patch.md +++ b/gpt_oss/tools/apply_patch.md @@ -1,52 +1,63 @@ -When requested to perform coding-related tasks, you MUST adhere to the following criteria when executing the task: +When requested to perform coding-related tasks, you **MUST** adhere to the following criteria when executing the task: -- Use `apply_patch` to edit files. -- If completing the user's task requires writing or modifying files: - - Your code and final answer should follow these _CODING GUIDELINES_: - - Avoid unneeded complexity in your solution. Minimize program size. - - Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task. - - NEVER add copyright or license headers unless specifically requested. -- Never implement function stubs. Provide complete working implementations. +* Use `apply_patch` to edit files. +* If completing the user's task requires writing or modifying files: -§ `apply_patch` Specification + * Your code and final answer should follow these *CODING GUIDELINES*: + + * Avoid unneeded complexity in your solution. Minimize program size. + * Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task. + * **NEVER** add copyright or license headers unless specifically requested. +* Never implement function stubs. Provide complete working implementations. + +--- + +## § `apply_patch` Specification Your patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope: -*** Begin Patch -[ one or more file sections ] -*** End Patch +* A patch consists of a sequence of file operations, all bracketed between a `Begin` and `End` line. + +* Each operation starts with one of three headers: -Within that envelope, you get a sequence of file operations. -You MUST include a header to specify the action you are taking. -Each operation starts with one of three headers: + * `*** Add File: ` — create a new file. Every following line is a `+` line (the initial contents). + * `*** Delete File: ` — remove an existing file. Nothing follows. + * `*** Update File: ` — patch an existing file in place (optionally with a rename). -*** Add File: - create a new file. Every following line is a + line (the initial contents). -*** Delete File: - remove an existing file. Nothing follows. -*** Update File: - patch an existing file in place (optionally with a rename). + May be immediately followed by `*** Move to: ` if you want to rename the file. -May be immediately followed by *** Move to: if you want to rename the file. -Then one or more “hunks”, each introduced by @@ (optionally followed by a hunk header). -Within a hunk each line starts with: +* Each update contains one or more “hunks”, each introduced by `@@` (optionally with a hunk header). -- for inserted text, + Within a hunk, each line starts with: -* for removed text, or - space ( ) for context. - At the end of a truncated hunk you can emit *** End of File. + * `+` for inserted text, + * `-` for removed text, + * (space) for context. -Patch := Begin { FileOp } End -Begin := "*** Begin Patch" NEWLINE -End := "*** End Patch" NEWLINE -FileOp := AddFile | DeleteFile | UpdateFile -AddFile := "*** Add File: " path NEWLINE { "+" line NEWLINE } + At the end of a truncated hunk you can emit `*** End of File`. + +--- + +### Patch Grammar + +
+Patch      := Begin { FileOp } End
+Begin      := "*** Begin Patch" NEWLINE
+End        := "*** End Patch" NEWLINE
+FileOp     := AddFile | DeleteFile | UpdateFile
+AddFile    := "*** Add File: " path NEWLINE { "+" line NEWLINE }
 DeleteFile := "*** Delete File: " path NEWLINE
 UpdateFile := "*** Update File: " path NEWLINE [ MoveTo ] { Hunk }
-MoveTo := "*** Move to: " newPath NEWLINE
-Hunk := "@@" [ header ] NEWLINE { HunkLine } [ "*** End of File" NEWLINE ]
-HunkLine := (" " | "-" | "+") text NEWLINE
+MoveTo     := "*** Move to: " newPath NEWLINE
+Hunk       := "@@" [ header ] NEWLINE { HunkLine } [ "*** End of File" NEWLINE ]
+HunkLine   := (" " | "-" | "+") text NEWLINE
+
-A full patch can combine several operations: +--- +## Example Patch + +```diff *** Begin Patch *** Add File: hello.txt +Hello world @@ -57,8 +68,13 @@ A full patch can combine several operations: +print("Hello, world!") *** Delete File: obsolete.txt *** End Patch +``` + +--- + +### Important Notes -It is important to remember: +* **You must include a header with your intended action** (Add/Delete/Update) +* **You must prefix new lines with `+`** even when creating a new file -- You must include a header with your intended action (Add/Delete/Update) -- You must prefix new lines with `+` even when creating a new file +--- \ No newline at end of file