size_categories:10K<n<100K format:parquet modality:text library:datasets library:pandas library:mlcroissant library:polars region:us
---
dataset_info:
  features:
  - name: text
    dtype: string
  splits:
  - name: train
    num_bytes: 19290295
    num_examples: 25607
  download_size: 5709771
  dataset_size: 19290295
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

``` bash
    from datasets import load_dataset, Dataset

    # Load dataset
    dataset = load_dataset("vishnun0027/Indian-Law", split="train")
    
    # Define a system prompt for guidance
    system_prompt = "You are a assistant specializing in Indian law. Provide accurate and concise answers to the following instructions.."
    
    # Define a function to format each example
    def format_to_llama(example):
        instruction = example["Instruction"]
        response = example["Response"]
        
        # Format according to LLaMA 2 structure
        formatted_example = (
            f"<s>[INST] <<SYS>>\n{system_prompt}\n<</SYS>>\n\n"
            f"{instruction} [/INST] {response} </s>"
        )
        return formatted_example
    
    # Create a list of formatted examples
    formatted_examples = [format_to_llama(example) for example in dataset]
    
    # Create a new dataset with only the 'formatted_text' field
    formatted_text_only_dataset = Dataset.from_dict({"text": formatted_examples})
    
    formatted_text_only_dataset.push_to_hub('vishnun0027/Indian-Law-llama')
```

