Browse Source

Adding steps to the llama guard data sample readme, adding update to main readme.

Beto 1 year ago
parent
commit
bc43c1cf45
2 changed files with 10 additions and 4 deletions
  1. 1 1
      README.md
  2. 9 3
      src/llama_recipes/data/llama_guard/README.md

+ 1 - 1
README.md

@@ -1,6 +1,6 @@
 # Llama 2 Fine-tuning / Inference Recipes, Examples and Demo Apps
 
-**[Update Dec. 15, 2023] We added support for Llama Guard as a safety checker for our example inference script and also with standalone inference with an example script and prompt formatting. More details [here](./examples/llama_guard/README.md).**
+**[Update Dec. 28, 2023] We added support for Llama Guard as a safety checker for our example inference script and also with standalone inference with an example script and prompt formatting. More details [here](./examples/llama_guard/README.md). For details on formatting data for fine tuning Llama Guard, we provide a script and sample usage [here](./src/llama_recipes/data/llama_guard/README.md).**
 
 **[Update Dec 14, 2023] We recently released a series of Llama 2 demo apps [here](./demo_apps). These apps show how to run Llama (locally, in the cloud, or on-prem),  how to use Azure Llama 2 API (Model-as-a-Service), how to ask Llama questions in general or about custom data (PDF, DB, or live), how to integrate Llama with WhatsApp and Messenger, and how to implement an end-to-end chatbot with RAG (Retrieval Augmented Generation).**
 

+ 9 - 3
src/llama_recipes/data/llama_guard/README.md

@@ -8,7 +8,13 @@ The finetuning_data_formatter script provides classes and methods for formatting
 * `AugmentationConfigs`: Configures how additional examples will be generated from the original training examples to augment the training data.
 * `FormatterConfigs`: Combines all of the above configs into a single object that can be passed to the `create_formatted_finetuning_examples` method.
 
-## Usage
+## Running the script
+
+1. Clone the llama-recipes repo
+2. Install the dependencies
+3. Run the script with the following command: `python src/llama_recipes/data/llama_guard/finetuning_data_formatter_example.py > sample.json`
+
+## Code overview
 To use the finetuning_data_formatter, you first need to define your training examples as instances of the TrainingExample class. For example:
 
 ```
@@ -49,8 +55,8 @@ guidelines = Guidelines(
 ```
 
 Then, you need to configure the prompt that will be given to Llama Guard during finetuning. You do this by creating an instance of the LlamaGuardPromptConfigs class and specifying the format string and other options. 
-**Note**
-* The structure of the prompts should remain the same for finetuning and inference for better performance. 
+
+**Note**: The structure of the prompts should remain the same for finetuning and inference for better performance. 
 
 For example: