diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index 208f6b208..f728d51a3 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -35,6 +35,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: "Free up disk space" + uses: ./.github/actions/free-up-disk-space - name: Set up Python ${{ matrix.python-version.setup }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 75415a749..df1d046e9 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: "Free up disk space" + uses: ./.github/actions/free-up-disk-space - name: Set up Python 3.12 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 777a3853b..3122efb0e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -25,6 +25,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: "Free up disk space" + uses: ./.github/actions/free-up-disk-space - name: Set up Python 3.12 uses: actions/setup-python@v4 with: diff --git a/README.md b/README.md index fdf4a99b7..70ce5ba26 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,46 @@ # FMS HF Tuning - [Installation](#installation) -- [Data format support](#data-support) -- [Supported Models](#supported-models) -- [Training](#training) - - [Single GPU](#single-gpu) - - [Multiple GPUs with FSDP](#multiple-gpus-with-fsdp) - - [Tips on Parameters to Set](#tips-on-parameters-to-set) - [Tuning Techniques](#tuning-techniques) - - [LoRA Tuning Example](#lora-tuning-example) - - [Activated LoRA Tuning Example](#activated-lora-tuning-example) - - [GPTQ-LoRA with AutoGPTQ Tuning Example](#gptq-lora-with-autogptq-tuning-example) - - [Fine Tuning](#fine-tuning) - - [FMS Acceleration](#fms-acceleration) -- [Extended Pre-Training](#extended-pre-training) -- [Tuning Vision Language Models](#tuning-vision-language-models) -- [Inference](#inference) - - [Running a single example](#running-a-single-example) - - [Running multiple examples](#running-multiple-examples) - - [Inference Results Format](#inference-results-format) - - [Changing the Base Model for Inference](#changing-the-base-model-for-inference) -- [Validation](#validation) -- [Trainer Controller Framework](#trainer-controller-framework) -- [Experiment Tracking](#experiment-tracking) -- [More Examples](#more-examples) +- [Training and Training Parameter Selection](#training-and-training-parameters) +- [Supported Models](#supported-models) +- [Data format support](#data-support) + - [Advanced Data Processing](./docs/advanced-data-preprocessing.md#data-config) + - [Guidelines on supported data formats](./docs/advanced-data-preprocessing.md#use-cases-supported-via-command-line-argument-training_data_path) + - [Offline data processing](#offline-data-preprocessing) + - [Online data mixing](./docs/online-data-mixing.md) +- [Additional Frameworks](#additional-frameworks) + - [Inference](#inference) + - [Validation](#validation) + - [Training controller](#trainer-controller-framework) + - [More Examples](#more-examples) This repo provides basic tuning scripts with support for specific models. The repo relies on Hugging Face `SFTTrainer` and PyTorch FSDP. Our approach to tuning is: 1. Models are loaded from Hugging Face `transformers` or the [foundation-model-stack](https://github.com/foundation-model-stack/foundation-model-stack) -- models are either optimized to use `Flash Attention v2` directly or through `SDPA` 2. Hugging Face `SFTTrainer` for the training loop -3. `FSDP` as the backend for training +3. `FSDP` as the backend for multi gpu training ## Installation -### Basic Installation +Refer our [Installation](./docs/installation.md) guide for details on how to install the library. -``` -pip install fms-hf-tuning -``` +## Tuning Techniques: -### Using FlashAttention +Please refer to our [tuning techniques document](./docs/tuning-techniques.md) for details on how to perform - +* [LoRA](./docs/tuning-techniques.md#lora-tuning-example) +* [Activated LoRA](./docs/tuning-techniques.md#activated-lora-tuning-example) +* [GPTQ-LoRA](./docs/tuning-techniques.md#gptq-lora-with-autogptq-tuning-example) +* [Full Fine Tuning](./docs/tuning-techniques.md#fine-tuning) +* [Use FMS Acceleration](./docs/tuning-techniques.md#fms-acceleration) +* [Extended Pre-Training](./docs/tuning-techniques.md#extended-pre-training) -> Note: After installing, if you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: -```sh -pip install fms-hf-tuning[dev] -pip install fms-hf-tuning[flash-attn] -``` -[FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. +## Training and Training Parameters: -*Debug recommendation:* While training, if you encounter flash-attn errors such as `undefined symbol`, you can follow the below steps for clean installation of flash binaries. This may occur when having multiple environments sharing the pip cache directory or torch version is updated. +* Please refer our document on [training](./docs/training.md) to see how to start [Single GPU](./docs/training.md#single-gpu) or [Multi-GPU](./docs/training.md#multiple-gpus-with-fsdp) runs with fms-hf-tuning. +* You can also refer the same a different [section](./docs/training.md#tips-on-parameters-to-set) of the same document on tips to set various training arguments. + +### *Debug recommendation:* +While training, if you encounter flash-attn errors such as `undefined symbol`, you can follow the below steps for clean installation of flash binaries. This may occur when having multiple environments sharing the pip cache directory or torch version is updated. ```sh pip uninstall flash-attn @@ -55,251 +48,24 @@ pip cache purge pip install fms-hf-tuning[flash-attn] ``` -### Using FMS-Acceleration +## Supported Models -If you wish to use [fms-acceleration](https://github.com/foundation-model-stack/fms-acceleration), you need to install it. -``` -pip install fms-hf-tuning[fms-accel] -``` -`fms-acceleration` is a collection of plugins that packages that accelerate fine-tuning / training of large models, as part of the `fms-hf-tuning` suite. For more details see [this section below](#fms-acceleration). +- While we expect most Hugging Face decoder models to work, we have primarily tested fine-tuning for below family of models. + * [IBM Granite](https://huggingface.co/ibm-granite) + * [Meta Llama](https://huggingface.co/meta-llama) + * [Mistral Ai](https://huggingface.co/mistralai) and + * [OpenAI GPT-OSS](https://huggingface.co/collections/openai/gpt-oss-68911959590a1634ba11c7a4) -### Using Experiment Trackers +- LoRA Layers supported : All the linear layers of a model + output `lm_head` layer. Users can specify layers as a list or use `all-linear` as a shortcut. Layers are specific to a model architecture and can be specified as noted [here](https://github.com/foundation-model-stack/fms-hf-tuning?tab=readme-ov-file#lora-tuning-example) -To use experiment tracking with popular tools like [Aim](https://github.com/aimhubio/aim), note that some trackers are considered optional dependencies and can be installed with the following command: -``` -pip install fms-hf-tuning[aim] -``` -For more details on how to enable and use the trackers, Please see, [the experiment tracking section below](#experiment-tracking). +An extended list for tested models is maintaned in the [supported models](./docs/supported-models.md) document but might have outdated information. ## Data Support -Users can pass training data as either a single file or a Hugging Face dataset ID using the `--training_data_path` argument along with other arguments required for various [use cases](#use-cases-supported-with-training_data_path-argument) (see details below). If user choose to pass a file, it can be in any of the [supported formats](#supported-data-formats). Alternatively, you can use our powerful [data preprocessing backend](./docs/advanced-data-preprocessing.md) to preprocess datasets on the fly. +Users can pass training data as either a single file or a Hugging Face dataset ID using the `--training_data_path` argument along with other arguments required for various [use cases](./docs/advanced-data-preprocessing.md#use-cases-supported-via-command-line-argument-training_data_path). If user choose to pass a file, it can be in any of the [supported formats](#supported-data-formats). Alternatively, you can use our powerful [data preprocessing backend](./docs/advanced-data-preprocessing.md) to preprocess datasets on the fly. Below, we mention the list of supported data usecases via `--training_data_path` argument. For details of our advanced data preprocessing see more details in [Advanced Data Preprocessing](./docs/advanced-data-preprocessing.md). -EOS tokens are added to all data formats listed below (EOS token is appended to the end of each data point, like a sentence or paragraph within the dataset), except for pretokenized data format at this time. For more info, see [pretokenized](#4-pre-tokenized-datasets). - -## Supported Data File Formats -We support the following file formats via `--training_data_path` argument - -Data Format | Tested Support -------------|--------------- -JSON | ✅ -JSONL | ✅ -PARQUET | ✅ -ARROW | ✅ - -As iterated above, we also support passing a HF dataset ID directly via `--training_data_path` argument. - -**NOTE**: Due to the variety of supported data formats and file types, `--training_data_path` is handled as follows: -- If `--training_data_path` ends in a valid file extension (e.g., .json, .csv), it is treated as a file. -- If `--training_data_path` points to a valid folder, it is treated as a folder. -- If neither of these are true, the data preprocessor tries to load `--training_data_path` as a Hugging Face (HF) dataset ID. - -## Use cases supported with `training_data_path` argument - -### 1. Data formats with a single sequence and a specified response_template to use for masking on completion. - -#### 1.1 Pre-process the dataset - Pre-process the dataset to contain a single sequence of each data instance containing input + response. The trainer is configured to expect a `response template` as a string. For example, if one wants to prepare the `alpaca` format data to feed into this trainer, it is quite easy and can be done with the following code. - -```python -PROMPT_DICT = { - "prompt_input": ( - "Below is an instruction that describes a task, paired with an input that provides further context. " - "Write a response that appropriately completes the request.\n\n" - "### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:" - ), - "prompt_no_input": ( - "Below is an instruction that describes a task. " - "Write a response that appropriately completes the request.\n\n" - "### Instruction:\n{instruction}\n\n### Response:" - ), -} - -def format_alpaca_fn(example): - prompt_input, prompt_no_input = PROMPT_DICT['prompt_input'], PROMPT_DICT['prompt_no_input'] - output = prompt_input.format_map(example) if example.get("input", "") != "" else prompt_no_input.format_map(example) - output = f"{output} {example['output']}" - return {"output": output} - -ds = datasets.load_dataset('json', data_files='./stanford_alpaca/alpaca_data.json') - -alpaca_ds = ds['train'].map(format_alpaca_fn, remove_columns=['instruction', 'input']) -alpaca_ds.to_json("sft_alpaca_data.json") -``` - -The `response template` corresponding to the above dataset and the `Llama` tokenizer is: `\n### Response:"`. - -The same way can be applied to any dataset, with more info can be found [here](https://huggingface.co/docs/trl/main/en/sft_trainer#format-your-input-prompts). - -Once the data is converted using the formatting function, pass the `dataset_text_field` containing the single sequence to the trainer. - -#### 1.2 Format the dataset on the fly - Pass a dataset and a `data_formatter_template` to use the formatting function on the fly while tuning. The template should specify fields of the dataset with `{{field}}`. While tuning, the data will be converted to a single sequence using the template. Data fields can contain alpha-numeric characters, spaces and the following special symbols - "." , "_", "-". - -Example: Train.json -`[{ "input" : , - "output" : , - }, - ... -]` -data_formatter_template: `### Input: {{input}} \n\n## Label: {{output}}` - -Formatting will happen on the fly while tuning. The keys in template should match fields in the dataset file. The `response template` corresponding to the above template will need to be supplied. in this case, `response template` = `\n## Label:`. - -##### In conclusion, if using the reponse_template and single sequence, either the `data_formatter_template` argument or `dataset_text_field` needs to be supplied to the trainer. - -### 2. Dataset with input and output fields (no response template) - - Pass a [supported dataset](#supported-data-formats) containing fields `"input"` with source text and `"output"` with class labels. Pre-format the input as you see fit. The output field will simply be concatenated to the end of input to create single sequence, and input will be masked. - - The `"input"` and `"output"` field names are mandatory and cannot be changed. - -Example: For a JSON dataset like, `Train.jsonl` - -``` -{"input": "### Input: Colorado is a state in USA ### Output:", "output": "USA : Location"} -{"input": "### Input: Arizona is also a state in USA ### Output:", "output": "USA : Location"} -``` - -### 3. Chat Style Single/Multi turn datasets - - Pass a dataset containing single/multi turn chat dataset. Your dataset could follow this format: - -``` -$ head -n 1 train.jsonl -{"messages": [{"content": "You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.", "role": "system"}, {"content": "Look up a word that rhymes with exist", "role": "user"}, {"content": "I found a word that rhymes with \"exist\":\n1\\. Mist", "role": "assistant"}], "group": "lab_extension", "dataset": "base/full-extension", "metadata": "{\"num_turns\": 1}"} -``` - -This format supports both single and multi-turn chat scenarios. - -The chat template used to render the dataset will default to `tokenizer.chat_template` from the model's tokenizer configuration. This can be overridden using the `--chat_template ` argument. For example, models like [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct), which include a [chat template](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/e0a466fb25b9e07e9c2dc93380a360189700d1f8/tokenizer_config.json#L188) in their `tokenizer_config.json`, do not require users to provide a chat template to process the data. - -Users do need to pass `--response_template` and `--instruction_template` which are pieces of text representing start of -`assistant` and `human` response inside the formatted chat template. -For the [granite model above](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/main/tokenizer_config.json#L188) for example, the values shall be. -``` ---instruction_template "<|start_of_role|>user<|end_of_role|>" ---response_template "<|start_of_role|>assistant<|end_of_role|>" -``` - -The code internally uses [`DataCollatorForCompletionOnlyLM`](https://github.com/huggingface/trl/blob/main/trl/trainer/utils.py#L93) to perform masking of text ensuring model learns only on the `assistant` responses for both single and multi turn chat. - -#### Aligning dataset formats -In some cases the chat template might not be aligned with the data format of the dataset. For example, consider the following data sample and suppose we want to use the list of contents associated with the `messages` key from the data sample for our multi-turn training job! - -``` -{ - "messages": [ - {"content": "You are an AI...", "role": "system"}, - {"content": "Look up a word...", "role": "user"}, - {"content": "A word that rhymes is 'mist'", "role": "assistant"} - ], - "group": "lab_extension", - "dataset": "base/full-extension", - "metadata": "{\"num_turns\": 2}" -} -``` -Different Chat templates support different data formats and the chat template might not always align with the data format of the dataset! - -Here is a example of chat template that iterates over the nested data sample by addressing the "messages" key in `for message in messages['messages']` : -``` -{% for message in messages['messages'] %}\ - {% if message['role'] == 'user' %}{{ '<|user|>\n' + message['content'] + eos_token }}\ - {% elif message['role'] == 'system' %}{{ '<|system|>\n' + message['content'] + eos_token }}\ - {% elif message['role'] == 'assistant' %}{{ '<|assistant|>\n' + message['content'] + eos_token }}\ - {% endif %}\ - {% if loop.last and add_generation_prompt %}{{ '<|assistant|>' }}\ - {% endif %}\ -{% endfor %} -``` -While the above template might be suitable for certain data formats, not all chat templates access the nested contents in a data sample. - -In the following example notice the `for message in messages` line which does not access any nested contents in the data and expects the nested content to be passed directly to the chat template! - -``` -{%- for message in messages %}\ - {%- if message['role'] == 'system' %}\ - {{- '<|system|>\n' + message['content'] + '\n' }}\ - {%- elif message['role'] == 'user' %}\ - {{- '<|user|>\n' + message['content'] + '\n' }}\ - {%- elif message['role'] == 'assistant' %}\ - {%- if not loop.last %}\ - {{- '<|assistant|>\n' + message['content'] + eos_token + '\n' }}\ - {%- else %}\ - {{- '<|assistant|>\n' + message['content'] + eos_token }}\ - {%- endif %}\ - {%- endif %}\ - {%- if loop.last and add_generation_prompt %}\ - {{- '<|assistant|>\n' }}\ - {%- endif %}\ -{%- endfor %} -``` - -When working with multi-turn datasets, it's often necessary to extract specific fields from the data depending on the format. For example, in many multi-turn datasets, conversations may be stored under a dedicated key (e.g., `conversations`, `messages`, etc), and you may only need the content of that key for processing. - -``` -{ - "conversations": [ - {"content": "You are an AI...", "role": "system"}, - {"content": "Look up a word...", "role": "user"}, - {"content": "A word that rhymes is 'mist'", "role": "assistant"} - ], - "group": "lab_extension", - "dataset": "base/full-extension", - "metadata": "{\"num_turns\": 2}" -} - -``` -To extract and use the conversations field, pass the following flag when running: -``` ---dataset_conversation_field "conversations" -``` - -*Note:* For most cases, users using `Granite3.1+ Instruct` series models which already contain chat template should look to pass `--dataset_conversation_field "messages"` while using multi-turn data on the commandline or use `conversations_column` argument in the [data handler](https://github.com/foundation-model-stack/fms-hf-tuning/blob/30ceecc63f3e2bf3aadba2dfc3336b62187c240f/tests/artifacts/predefined_data_configs/mt_data_granite_3_1B_tokenize_and_mask_handler.yaml#L63) which processes chat template - -We recommend inspecting the data and chat template to decide if you need to pass this flag. - -### Guidelines - -Depending on various scenarios users might need to decide on how to use chat template with their data or which chat template to use for their use case. - -Following are the Guidelines from us in a flow chart : -![guidelines for chat template](docs/images/chat_template_guide.jpg) - -Here are some scenarios addressed in the flow chart: -1. Depending on the model the tokenizer for the model may or may not have a chat template -2. If the template is available then the `json object schema` of the dataset might not match the chat template's `string format` -3. There might be special tokens used in chat template which the tokenizer might be unaware of, for example `<|start_of_role|>` which can cause issues during tokenization as it might not be treated as a single token - - -#### Add Special Tokens -Working with multi-turn chat data might require the tokenizer to use a few new control tokens ( ex: `<|assistant|>`, `[SYS]` ) as described above in the guidelines. These special tokens might not be present in the tokenizer's vocabulary if the user is using base model. - -Users can pass `--add_special_tokens` argument which would add the required tokens to the tokenizer's vocabulary. -For example required special tokens used in `--instruction_template`/`--response_template` can be passed as follows: - -``` -python -m tuning.sft_trainer \ -... ---add_special_tokens "<|start_of_role|>" "<|end_of_role|>" \ ---instruction_template "<|start_of_role|>user<|end_of_role|>" \ ---response_template "<|start_of_role|>assistant<|end_of_role|>" -``` - -### 4. Pre tokenized datasets. - -Users can also pass a pretokenized dataset (containing `input_ids` and `labels` columns) as `--training_data_path` argument e.g. - -At this time, the data preprocessor does not add EOS tokens to pretokenized datasets, users must ensure EOS tokens are included in their pretokenized data if needed. - -``` -python tuning/sft_trainer.py ... --training_data_path twitter_complaints_tokenized_with_maykeye_tinyllama_v0.arrow -``` - -### Advanced data preprocessing. - -For advanced data preprocessing support including mixing and custom preprocessing of datasets please see [this document](./docs/advanced-data-preprocessing.md). +EOS tokens are added to all data formats listed below (EOS token is appended to the end of each data point, like a sentence or paragraph within the dataset), except for pretokenized data format at this time. For more info, see [pretokenized](./docs/advanced-data-preprocessing.md#4-pre-tokenized-datasets). ## Offline Data Preprocessing @@ -311,769 +77,12 @@ We also provide an interface for the user to perform standalone data preprocessi Please refer to [this document](docs/offline-data-preprocessing.md) for details on how to perform offline data processing. -## Supported Models - -- For each tuning technique, we run testing on a single large model of each architecture type and claim support for the smaller models. For example, with QLoRA technique, we tested on granite-34b GPTBigCode and claim support for granite-20b-multilingual. - -- LoRA Layers supported : All the linear layers of a model + output `lm_head` layer. Users can specify layers as a list or use `all-linear` as a shortcut. Layers are specific to a model architecture and can be specified as noted [here](https://github.com/foundation-model-stack/fms-hf-tuning?tab=readme-ov-file#lora-tuning-example) - -- Legend: - - ✅ Ready and available - - ✔️ Ready and available - compatible architecture (*see first bullet point above) - - 🚫 Not supported - - ? May be supported, but not tested - -Model Name & Size | Model Architecture | Full Finetuning | Low Rank Adaptation (i.e. LoRA) | qLoRA(quantized LoRA) | --------------------- | ---------------- | --------------- | ------------------------------- | --------------------- | -[Granite 4.0 Tiny Preview](https://huggingface.co/ibm-granite/granite-4.0-tiny-preview) | GraniteMoeHybridForCausalLM | ✅**** | ✅**** | ? | -[Granite PowerLM 3B](https://huggingface.co/ibm-research/PowerLM-3b) | GraniteForCausalLM | ✅* | ✅* | ✅* | -[Granite 3.1 1B](https://huggingface.co/ibm-granite/granite-3.1-1b-a400m-base) | GraniteForCausalLM | ✔️* | ✔️* | ✔️* | -[Granite 3.1 2B](https://huggingface.co/ibm-granite/granite-3.1-2b-base) | GraniteForCausalLM | ✔️* | ✔️* | ✔️* | -[Granite 3.1 8B](https://huggingface.co/ibm-granite/granite-3.1-8b-base) | GraniteForCausalLM | ✔️* | ✔️* | ✔️* | -[Granite 3.0 2B](https://huggingface.co/ibm-granite/granite-3.0-2b-base) | GraniteForCausalLM | ✔️* | ✔️* | ✔️* | -[Granite 3.0 8B](https://huggingface.co/ibm-granite/granite-3.0-8b-base) | GraniteForCausalLM | ✅* | ✅* | ✔️ | -[GraniteMoE 1B](https://huggingface.co/ibm-granite/granite-3.0-1b-a400m-base) | GraniteMoeForCausalLM | ✅ | ✅** | ? | -[GraniteMoE 3B](https://huggingface.co/ibm-granite/granite-3.0-3b-a800m-base) | GraniteMoeForCausalLM | ✅ | ✅** | ? | -[Granite 3B Code](https://huggingface.co/ibm-granite/granite-3b-code-base-2k) | LlamaForCausalLM | ✅ | ✔️ | ✔️ | -[Granite 8B Code](https://huggingface.co/ibm-granite/granite-8b-code-base-4k) | LlamaForCausalLM | ✅ | ✅ | ✅ | -Granite 13B | GPTBigCodeForCausalLM | ✅ | ✅ | ✔️ | -Granite 20B | GPTBigCodeForCausalLM | ✅ | ✔️ | ✔️ | -[Granite 34B Code](https://huggingface.co/ibm-granite/granite-34b-code-instruct-8k) | GPTBigCodeForCausalLM | 🚫 | ✅ | ✅ | -[Llama3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) | LlamaForCausalLM | ✅*** | ✔️ | ✔️ |   -[Llama3.1-70B](https://huggingface.co/meta-llama/Llama-3.1-70B)(same architecture as llama3) | LlamaForCausalLM | 🚫 - same as Llama3-70B | ✔️ | ✔️ | -[Llama3.1-405B](https://huggingface.co/meta-llama/Llama-3.1-405B) | LlamaForCausalLM | 🚫 | 🚫 | ✅ | -[Llama3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) | LlamaForCausalLM | ✅ | ✅ | ✔️ |   -[Llama3-70B](https://huggingface.co/meta-llama/Meta-Llama-3-70B) | LlamaForCausalLM | 🚫 | ✅ | ✅ | -aLLaM-13b | LlamaForCausalLM |  ✅ | ✅ | ✅ | -[Mixtral 8x7B](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) | MixtralForCausalLM | ✅ | ✅ | ✅ | -[Mistral-7b](https://huggingface.co/mistralai/Mistral-7B-v0.1) | MistralForCausalLM | ✅ | ✅ | ✅ |   -Mistral large | MistralForCausalLM | 🚫 | 🚫 | 🚫 | - -(*) - Supported with `fms-hf-tuning` v2.4.0 or later. - -(**) - Supported for q,k,v,o layers . `all-linear` target modules does not infer on vLLM yet. - -(***) - Supported from platform up to 8k context length - same architecture as llama3-8b. - -(****) - Experimentally supported. Dependent on stable transformers version with PR [#37658](https://github.com/huggingface/transformers/pull/37658) and accelerate >= 1.3.0. - -## Training - -### Single GPU - -Below example runs fine tuning with the given datasets and model: -1. Using pre-processed dataset for training. - -```bash -# if you want to use one GPU on multi-gpu machine -export CUDA_VISIBLE_DEVICES=0 - -# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint -# TRAIN_DATA_PATH=twitter_complaints.json # Path to the dataset - # contains data in single sequence {"output": "### Input: text \n\n### Response: text"} -# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved - -python tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 5 \ ---per_device_train_batch_size 4 \ ---gradient_accumulation_steps 4 \ ---learning_rate 1e-5 \ ---response_template "\n### Response:" \ ---dataset_text_field "output" -``` - -2. Using formatter with JSON/JSONL files - -```bash -# if you want to use one GPU on multi-gpu machine -export CUDA_VISIBLE_DEVICES=0 - -# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint -# TRAIN_DATA_PATH=twitter_complaints.json # Path to the dataset - # contains data in form of [{"input": text , "output": text}] -# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved - -python tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 5 \ ---per_device_train_batch_size 4 \ ---gradient_accumulation_steps 4 \ ---learning_rate 1e-5 \ ---response_template "\n## Label:" \ ---data_formatter_template: "### Input: {{input}} \n\n## Label: {{output}}" - -``` - -### Multiple GPUs with FSDP - -The recommendation is to use [huggingface accelerate](https://huggingface.co/docs/accelerate/en/index) to launch multi-gpu jobs, in particular when using FSDP: -- `accelerate` is written on top of [`torch.distributed.run`](https://github.com/pytorch/pytorch/blob/main/torch/distributed/run.py). -- `accelerate launch` CLI highly similar to `torchrun`, spawns multiple jobs (one for each gpu). -- tightly integrated with [huggingface Trainer](https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py). - -`accelerate launch` CLI to be run with specific command line arguments, see example below. Default arguments handled by passing in a -`--config_file` argument; see [reference docs](https://huggingface.co/docs/accelerate/en/package_reference/cli#accelerate-launch) and [fixtures/accelerate_fsdp_defaults.yaml](./fixtures/accelerate_fsdp_defaults.yaml) for sample defaults. - -Below example runs multi-GPU fine tuning on 8 GPUs with FSDP: -```bash -# Please set the environment variables: -# MASTER_PORT=1234 # The port at which the process with rank 0 listens to and should be set to an unused port -# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint -# TRAIN_DATA_PATH=twitter_complaints.json # Path to the training dataset -# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved - -accelerate launch \ ---config_file fixtures/accelerate_fsdp_defaults.yaml \ ---num_processes=8 \ ---main_process_port=$MASTER_PORT \ -tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---training_data_path $TRAIN_DATA_PATH \ ---torch_dtype bfloat16 \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 5 \ ---per_device_train_batch_size 4 \ ---gradient_accumulation_steps 4 \ ---learning_rate 1e-5 \ ---response_template "\n### Response:" \ ---dataset_text_field "output" \ ---tokenizer_name_or_path $MODEL_PATH # This field is optional and if not specified, tokenizer from model_name_or_path will be used -``` - -To summarize you can pick either python for single-GPU jobs or use accelerate launch for multi-GPU jobs. The following tuning techniques can be applied: - -### Tips on Parameters to Set - -#### Saving checkpoints while training (does not apply to Activated LoRA) - -By default, [`save_strategy`](tuning/config/configs.py) is set to `"epoch"` in the TrainingArguments. This means that checkpoints will be saved on each epoch. This can also be set to `"steps"` to save on every `"save_steps"` or `"no"` to not save any checkpoints. - -Checkpoints are saved to the given `output_dir`, which is a required field. If `save_strategy="no"`, the `output_dir` will only contain the training logs with loss details. - -A useful flag to set to limit the number of checkpoints saved is [`save_total_limit`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.save_total_limit). Older checkpoints are deleted from the `output_dir` to limit the number of checkpoints, for example, if `save_total_limit=1`, this will only save the last checkpoint. However, while tuning, two checkpoints will exist in `output_dir` for a short time as the new checkpoint is created and then the older one will be deleted. If the user sets a validation dataset and [`load_best_model_at_end`](https://huggingface.co/docs/transformers/en/main_classes/trainer#transformers.TrainingArguments.load_best_model_at_end), then the best checkpoint will be saved. - -#### Saving model after training - -`save_model_dir` can optionally be set to save the tuned model using `SFTTrainer.save_model()`. This can be used in tandem with `save_strategy="no"` to only save the designated checkpoint and not any intermediate checkpoints, which can help to save space. - -`save_model_dir` can be set to a different directory than `output_dir`. If set to the same directory, the designated checkpoint, training logs, and any intermediate checkpoints will all be saved to the same directory as seen below. - -
-Ways you can use `save_model_dir` and more tips: - -For example, if `save_model_dir` is set to a sub-directory of `output_dir`and `save_total_limit=1` with LoRA tuning, the directory would look like: - -```sh -$ ls /tmp/output_dir/ -checkpoint-35 save_model_dir training_logs.jsonl - -$ ls /tmp/output_dir/save_model_dir/ -README.md adapter_model.safetensors special_tokens_map.json tokenizer.model training_args.bin -adapter_config.json added_tokens.json tokenizer.json tokenizer_config.json -``` - -Here is an fine tuning example of how the directory would look if `output_dir` is set to the same value as `save_model_dir` and `save_total_limit=2`. Note the checkpoint directories as well as the `training_logs.jsonl`: - -```sh -$ ls /tmp/same_dir - -added_tokens.json model-00001-of-00006.safetensors model-00006-of-00006.safetensors tokenizer_config.json -checkpoint-16 model-00002-of-00006.safetensors model.safetensors.index.json training_args.bin -checkpoint-20 model-00003-of-00006.safetensors special_tokens_map.json training_logs.jsonl -config.json model-00004-of-00006.safetensors tokenizer.json -generation_config.json model-00005-of-00006.safetensors tokenizer.model -``` - -
- -#### Optimizing writing checkpoints -Writing models to Cloud Object Storage (COS) is an expensive operation. Saving model checkpoints to a local directory causes much faster training times than writing to COS. You can use `output_dir` and `save_model_dir` to control which type of storage you write your checkpoints and final model to. - -You can set `output_dir` to a local directory and set `save_model_dir` to COS to save time on write operations while ensuring checkpoints are saved. - -In order to achieve the fastest train time, set `save_strategy="no"`, as saving no checkpoints except for the final model will remove intermediate write operations all together. +## Additional Frameworks -#### Resuming tuning from checkpoints -If the output directory already contains checkpoints, tuning will automatically resume from the latest checkpoint in the directory specified by the `output_dir` flag. To start tuning from scratch and ignore existing checkpoints, set the `resume_from_checkpoint` flag to False. - -You can also use the resume_from_checkpoint flag to resume tuning from a specific checkpoint by providing the full path to the desired checkpoint as a string. This flag is passed as an argument to the [trainer.train()](https://github.com/huggingface/transformers/blob/db70426854fe7850f2c5834d633aff637f14772e/src/transformers/trainer.py#L1901) function of the SFTTrainer. - -#### Setting Gradient Checkpointing - -Training large models requires the usage of a lot of GPU memory. To reduce memory usage while training, consider setting the [`gradient_checkpointing`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.gradient_checkpointing) flag. - -Gradient Checkpointing is a method that stores only certain intermediate activations during the backward pass for recomputation. This avoids storing all of the intermediate activations from the forward pass, thus saving memory. The resulting reduced memory costs allow fitting larger models on the same GPU, with the tradeoff of a ~20% increase in the time required to fully train the model. More information about Gradient Checkpointing can be found in [this paper](https://arxiv.org/abs/1604.06174), as well as [here](https://github.com/cybertronai/gradient-checkpointing?tab=readme-ov-file#how-it-works). - -To enable this feature, add the `--gradient_checkpointing` flag as an argument when calling `sft_trainer`. - -## Tuning Techniques: - -### LoRA Tuning Example - -Set `peft_method` to `"lora"`. You can additionally pass any arguments from [LoraConfig](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/tuning/config/peft_config.py#L21). -```py -# Args you can pass -r: int =8 -lora_alpha: int = 32 -target_modules: List[str] = field( - default=None, - metadata={ - "help": "The names of the modules to apply LORA to. LORA selects modules which either \ - completely match or " - 'end with one of the strings. If the value is ["all-linear"], \ - then LORA selects all linear and Conv1D ' - "modules except for the output layer." - }, -) -bias = "none" -lora_dropout: float = 0.05 -``` -Example command to run: - -```bash -python tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 40 \ ---per_device_train_batch_size 4 \ ----learning_rate 1e-4 \ ---response_template "\n### Label:" \ ---dataset_text_field "output" \ ---peft_method "lora" \ ---r 8 \ ---lora_dropout 0.05 \ ---lora_alpha 16 \ ---target_modules c_attn c_proj -``` - -Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: -```json -{ - "model_name_or_path": $MODEL_PATH, - "training_data_path": $TRAIN_DATA_PATH, - "output_dir": $OUTPUT_PATH, - "num_train_epochs": 40.0, - "per_device_train_batch_size": 4, - "learning_rate": 1e-4, - "response_template": "\n### Label:", - "dataset_text_field": "output", - "peft_method": "lora", - "r": 8, - "lora_dropout": 0.05, - "lora_alpha": 16, - "target_modules": ["c_attn", "c_proj"] -} -``` - -Notice the `target_modules` are the names of the modules to apply the adapter to. -- If this is specified, only the modules with the specified names will be replaced. When passing a list of strings, either an exact match will be performed or it is checked if the name of the module ends with any of the passed strings. If this is specified as `all-linear`, then all linear/Conv1D modules are chosen, excluding the output layer. If this is specified as `lm_head` which is an output layer, the `lm_head` layer will be chosen. See the Note of this [section](#recommended-target-modules-per-model-architecture) on recommended target modules by model architecture. -- If this is not specified, modules will be chosen according to the model architecture. If the architecture is not known, an error will be raised — in this case, you should specify the target modules manually. See [HuggingFace docs](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig) for more details. - -#### How to get list of LoRA target_modules of a model -For each model, the `target_modules` will depend on the type of model architecture. You can specify linear or attention layers to `target_modules`. To obtain list of `target_modules` for a model: - -```py -from transformers import AutoModelForCausalLM -# load the model -model = AutoModelForCausalLM.from_pretrained(MODEL_PATH) -# see the module list -model.modules - -# to get just linear layers -import re -model_modules = str(model.modules) -pattern = r'\((\w+)\): Linear' -linear_layer_names = re.findall(pattern, model_modules) - -names = [] -for name in linear_layer_names: - names.append(name) -target_modules = list(set(names)) -``` - -For example for LLaMA model the modules look like: -``` - -``` - -You can specify attention or linear layers. With the CLI, you can specify layers with `--target_modules "q_proj" "v_proj" "k_proj" "o_proj"` or `--target_modules "all-linear"`. - -#### Recommended target modules per model architecture -As per [LoRA paper](https://arxiv.org/pdf/2106.09685), section 4.2 , by using the query and value projection matrices, we can achieve reasonable quality with efficient GPU utilization. Hence, while thinking about what LoRA adapters to specify, we recommend starting with query and value matrices. You could also refer to the defaults specified by PEFT library for popular model architectures in section [TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPING](https://github.com/huggingface/peft/blob/7b1c08d2b5e13d3c99b7d6ee83eab90e1216d4ba/src/peft/utils/constants.py#L70) as a good starting point. - -
- -How to specify lm_head as a target module - -Since `lm_head` is an output layer, it will **not** be included as a target module if you specify `all-linear`. You can, however, specify to apply the LoRA adapter to the `lm_head` layer by explicitly naming it in the `target_modules` arg. - -**NOTE**: Specifying `["lm_head", "all-linear"]` will not tune the `lm_head` layer, but will run the equivalent of `["all-linear"]`. To include `lm_head`, you must explicitly specify all of the layers to tune on. Using the example of the Llama model above, you would need to list `"q_proj" "v_proj" "k_proj" "o_proj" "lm_head"` to tune the all linear layers including `lm_head`. These 5 layers will be produced in the LoRA adapter. - -Example 1: -```json -{ - "target_modules": ["lm_head"] // this produces lm_head layer only -} -``` - -Example 2: -```json -{ - "target_modules": ["lm_head", "c_proj", "c_attn", "c_fc"] // this produces lm_head, c_proj, c_attn and c_fc layers -} -``` - -Example 3: -```json -{ - "target_modules": ["lm_head", "all-linear"] // this produces the equivalent of all-linear only, no lm_head -} -``` - -
- -#### Post-processing needed for inference on VLLM - -In order to run inference of LoRA adapters on vLLM, any new token embeddings added while tuning needs to be moved out of 'adapters.safetensors' to a new file 'new_embeddings.safetensors'. The 'adapters.safetensors' should only have LoRA weights and should not have modified embedding vectors. This is a requirement to support vLLM's paradigm that one base model can serve multiple adapters. New token embedding vectors are appended to the embedding matrix read from the base model by vLLM. - -To do this postprocessing, the tuning script sft_trainer.py will generate a file 'added_tokens_info.json' with model artifacts. After tuning, you can run script 'post_process_adapters_vLLM.py' : - -```bash -# model_path: Path to saved model artifacts which has file 'added_tokens_info.json' -# output_model_path: Optional. If you want to store modified \ -# artifacts in a different directory rather than modify in-place. -python scripts/post_process_adapters_vLLM.py \ ---model_path "/testing/tuning/output/post-process-LoRA-saved" \ ---output_model_path "/testing/tuning/output/post-process-LoRA-modified" -``` - -
- Alternatively, if using SDK : - -```bash -# function in tuning/utils/merge_model_utils.py -post_process_vLLM_adapters_new_tokens( - path_to_checkpoint="/testing/tuning/output/post-process-LoRA-saved", - modified_checkpoint_path=None, - num_added_tokens=1, -) -# where num_added_tokens is returned by sft_trainer.train() -``` -
- -_________________________ - -### Activated LoRA Tuning Example - -Activated LoRA (aLoRA) is a new low rank adapter architecture that allows for reusing existing base model KV cache for more efficient inference. This approach is best suited for inference pipelines which rely on the base model for most tasks/generations, but use aLoRA adapter(s) to perform specialized task(s) within the chain. For example, checking or rewriting generated outputs of the base model. - -[Paper](https://arxiv.org/abs/2504.12397) - -[IBM Research Blogpost](https://research.ibm.com/blog/inference-friendly-aloras) - -[Github](https://github.com/IBM/activated-lora) - -**Usage** Usage is very similar to standard LoRA, with the key difference that an invocation_string must be specified so that the model knows when to turn on i.e "activate" the adapter weights. The model will scan any input strings (during training or at test time) for this invocation_string, and activate the adapter weights 1 token after the start of the sequence. If there are multiple instances of the invocation_string in the same input, it will activate at the last such instance. - -**Note** Often (not always) aLoRA requires higher rank (r) than LoRA. r=32 can be a good starting point for challenging tasks. - -**Installation** The Activated LoRA requirements are an optional install in pyproject.toml (activated-lora) - -Set `peft_method` to `"alora"`. - -You *must* pass in an invocation_string argument. This invocation_string *must be present* in both training data inputs and the input at test time. A good solution is to set invocation_string = response_template, this will ensure that every training input will have the invocation_string present. We keep these separate arguments for flexibility. It is most robust if the invocation_string begins and ends with special tokens. - -You can additionally pass any arguments from [aLoraConfig](https://github.com/IBM/activated-lora/blob/fms-hf-tuning/alora/config.py#L35), see the LoRA section for examples. - -Example command to run, here using the ([Granite Instruct response template](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/main/tokenizer_config.json#L188)) as the invocation sequence: - -```bash -python tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 40 \ ---per_device_train_batch_size 4 \ ----learning_rate 1e-4 \ ---response_template "<|start_of_role|>assistant<|end_of_role|>" \ #this example uses special tokens in the Granite tokenizer, adjust for other models ---invocation_string "<|start_of_role|>assistant<|end_of_role|>" \ ---dataset_text_field "output" \ ---peft_method "alora" \ ---r 32 \ ---lora_dropout 0.05 \ ---lora_alpha 16 \ ---target_modules q_proj k_proj v_proj -``` - -Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: -```json -{ - "model_name_or_path": $MODEL_PATH, - "training_data_path": $TRAIN_DATA_PATH, - "output_dir": $OUTPUT_PATH, - "num_train_epochs": 40.0, - "per_device_train_batch_size": 4, - "learning_rate": 1e-4, - "response_template": "<|start_of_role|>assistant<|end_of_role|>", - "invocation_string": "<|start_of_role|>assistant<|end_of_role|>", - "dataset_text_field": "output", - "peft_method": "alora", - "r": 32, - "lora_dropout": 0.05, - "lora_alpha": 16, - "target_modules": ["q_proj", "k_proj", "v_proj"] -} -``` - -Notice the `target_modules` are the names of the modules to apply the adapter to. -- If this is specified, only the modules with the specified names will be replaced. When passing a list of strings, either an exact match will be performed or it is checked if the name of the module ends with any of the passed strings. If this is specified as `all-linear`, then all linear/Conv1D modules are chosen, excluding the output layer. -- If this is not specified, modules will be chosen according to the model architecture. If the architecture is not known, an error will be raised — in this case, you should specify the target modules manually. See [HuggingFace docs](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig) for more details. - - -#### How to get list of aLoRA target_modules of a model -See [How to get list of LoRA target_modules of a model](#how-to-get-list-of-lora-target_modules-of-a-model). - -#### Recommended target modules per model architecture -As per [aLoRA paper](https://arxiv.org/abs/2504.12397), by using the key, query and value projection matrices, we can achieve good quality with efficient GPU utilization. Hence, while thinking about what aLoRA adapters to specify, we recommend starting with key, query and value matrices. - -#### Intermediate checkpoint saving -Note that `sft_trainer.py` will always save the final trained model for you. If you want to save intermediate checkpoints from within the training process, the below applies. - -For now, `save_strategy` is not supported (it is always reset to `none`). You can either save the model once training is complete, or pass in a custom callback in `additional_callbacks` directly to `tuning.sft_trainer.train` to perform saving. For example the following (from [alora github](https://github.com/IBM/activated-lora/blob/fms-hf-tuning/train_scripts/finetune_example_callback.py)) saves and updates the best performing model so far, checking whenever eval is called according to `eval_strategy`: -```py -class SaveBestModelCallback(TrainerCallback): - def __init__(self): - self.best_eval_loss = float("inf") # Track best loss - - def on_evaluate(self, args, state, control, **kwargs): - """Save the best model manually during evaluation.""" - - model = kwargs["model"] - metrics = kwargs["metrics"] - - eval_loss = metrics.get("eval_loss") - if eval_loss is not None and eval_loss < self.best_eval_loss: - self.best_eval_loss = eval_loss # Update best loss - - # Manually save best model - model.save_pretrained(args.output_dir) -``` -#### Inference with aLoRA models -*Important* Inference with aLoRA models requires nsuring that the invocation string is present in the input (usually the end). - -Example inference: -```py -# Load the model -loaded_model = TunedCausalLM.load(ALORA_MODEL, BASE_MODEL_NAME, use_alora=True) - -# Retrieve the invocation string from the model config -invocation_string = loaded_model.peft_model.peft_config[ - loaded_model.peft_model.active_adapter -].invocation_string - -# In this case, we have the invocation string at the end of the input -input_string = "Simply put, the theory of relativity states that \n" + invocation_string - -# Run inference on the text -output_inference = loaded_model.run( - input_string, - max_new_tokens=50, -) -``` - -#### Running aLoRA models on VLLM - -Coming soon! For now, there is inference support in this package, or see [aLoRA github](https://github.com/IBM/activated-lora/experiments/inference_example.py) for example code demonstrating KV cache reuse from prior base model calls. - -__________ - - - -### GPTQ-LoRA with AutoGPTQ Tuning Example - -This method is similar to LoRA Tuning, but the base model is a quantized model. We currently only support GPTQ-LoRA model that has been quantized with 4-bit AutoGPTQ technique. Bits-and-Bytes (BNB) quantized LoRA is not yet enabled. -The qLoRA tuning technique is enabled via the [fms-acceleration](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/README.md#fms-acceleration) package. -You can see details on a sample configuration of Accelerated GPTQ-LoRA [here](https://github.com/foundation-model-stack/fms-acceleration/blob/main/sample-configurations/accelerated-peft-autogptq-sample-configuration.yaml). - - -To use GPTQ-LoRA technique, you can set the `quantized_lora_config` defined [here](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/tuning/config/acceleration_configs/quantized_lora_config.py). See the Notes section of FMS Acceleration doc [below](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/README.md#fms-acceleration) for usage. The only kernel we are supporting currently is `triton_v2`. - -In addition, LoRA tuning technique is required to be used, set `peft_method` to `"lora"` and pass any arguments from [LoraConfig](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/tuning/config/peft_config.py#L21). - -Example command to run: - -```bash -python tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 40 \ ---per_device_train_batch_size 4 \ ---learning_rate 1e-4 \ ---response_template "\n### Label:" \ ---dataset_text_field "output" \ ---peft_method "lora" \ ---r 8 \ ---lora_dropout 0.05 \ ---lora_alpha 16 \ ---target_modules c_attn c_proj \ ---auto_gptq triton_v2 \ # setting quantized_lora_config ---torch_dtype float16 \ # need this for triton_v2 ---fp16 \ # need this for triton_v2 -``` - -Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: - -```json -{ - "model_name_or_path": $MODEL_PATH, - "training_data_path": $TRAIN_DATA_PATH, - "output_dir": $OUTPUT_PATH, - "num_train_epochs": 40.0, - "per_device_train_batch_size": 4, - "learning_rate": 1e-4, - "response_template": "\n### Label:", - "dataset_text_field": "output", - "peft_method": "lora", - "r": 8, - "lora_dropout": 0.05, - "lora_alpha": 16, - "target_modules": ["c_attn", "c_proj"], - "auto_gptq": ["triton_v2"], // setting quantized_lora_config - "torch_dtype": "float16", // need this for triton_v2 - "fp16": true // need this for triton_v2 -} -``` - -Similarly to LoRA, the `target_modules` are the names of the modules to apply the adapter to. See the LoRA [section](#lora-tuning-example) on `target_modules` for more info. - -Note that with LoRA tuning technique, setting `all-linear` on `target_modules` returns linear modules. And with qLoRA tuning technique, `all-linear` returns all quant linear modules, excluding `lm_head`. - -_________________________ - -### Fine Tuning: - -Set `peft_method` to `'None'` or do not provide `peft_method` flag. - -Full fine tuning needs more compute resources, so it is advised to use the MultiGPU method. Example command: - -```bash -accelerate launch \ ---num_processes=4 ---config_file fixtures/accelerate_fsdp_defaults.yaml \ -tuning/sft_trainer.py \ ---model_name_or_path $MODEL_PATH \ ---tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used ---training_data_path $TRAIN_DATA_PATH \ ---output_dir $OUTPUT_PATH \ ---num_train_epochs 5 \ ---per_device_train_batch_size 4 \ ---learning_rate 1e-5 \ ---response_template "\n### Label:" \ ---dataset_text_field "output" \ ---peft_method "None" -``` - -Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: -```json -{ - "model_name_or_path": $MODEL_PATH, - "training_data_path": $TRAIN_DATA_PATH, - "output_dir": $OUTPUT_PATH, - "num_train_epochs": 5.0, - "per_device_train_batch_size": 4, - "learning_rate": 1e-5, - "response_template": "\n### Label:", - "dataset_text_field": "output", - "peft_method": "None" -} -``` - -### FMS Acceleration - -`fms-acceleration` is fuss-free approach to access a curated collection of acceleration plugins that acclerate your `tuning/sft-trainer.py` experience. Accelerations that apply to a variety of use-cases, e.g., PeFT / full-finetuning, are being planned for. As such, the accelerations are grouped into *plugins*; only install the plugins needed for the acceleration of interest. The plugins are housed in the [seperate repository found here](https://github.com/foundation-model-stack/fms-acceleration). - -To access `fms-acceleration` features the `[fms-accel]` dependency must first be installed: - ``` - $ pip install fms-hf-tuning[fms-accel] - ``` - -Furthermore, the required `fms-acceleration` plugin must be installed. This is done via the command line utility `fms_acceleration.cli`. To show available plugins: - ``` - $ python -m fms_acceleration.cli plugins - ``` -as well as to install the `fms_acceleration_peft`: - - ``` - $ python -m fms_acceleration.cli install fms_acceleration_peft - ``` - -If you do not know what plugin to install (or forget), the framework will remind - -``` -An acceleration feature is requested by specifying the '--auto_gptq' argument, but the this requires acceleration packages to be installed. Please do: -- python -m fms_acceleration.cli install fms_acceleration_peft -``` - -The list of configurations for various `fms_acceleration` plugins: -- [quantized_lora_config](./tuning/config/acceleration_configs/quantized_lora_config.py): For quantized 4bit LoRA training - - `--auto_gptq`: 4bit GPTQ-LoRA with AutoGPTQ - - `--bnb_qlora`: 4bit QLoRA with bitsandbytes -- [fused_ops_and_kernels](./tuning/config/acceleration_configs/fused_ops_and_kernels.py): - - `--fused_lora`: fused lora for more efficient LoRA training. - - `--fast_kernels`: fast cross-entropy, rope, rms loss kernels. -- [attention_and_distributed_packing](./tuning/config/acceleration_configs/attention_and_distributed_packing.py): - - `--padding_free`: technique to process multiple examples in single batch without adding padding tokens that waste compute. - - `--multipack`: technique for *multi-gpu training* to balance out number of tokens processed in each device, to minimize waiting time. -- [fast_moe_config](./tuning/config/acceleration_configs/fast_moe.py) (experimental): - - `--fast_moe`: trains MoE models in parallel with [Scatter MoE kernels](https://github.com/foundation-model-stack/fms-acceleration/tree/main/plugins/accelerated-moe#fms-acceleration-for-mixture-of-experts), increasing throughput and decreasing memory usage. - -Notes: - * `quantized_lora_config` requires that it be used along with LoRA tuning technique. See [LoRA tuning section](https://github.com/foundation-model-stack/fms-hf-tuning/tree/main?tab=readme-ov-file#lora-tuning-example) on the LoRA parameters to pass. - * When setting `--auto_gptq triton_v2` plus note to also pass `--torch_dtype float16` and `--fp16`, or an exception will be raised. This is because these kernels only support this dtype. - * When using `fused_ops_and_kernels` together with `quantized_lora_config`, - make sure to appropriately set `--fused_lora auto_gptq True` or `bitsandbytes True`; the `True` sets `fast_lora==True`. - * `fused_ops_and_kernels` works for full-finetuning, LoRA, QLoRA and GPTQ-LORA, - - Pass `--fast_kernels True True True` for full finetuning/LoRA - - Pass `--fast_kernels True True True --auto_gptq triton_v2 --fused_lora auto_gptq True` for GPTQ-LoRA - - Pass `--fast_kernels True True True --bitsandbytes nf4 --fused_lora bitsandbytes True` for QLoRA - - Note the list of supported models [here](https://github.com/foundation-model-stack/fms-acceleration/blob/main/plugins/fused-ops-and-kernels/README.md#supported-models). - * Notes on Padding Free - - Works for both *single* and *multi-gpu*. - - Works on both *pretokenized* and *untokenized* datasets - - Verified against the version found in HF main, merged in via PR https://github.com/huggingface/transformers/pull/31629. - * Notes on Multipack - - Works only for *multi-gpu*. - - Currently only includes the version of *multipack* optimized for linear attention implementations like *flash-attn*. - - Streaming datasets or use of `IterableDatasets` is not compatible with the fms-acceleration multipack plugin because multipack sampler has to run thorugh the full dataset every epoch. Using multipack and streaming together will raise an error. - * Notes on Fast MoE - - `--fast_moe` takes either an integer or boolean value. - - When an integer `n` is passed, it enables expert parallel sharding with the expert parallel degree as `n` along with Scatter MoE kernels enabled. - - When a boolean is passed, the expert parallel degree defaults to 1 and further the behaviour would be as follows: - - if True, it is Scatter MoE Kernels with experts sharded based on the top level sharding protocol (e.g. FSDP). - - if False, Scatter MoE Kernels with complete replication of experts across ranks. - - FSDP must be used when lora tuning with `--fast_moe` - - lora tuning with ScatterMoE is supported, but because of inference restrictions on vLLM/vanilla PEFT, the expert layers and router linear layer should not be trained as `target_modules` for models being tuned with ScatterMoE. Users have control over which `target_modules` they wish to train: - - At this time, only attention layers are trainable when using LoRA with scatterMoE. Until support for the router linear layer is added in, target modules must be specified explicitly (i.e `target_modules: ["q_proj", "v_proj", "o_proj", "k_proj"]`) instead of passing `target_modules: ["all-linear"]`. - - `world_size` must be divisible by the `ep_degree` - - `number of experts` in the MoE module must be divisible by the `ep_degree` - - Running fast moe modifies the state dict of the model, and must be post-processed which happens automatically and the converted checkpoint can be found at `hf_converted_checkpoint` folder within every saved checkpoint directory. Alternatively, we can perform similar option manually through [checkpoint utils](https://github.com/foundation-model-stack/fms-acceleration/blob/main/plugins/accelerated-moe/src/fms_acceleration_moe/utils/checkpoint_utils.py) script. - - The typical usecase for this script is to run: - ``` - python -m fms_acceleration_moe.utils.checkpoint_utils \ - \ - \ - - ``` - -Note: To pass the above flags via a JSON config, each of the flags expects the value to be a mixed type list, so the values must be a list. For example: -```json -{ - "fast_kernels": [true, true, true], - "padding_free": ["huggingface"], - "multipack": [16], - "auto_gptq": ["triton_v2"] -} -``` - -Activate `TRANSFORMERS_VERBOSITY=info` to see the huggingface trainer printouts and verify that `AccelerationFramework` is activated! - -``` -# this printout will be seen in huggingface trainer logs if acceleration is activated -***** FMS AccelerationFramework ***** -Active Plugin: AutoGPTQAccelerationPlugin. Python package: fms_acceleration_peft. Version: 0.0.1. -***** Running training ***** -Num examples = 1,549 -Num Epochs = 1 -Instantaneous batch size per device = 4 -Total train batch size (w. parallel, distributed & accumulation) = 4 -Gradient Accumulation steps = 1 -Total optimization steps = 200 -Number of trainable parameters = 13,631,488 -``` - -The `fms_acceleration.cli` can do more to search for all available configs, plugins and arguments, [see the advanced flow](https://github.com/foundation-model-stack/fms-acceleration#advanced-flow). - - -## Extended Pre-Training - -We also have support for extended pre training where users might wanna pretrain a model with large number of samples. Please refer our separate doc on [EPT Use Cases](./docs/ept.md) - -## Tuning Vision Language Models - -We also support full fine-tuning and LoRA tuning for vision language models - `Granite 3.2 Vision`, `Llama 3.2 Vision`, and `LLaVa-Next`. -For information on supported dataset formats and how to tune a vision-language model, please see [this document](./docs/vision-language-model-tuning.md). - -### Supported vision model - -Note that vision models are supported starting with `fms-hf-tuning` v2.8.1 or later. - -- Legend: - - ✅ Ready and available - - ✔️ Ready and available - compatible architecture - - 🚫 Not supported - - ? May be supported, but not tested - -Model Name & Size | Model Architecture | LoRA Tuning | Full Finetuning | --------------------- | ---------------- | --------------- | --------------- | -Llama 3.2-11B Vision | MllamaForConditionalGeneration | ✅ | ✅ | -Llama 3.2-90B Vision | MllamaForConditionalGeneration | ✔️ | ✔️ | -Granite 3.2-2B Vision | LlavaNextForConditionalGeneration | ✅ | ✅ | -Llava Mistral 1.6-7B | LlavaNextForConditionalGeneration | ✅ | ✅ | -Llava 1.6-34B | LlavaNextForConditionalGeneration | ✔️ | ✔️ | -Llava 1.5-7B | LlavaForConditionalGeneration | ✅ | ✅ | -Llava 1.5-13B | LlavaForConditionalGeneration | ✔️ | ✔️ | - -**Note**: vLLM currently does not support inference with LoRA-tuned vision models. To use a tuned LoRA adapter of vision model, please merge it with the base model before running vLLM inference. - -## Inference +### Inference Currently, we do *not* offer inference support as part of the library, but we provide a standalone script for running inference on tuned models for testing purposes. For a full list of options run `python scripts/run_inference.py --help`. Note that no data formatting / templating is applied at inference time. -### Running a single example +#### Running a single example If you want to run a single example through a model, you can pass it with the `--text` flag. ```bash @@ -1084,7 +93,7 @@ python scripts/run_inference.py \ --out_file result.json ``` -### Running multiple examples +#### Running multiple examples To run multiple examples, pass a path to a file containing each source text as its own line. Example: Contents of `source_texts.txt` @@ -1101,7 +110,7 @@ python scripts/run_inference.py \ --out_file result.json ``` -### Inference Results Format +#### Inference Results Format After running the inference script, the specified `--out_file` will be a JSON file, where each text has the original input string and the predicted output string, as follows. Note that due to the implementation of `.generate()` in Transformers, in general, the input string will be contained in the output string as well. ``` [ @@ -1113,14 +122,16 @@ After running the inference script, the specified `--out_file` will be a JSON fi ] ``` -### Changing the Base Model for Inference +#### Changing the Base Model for Inference If you tuned a model using a *local* base model, then a machine-specific path will be saved into your checkpoint by Peft, specifically the `adapter_config.json`. This can be problematic if you are running inference on a different machine than you used for tuning. As a workaround, the CLI for inference provides an arg for `--base_model_name_or_path`, where a new base model may be passed to run inference with. This will patch the `base_model_name_or_path` in your checkpoint's `adapter_config.json` while loading the model, and restore it to its original value after completion. Alternatively, if you like, you can change the config's value yourself. NOTE: This can also be an issue for tokenizers (with the `tokenizer_name_or_path` config entry). We currently do not allow tokenizer patching since the tokenizer can also be explicitly configured within the base model and checkpoint model, but may choose to expose an override for the `tokenizer_name_or_path` in the future. -## Validation +### Validation + +For examples on how to run inference on models trained via fms-hf-tuning see [Inference](./docs/tuning.md#inference) document. We can use [`lm-evaluation-harness`](https://github.com/EleutherAI/lm-evaluation-harness) from EleutherAI for evaluating the generated model. For example, for the Llama-13B model, using the above command and the model at the end of Epoch 5, we evaluated MMLU score to be `53.9` compared to base model to be `52.8`. @@ -1140,28 +151,9 @@ python main.py \ The above runs several tasks with `hendrycksTest-*` being MMLU. -## Trainer Controller Framework - -Trainer controller is a framework for controlling the trainer loop using user-defined rules and metrics. - -This framework helps users define rules to capture scenarios like criteria for stopping an ongoing training (E.g validation loss reaching a certain target, validation loss increasing with epoch, training loss values for last 100 steps increasing etc). - -For details about how you can use set a custom stopping criteria and perform custom operations, see [examples/trainercontroller_configs/Readme.md](examples/trainercontroller_configs/Readme.md) - - -## Experiment Tracking - -Experiment tracking in fms-hf-tuning allows users to track their experiments with known trackers like [Aimstack](https://aimstack.io/), [MLflow Tracking](https://mlflow.org/docs/latest/tracking.html) or custom trackers built into the code like -[FileLoggingTracker](./tuning/trackers/filelogging_tracker.py) - -The code supports currently two trackers out of the box, -* `FileLoggingTracker` : A built in tracker which supports logging training loss to a file. -* `Aimstack` : A popular opensource tracker which can be used to track any metrics or metadata from the experiments. -* `MLflow Tracking` : Another popular opensource tracker which stores metrics, metadata or even artifacts from experiments. - -Further details on enabling and using the trackers mentioned above can be found [here](docs/experiment-tracking.md). - +### Trainer Controller Framework -## More Examples +Trainer controller is a framework for controlling the trainer loop using user-defined rules and metrics. For details about how you can use set a custom stopping criteria and perform custom operations, see [examples/trainercontroller_configs/Readme.md](examples/trainercontroller_configs/Readme.md) +### More Examples A good simple example can be found [here](examples/kfto-kueue-sft-trainer.yaml) which launches a Kubernetes-native `PyTorchJob` using the [Kubeflow Training Operator](https://github.com/kubeflow/training-operator/) with [Kueue](https://github.com/kubernetes-sigs/kueue) for the queue management of tuning jobs. diff --git a/build/Dockerfile b/build/Dockerfile index 698ea7ad8..4fec1bb52 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -21,7 +21,6 @@ ARG PYTHON_VERSION=3.12 ARG WHEEL_VERSION="" ## Enable Aimstack or MLflow if requested via ENABLE_AIM/MLFLOW set to "true" ARG ENABLE_AIM=false -ARG ENABLE_ALORA=false ARG ENABLE_MLFLOW=false ARG ENABLE_FMS_ACCELERATION=true ARG ENABLE_SCANNER=false @@ -127,7 +126,6 @@ ARG USER_UID ARG ENABLE_FMS_ACCELERATION ARG ENABLE_AIM ARG ENABLE_MLFLOW -ARG ENABLE_ALORA ARG ENABLE_SCANNER ARG ENABLE_CLEARML @@ -151,33 +149,35 @@ RUN if [[ -z "${WHEEL_VERSION}" ]]; \ fi && \ ls /tmp/*.whl >/tmp/bdist_name +# Ensures to always build mamba_ssm from source +ENV PIP_NO_BINARY=mamba-ssm,mamba_ssm + # Install from the wheel RUN --mount=type=cache,target=/home/${USER}/.cache/pip,uid=${USER_UID} \ python -m pip install --user wheel && \ python -m pip install --user "$(head bdist_name)" && \ - python -m pip install --user "$(head bdist_name)[flash-attn]" && \ python -m pip install --user --no-build-isolation "$(head bdist_name)[mamba]" +RUN python -m pip install --user --no-build-isolation "$(head bdist_name)[flash-attn]" + # fms_acceleration_peft = PEFT-training, e.g., 4bit QLoRA # fms_acceleration_foak = Fused LoRA and triton kernels # fms_acceleration_aadp = Padding-Free Flash Attention Computation # fms_acceleration_moe = Parallelized Mixture of Experts +# fms_acceleration_odm = Online Data Mixing RUN if [[ "${ENABLE_FMS_ACCELERATION}" == "true" ]]; then \ python -m pip install --user "$(head bdist_name)[fms-accel]"; \ python -m fms_acceleration.cli install fms_acceleration_peft; \ python -m fms_acceleration.cli install fms_acceleration_foak; \ python -m fms_acceleration.cli install fms_acceleration_aadp; \ python -m fms_acceleration.cli install fms_acceleration_moe; \ + python -m fms_acceleration.cli install fms_acceleration_odm; \ fi RUN if [[ "${ENABLE_AIM}" == "true" ]]; then \ python -m pip install --user "$(head bdist_name)[aim]"; \ fi -RUN if [[ "${ENABLE_ALORA}" == "true" ]]; then \ - python -m pip install --user "$(head bdist_name)[activated-lora]"; \ - fi - RUN if [[ "${ENABLE_MLFLOW}" == "true" ]]; then \ python -m pip install --user "$(head bdist_name)[mlflow]"; \ fi @@ -234,4 +234,4 @@ USER ${USER} COPY --from=python-installations /home/${USER}/.local /home/${USER}/.local ENV PYTHONPATH="/home/${USER}/.local/lib/python${PYTHON_VERSION}/site-packages" -CMD [ "python", "/app/accelerate_launch.py" ] +CMD [ "python", "/app/accelerate_launch.py" ] \ No newline at end of file diff --git a/build/nvcr.Dockerfile b/build/nvcr.Dockerfile new file mode 100644 index 000000000..e277b7f25 --- /dev/null +++ b/build/nvcr.Dockerfile @@ -0,0 +1,93 @@ +# Copyright The FMS HF Tuning Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +## Global Args ################################################################# +## If the nvcr container is updated, ensure to check the torch and python +## installation version inside the dockerfile before pushing changes. +ARG NVCR_IMAGE_VERSION=25.02-py3 + +# This is based on what is inside the NVCR image already +ARG PYTHON_VERSION=3.12 + +## Base Layer ################################################################## +FROM nvcr.io/nvidia/pytorch:${NVCR_IMAGE_VERSION} AS dev + +ARG USER=root +ARG USER_UID=0 +ARG WORKDIR=/app +ARG SOURCE_DIR=${WORKDIR}/fms-hf-tuning + +ARG ENABLE_FMS_ACCELERATION=true +ARG ENABLE_AIM=true +ARG ENABLE_MLFLOW=true +ARG ENABLE_SCANNER=true +ARG ENABLE_CLEARML=true +ARG ENABLE_TRITON_KERNELS=true +ARG ENABLE_MAMBA_SUPPORT=true + +# Ensures to always build mamba_ssm from source +ENV PIP_NO_BINARY=mamba-ssm,mamba_ssm + +RUN python -m pip install --upgrade pip + +# upgrade torch as the base layer contains only torch 2.7 +RUN pip install --upgrade --force-reinstall torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu128 + +# Install main package + flash attention +COPY . ${SOURCE_DIR} +RUN cd ${SOURCE_DIR} +RUN pip install --no-cache-dir ${SOURCE_DIR} && \ + pip install --no-cache-dir ${SOURCE_DIR}[flash-attn] + +# Optional extras +RUN if [[ "${ENABLE_FMS_ACCELERATION}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[fms-accel] && \ + python -m fms_acceleration.cli install fms_acceleration_peft && \ + python -m fms_acceleration.cli install fms_acceleration_foak && \ + python -m fms_acceleration.cli install fms_acceleration_aadp && \ + python -m fms_acceleration.cli install fms_acceleration_moe && \ + python -m fms_acceleration.cli install fms_acceleration_odm; \ + fi + +RUN if [[ "${ENABLE_AIM}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[aim]; \ + fi +RUN if [[ "${ENABLE_MLFLOW}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[mlflow]; \ + fi +RUN if [[ "${ENABLE_SCANNER}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[scanner-dev]; \ + fi +RUN if [[ "${ENABLE_CLEARML}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[clearml]; \ + fi +RUN if [[ "${ENABLE_MAMBA_SUPPORT}" == "true" ]]; then \ + pip install --no-cache-dir ${SOURCE_DIR}[mamba]; \ + fi +RUN if [[ "${ENABLE_TRITON_KERNELS}" == "true" ]]; then \ + pip install --no-cache-dir "git+https://github.com/triton-lang/triton.git@main#subdirectory=python/triton_kernels"; \ + fi + +RUN chmod -R g+rwX $WORKDIR /tmp +RUN mkdir -p /.cache && chmod -R 777 /.cache + +# Set Triton environment variables for qLoRA +ENV TRITON_HOME="/tmp/triton_home" +ENV TRITON_DUMP_DIR="/tmp/triton_dump_dir" +ENV TRITON_CACHE_DIR="/tmp/triton_cache_dir" +ENV TRITON_OVERRIDE_DIR="/tmp/triton_override_dir" + +WORKDIR $WORKDIR + +CMD ["${SOURCE_DIR}/build/accelerate_launch.py"] diff --git a/docs/advanced-data-preprocessing.md b/docs/advanced-data-preprocessing.md index 6f660e0da..b08e5476b 100644 --- a/docs/advanced-data-preprocessing.md +++ b/docs/advanced-data-preprocessing.md @@ -7,6 +7,23 @@ Our library also supports a powerful data processing backend which can be used b These things are supported via what we call a [`data_config`](#data-config) which can be passed as an argument to sft trainer. +## Supported Data File Formats +We support the following file formats via `--training_data_path` argument + +Data Format | Tested Support +------------|--------------- +JSON | ✅ +JSONL | ✅ +PARQUET | ✅ +ARROW | ✅ + +As iterated above, we also support passing a HF dataset ID directly via `--training_data_path` argument. + +**NOTE**: Due to the variety of supported data formats and file types, `--training_data_path` is handled as follows: +- If `--training_data_path` ends in a valid file extension (e.g., .json, .csv), it is treated as a file. +- If `--training_data_path` points to a valid folder, it is treated as a folder. +- If neither of these are true, the data preprocessor tries to load `--training_data_path` as a Hugging Face (HF) dataset ID. + ## Data Config Data config is a configuration file which `sft_trainer.py` supports as an argument via `--data_config_path` flag. In this @@ -17,7 +34,7 @@ process the datasets. Users can currently pass both YAML or JSON based configura The data config schema is designed to define datasets and their processing strategies in a structured way. It consists of the following top-level keys: - - `datapreprocessor`: Defines global data processing parameters, such as the type (`default`), sampling stopping strategy (`all_exhausted` or `first_exhausted`), and sampling seed for reproducibility. + - `datapreprocessor`: Defines global data processing parameters, such as the type (`default` or `odm`), sampling stopping strategy (`all_exhausted` or `first_exhausted`), and sampling seed for reproducibility. - `datasets`: A list of dataset configurations, each describing the dataset name, paths, optional builders, sampling ratios, and data handlers. At the top level, the data config schema looks like this: @@ -112,11 +129,29 @@ definitions: Users can create a data config file in any of YAML or JSON format they choose (we provide examples of YAML for ease of use). The file should follow the schema outlined above with the following parameters: `datapreprocessor`: - - `type` (optional, str): Type of data preprocessor, `default` is currently the only supported type. + - `type` (optional, str): Type of data preprocessor, `default` and `odm` are the two types supported. Use of `odm` requires [installation](./tuning-techniques.md#fms-acceleration) of `fms_acceleration_odm` package. - `streaming` (optional, bool): Stream datasets using [IterableDatasets](https://huggingface.co/docs/datasets/v3.2.0/en/package_reference/main_classes#datasets.IterableDataset). - `sampling_stopping_strategy` (optional, str): Dataset interleave stopping strategy in case of choosing to mix multiple datasets by weight, supported values are [`all_exhausted` or `first_exhausted`](https://huggingface.co/docs/datasets/v3.2.0/en/package_reference/main_classes#datasets.interleave_datasets.stopping_strategy), defaults to `all_exhausted`. - `seed` (optional, int): [seed](https://huggingface.co/docs/datasets/v3.2.0/en/package_reference/main_classes#datasets.interleave_datasets.seed) to use for interleaving datasets, for reproducibility choose same value, defaults to 42. - `chat_template` (optional, str): pass `chat_template` via data_config for multi-turn data, replaces existing default chat template. + - `odm` (optional): if `type` is odm, this field is required to be specific to provide configuration for online data mixing. + +Data handlers are customizable components within the data config that allow users to preprocess or manipulate individual datasets. We use [Hugging Face Map API](https://huggingface.co/docs/datasets/en/process#map) to apply these routines. +These functions can process the dataset in any way users require and the `list` of data handlers specified for each dataset are applied in order. +Each data handler has: +- `name`: The handler's unique identifier. +- `arguments`: A dictionary of parameters specific to the handler. + +#### Online data mixing section + +`odm` config has the following fields and is required when `datapreprocessor` `type` is `odm`. + +`odm`: + `update_interval` (optional, int, defaults to `1`): Multi-Armed Bandit (MAB) is used to learn from the training signals and then provide mixing probabilities across datasets. `update_interval` defines the frequency of updating the MAB with training signals in terms of step count. + `sampling_interval` (optional, int, defaults to `1`): Defines the frequency of choosing a dataset to sample from through MAB. The value is provided in terms of sample count. + `reward_type` (optional, str, defaults to `entropy`): Type of reward to be used to update MAB. Currently supported rewards are `train_loss`, `validation_loss`, `entropy`, `entropy3_varent1`, `entropy_last_token`, `gradnorm`. More details can be found [here](https://github.com/foundation-model-stack/fms-acceleration/tree/main/plugins/online-data-mixing#rewards). + `gamma` (optional, int, defaults to `0.1`): MAB hyper-parameter which is similar to exploration factor. + `eta` (optional, int, defaults to `0.1`): MAB hyper-parameter which is similar to learning rate. `datasets` (list): - `name` (optional, str): A unique identifier for the dataset. @@ -126,11 +161,6 @@ Users can create a data config file in any of YAML or JSON format they choose (w - `split` (optional, dict[str: float]): Defines how to split the dataset into training and validation sets. Requires both `train` and `validation` keys. - `data_handlers` (optional, list): A list of data handler configurations which preprocess the dataset. -Data handlers are customizable components within the data config that allow users to preprocess or manipulate individual datasets. We use [Hugging Face Map API](https://huggingface.co/docs/datasets/en/process#map) to apply these routines. -These functions can process the dataset in any way users require and the `list` of data handlers specified for each dataset are applied in order. -Each data handler has: -- `name`: The handler's unique identifier. -- `arguments`: A dictionary of parameters specific to the handler. We do provide some sample `data_configs` here, [predefined_data_configs](../tests/artifacts/predefined_data_configs/). @@ -175,6 +205,7 @@ We also allow users to pass a [`seed`](https://huggingface.co/docs/datasets/v3.2 Note: If a user specifies data sampling they can expect the datasets to be mixed and individual samples in the dataset to not be broken unless the max_seq_len argument is smaller than the length of individual samples in the dataset + ### Dataset Splitting In addition to [sampling and mixing](#data-mixing), our library supports **dataset splitting**, which allows users to split a dataset into training and validation splits using the `split` field in the dataset config. @@ -267,10 +298,20 @@ If the dataset size is known to the user, `max_steps` can be calculated as the t ### How users can specify the chat template +There are multiple ways to specify chat_template in `data_config.yaml`, +users could either specify path to `chat_template.jinja` file or update the chat_template directly. + In the `data_config.yaml` file: **✅ USE:** +```yaml +dataprocessor: + chat_template_path: "path/to/chat_template.jinja" +``` + +**✅ USE:** + ```yaml dataprocessor: chat_template: "my single line chat template" @@ -320,4 +361,206 @@ This can add extra backslashes to your chat template causing it to become invali We provide some example data configs [here](../tests/artifacts/predefined_data_configs/) +# Use cases supported via command line argument `training_data_path` + +For basic users who want to pass command line argument directly to our stack you can refer to the following supported data formats. + +### 1. Data formats with a single sequence and a specified response_template to use for masking on completion. + +#### 1.1 Pre-process the dataset + Pre-process the dataset to contain a single sequence of each data instance containing input + response. The trainer is configured to expect a `response template` as a string. For example, if one wants to prepare the `alpaca` format data to feed into this trainer, it is quite easy and can be done with the following code. + +```python +PROMPT_DICT = { + "prompt_input": ( + "Below is an instruction that describes a task, paired with an input that provides further context. " + "Write a response that appropriately completes the request.\n\n" + "### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:" + ), + "prompt_no_input": ( + "Below is an instruction that describes a task. " + "Write a response that appropriately completes the request.\n\n" + "### Instruction:\n{instruction}\n\n### Response:" + ), +} + +def format_alpaca_fn(example): + prompt_input, prompt_no_input = PROMPT_DICT['prompt_input'], PROMPT_DICT['prompt_no_input'] + output = prompt_input.format_map(example) if example.get("input", "") != "" else prompt_no_input.format_map(example) + output = f"{output} {example['output']}" + return {"output": output} + +ds = datasets.load_dataset('json', data_files='./stanford_alpaca/alpaca_data.json') + +alpaca_ds = ds['train'].map(format_alpaca_fn, remove_columns=['instruction', 'input']) +alpaca_ds.to_json("sft_alpaca_data.json") +``` + +The `response template` corresponding to the above dataset and the `Llama` tokenizer is: `\n### Response:"`. + +The same way can be applied to any dataset, with more info can be found [here](https://huggingface.co/docs/trl/main/en/sft_trainer#format-your-input-prompts). +Once the data is converted using the formatting function, pass the `dataset_text_field` containing the single sequence to the trainer. + +#### 1.2 Format the dataset on the fly + Pass a dataset and a `data_formatter_template` to use the formatting function on the fly while tuning. The template should specify fields of the dataset with `{{field}}`. While tuning, the data will be converted to a single sequence using the template. Data fields can contain alpha-numeric characters, spaces and the following special symbols - "." , "_", "-". + +Example: Train.json +`[{ "input" : , + "output" : , + }, + ... +]` +data_formatter_template: `### Input: {{input}} \n\n## Label: {{output}}` + +Formatting will happen on the fly while tuning. The keys in template should match fields in the dataset file. The `response template` corresponding to the above template will need to be supplied. in this case, `response template` = `\n## Label:`. + +##### In conclusion, if using the reponse_template and single sequence, either the `data_formatter_template` argument or `dataset_text_field` needs to be supplied to the trainer. + +### 2. Dataset with input and output fields (no response template) + + Pass a [supported dataset](#supported-data-formats) containing fields `"input"` with source text and `"output"` with class labels. Pre-format the input as you see fit. The output field will simply be concatenated to the end of input to create single sequence, and input will be masked. + + The `"input"` and `"output"` field names are mandatory and cannot be changed. + +Example: For a JSON dataset like, `Train.jsonl` + +``` +{"input": "### Input: Colorado is a state in USA ### Output:", "output": "USA : Location"} +{"input": "### Input: Arizona is also a state in USA ### Output:", "output": "USA : Location"} +``` + +### 3. Chat Style Single/Multi turn datasets + + Pass a dataset containing single/multi turn chat dataset. Your dataset could follow this format: + +``` +$ head -n 1 train.jsonl +{"messages": [{"content": "You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.", "role": "system"}, {"content": "Look up a word that rhymes with exist", "role": "user"}, {"content": "I found a word that rhymes with \"exist\":\n1\\. Mist", "role": "assistant"}], "group": "lab_extension", "dataset": "base/full-extension", "metadata": "{\"num_turns\": 1}"} +``` + +This format supports both single and multi-turn chat scenarios. + +The chat template used to render the dataset will default to `tokenizer.chat_template` from the model's tokenizer configuration. This can be overridden using the `--chat_template ` argument. For example, models like [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct), which include a [chat template](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/e0a466fb25b9e07e9c2dc93380a360189700d1f8/tokenizer_config.json#L188) in their `tokenizer_config.json`, do not require users to provide a chat template to process the data. + +Users do need to pass `--response_template` and `--instruction_template` which are pieces of text representing start of +`assistant` and `human` response inside the formatted chat template. +For the [granite model above](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/main/tokenizer_config.json#L188) for example, the values shall be. +``` +--instruction_template "<|start_of_role|>user<|end_of_role|>" +--response_template "<|start_of_role|>assistant<|end_of_role|>" +``` + +The code internally uses [`DataCollatorForCompletionOnlyLM`](https://github.com/huggingface/trl/blob/main/trl/trainer/utils.py#L93) to perform masking of text ensuring model learns only on the `assistant` responses for both single and multi turn chat. + +#### Aligning dataset formats +In some cases the chat template might not be aligned with the data format of the dataset. For example, consider the following data sample and suppose we want to use the list of contents associated with the `messages` key from the data sample for our multi-turn training job! + +``` +{ + "messages": [ + {"content": "You are an AI...", "role": "system"}, + {"content": "Look up a word...", "role": "user"}, + {"content": "A word that rhymes is 'mist'", "role": "assistant"} + ], + "group": "lab_extension", + "dataset": "base/full-extension", + "metadata": "{\"num_turns\": 2}" +} +``` +Different Chat templates support different data formats and the chat template might not always align with the data format of the dataset! + +Here is a example of chat template that iterates over the nested data sample by addressing the "messages" key in `for message in messages['messages']` : +``` +{% for message in messages['messages'] %}\ + {% if message['role'] == 'user' %}{{ '<|user|>\n' + message['content'] + eos_token }}\ + {% elif message['role'] == 'system' %}{{ '<|system|>\n' + message['content'] + eos_token }}\ + {% elif message['role'] == 'assistant' %}{{ '<|assistant|>\n' + message['content'] + eos_token }}\ + {% endif %}\ + {% if loop.last and add_generation_prompt %}{{ '<|assistant|>' }}\ + {% endif %}\ +{% endfor %} +``` +While the above template might be suitable for certain data formats, not all chat templates access the nested contents in a data sample. + +In the following example notice the `for message in messages` line which does not access any nested contents in the data and expects the nested content to be passed directly to the chat template! + +``` +{%- for message in messages %}\ + {%- if message['role'] == 'system' %}\ + {{- '<|system|>\n' + message['content'] + '\n' }}\ + {%- elif message['role'] == 'user' %}\ + {{- '<|user|>\n' + message['content'] + '\n' }}\ + {%- elif message['role'] == 'assistant' %}\ + {%- if not loop.last %}\ + {{- '<|assistant|>\n' + message['content'] + eos_token + '\n' }}\ + {%- else %}\ + {{- '<|assistant|>\n' + message['content'] + eos_token }}\ + {%- endif %}\ + {%- endif %}\ + {%- if loop.last and add_generation_prompt %}\ + {{- '<|assistant|>\n' }}\ + {%- endif %}\ +{%- endfor %} +``` + +When working with multi-turn datasets, it's often necessary to extract specific fields from the data depending on the format. For example, in many multi-turn datasets, conversations may be stored under a dedicated key (e.g., `conversations`, `messages`, etc), and you may only need the content of that key for processing. + +``` +{ + "conversations": [ + {"content": "You are an AI...", "role": "system"}, + {"content": "Look up a word...", "role": "user"}, + {"content": "A word that rhymes is 'mist'", "role": "assistant"} + ], + "group": "lab_extension", + "dataset": "base/full-extension", + "metadata": "{\"num_turns\": 2}" +} + +``` +To extract and use the conversations field, pass the following flag when running: +``` +--dataset_conversation_field "conversations" +``` + +*Note:* For most cases, users using `Granite3.1+ Instruct` series models which already contain chat template should look to pass `--dataset_conversation_field "messages"` while using multi-turn data on the commandline or use `conversations_column` argument in the [data handler](https://github.com/foundation-model-stack/fms-hf-tuning/blob/30ceecc63f3e2bf3aadba2dfc3336b62187c240f/tests/artifacts/predefined_data_configs/mt_data_granite_3_1B_tokenize_and_mask_handler.yaml#L63) which processes chat template + +We recommend inspecting the data and chat template to decide if you need to pass this flag. + +### Guidelines + +Depending on various scenarios users might need to decide on how to use chat template with their data or which chat template to use for their use case. + +Following are the Guidelines from us in a flow chart : +![guidelines for chat template](images/chat_template_guide.jpg) + +Here are some scenarios addressed in the flow chart: +1. Depending on the model the tokenizer for the model may or may not have a chat template +2. If the template is available then the `json object schema` of the dataset might not match the chat template's `string format` +3. There might be special tokens used in chat template which the tokenizer might be unaware of, for example `<|start_of_role|>` which can cause issues during tokenization as it might not be treated as a single token + + +#### Add Special Tokens +Working with multi-turn chat data might require the tokenizer to use a few new control tokens ( ex: `<|assistant|>`, `[SYS]` ) as described above in the guidelines. These special tokens might not be present in the tokenizer's vocabulary if the user is using base model. + +Users can pass `--add_special_tokens` argument which would add the required tokens to the tokenizer's vocabulary. +For example required special tokens used in `--instruction_template`/`--response_template` can be passed as follows: + +``` +python -m tuning.sft_trainer \ +... +--add_special_tokens "<|start_of_role|>" "<|end_of_role|>" \ +--instruction_template "<|start_of_role|>user<|end_of_role|>" \ +--response_template "<|start_of_role|>assistant<|end_of_role|>" +``` + +### 4. Pre tokenized datasets. + +Users can also pass a pretokenized dataset (containing `input_ids` and `labels` columns) as `--training_data_path` argument e.g. + +At this time, the data preprocessor does not add EOS tokens to pretokenized datasets, users must ensure EOS tokens are included in their pretokenized data if needed. + +``` +python tuning/sft_trainer.py ... --training_data_path twitter_complaints_tokenized_with_maykeye_tinyllama_v0.arrow +``` diff --git a/docs/ept.md b/docs/ept.md index 7c26d4ad7..f8c6ecfa2 100644 --- a/docs/ept.md +++ b/docs/ept.md @@ -18,8 +18,8 @@ Lets say you have a `JSONL` data file which contains text to be trained on in ea Example dataset, ``` -{"Tweet":"@HMRCcustomers No this is my first job","ID":0,"Label":2,"text_label":"no complaint","output":"### Text: @HMRCcustomers No this is my first job\n\n### Label: no complaint"} -{"Tweet":"@KristaMariePark Thank you for your interest! If you decide to cancel, you can call Customer Care at 1-800-NYTIMES.","ID":1,"Label":2,"text_label":"no complaint","output":"### Text: @KristaMariePark Thank you for your interest! If you decide to cancel, you can call Customer Care at 1-800-NYTIMES.\n\n### Label: no complaint"} +{"text":"I am one sample which doesn't exceed the max seq length"} +{"text":"I am also another sample which doesn't exceed the max seq length"} ... ``` @@ -27,17 +27,27 @@ Sample data config for the above use case. ``` dataprocessor: type: default + streaming: false datasets: - - name: non_tokenized_text_dataset + - name: apply_custom_jinja_template data_paths: - - "" - data_handlers: - - name: add_tokenizer_eos_token - arguments: - remove_columns: all - batched: false - fn_kwargs: - dataset_text_field: "dataset_text_field" + - "FILE_PATH" + data_handlers: + - name: apply_custom_jinja_template + arguments: + remove_columns: all + batched: false + fn_kwargs: + formatted_text_column_name: "formatted_text" + template: '{{element["text"]}}{{eos_token}}' + - name: tokenize + arguments: + remove_columns: all + batched: false + fn_kwargs: + text_column_name: "formatted_text" + truncation: false + max_length: 4096 ``` And the commandline passed to the library should include following. @@ -46,7 +56,7 @@ And the commandline passed to the library should include following. --data_config_path --packing=True --max_seq_len 8192 ``` -Please note that for non tokenized dataset our code adds `EOS_TOKEN` to the lines, for e.g. `Tweet` column before passing that as a dataset. +Please note that for non tokenized dataset our code adds `EOS_TOKEN` to the lines, for e.g. `text` column before tokenizing and passing that as a dataset. ### Multiple Non Tokenized Datasets diff --git a/docs/experiment-tracking.md b/docs/experiment-tracking.md index 598a1941b..d0fbdbf8d 100644 --- a/docs/experiment-tracking.md +++ b/docs/experiment-tracking.md @@ -18,9 +18,6 @@ sft_trainer.train(train_args=training_args,...) For each of the requested trackers the code expects you to pass a config to the `sft_trainer.train` function which can be specified through `tracker_conifgs` argument [here](https://github.com/foundation-model-stack/fms-hf-tuning/blob/a9b8ec8d1d50211873e63fa4641054f704be8712/tuning/sft_trainer.py#L78) details of which are present below. - - - ## Tracker Configurations ## File Logging Tracker diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 000000000..5ce2ed4bd --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,73 @@ +# Table of Contents + +Table of contents: + - [Basic Installations](#basic-installation) + - [Installing FlashAttention](#using-flashattention) + - [Installing Fms Acceleration](#using-fms-acceleration) + - [Installing Mamba Model Support](#training-mamba-models) + - [Installing Experiment Tracker Support](#using-experiment-trackers) + +## Basic Installation + +``` +pip install fms-hf-tuning +``` + +## Using FlashAttention + +> Note: After installing, if you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: +```sh +pip install fms-hf-tuning[dev] +pip install fms-hf-tuning[flash-attn] +``` +[FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. + +*Debug recommendation:* While training, if you encounter flash-attn errors such as `undefined symbol`, you can follow the below steps for clean installation of flash binaries. This may occur when having multiple environments sharing the pip cache directory or torch version is updated. + +```sh +pip uninstall flash-attn +pip cache purge +pip install fms-hf-tuning[flash-attn] +``` + +## Using FMS-Acceleration + +`fms-acceleration` is a collection of plugins that packages that accelerate fine-tuning / training of large models, as part of the `fms-hf-tuning` suite. For more details see [this document](./docs/tuning-techniques.md#fms-acceleration). + +If you wish to use [fms-acceleration](https://github.com/foundation-model-stack/fms-acceleration), you need to install it. +``` +pip install fms-hf-tuning[fms-accel] +``` + +## Using Experiment Trackers +Experiment tracking in fms-hf-tuning allows users to track their experiments with known trackers like [Aimstack](https://aimstack.io/), [MLflow Tracking](https://mlflow.org/docs/latest/tracking.html), [Clearml Tracking](https://clear.ml/) or custom trackers built into the code like +[FileLoggingTracker](./tuning/trackers/filelogging_tracker.py) + +The code supports currently these trackers out of the box, +* `FileLoggingTracker` : A built in tracker which supports logging training loss to a file. + - Since this is builin no need to install anything. +* `Aimstack` : A popular opensource tracker which can be used to track any metrics or metadata from the experiments. + - Install by running + `pip install fms-hf-tuning[aim]` +* `MLflow Tracking` : Another popular opensource tracker which stores metrics, metadata or even artifacts from experiments. + - Install by running + `pip install fms-hf-tuning[mlflow]` +* `Clearml Tracking` : Another opensource tracker which stores metrics, metadata or even artifacts from experiments. + - Install by running + `pip install fms-hf-tuning[clearml]` + +Note. All trackers expect some arguments or can be customized by passing command line arguments which are described in our document on [experiment tracking](./experiment-tracking.md). For further details on enabling and using the trackers use the experiment tracking document. + +## Training Mamba Models + +To train Mamba models one needs to have `mamba-ssm` package installed which is compatible with fms-hf-tuning to ensure the optimal training. Not using this package while training Mamba models can result in higher resource usage and suboptimal performance. + +Install this as +``` +pip install fms-hf-tuning[mamba] +``` + + +``` +pip install fms-hf-tuning +``` \ No newline at end of file diff --git a/docs/offline-data-preprocessing.md b/docs/offline-data-preprocessing.md index 0133411db..883d54f81 100644 --- a/docs/offline-data-preprocessing.md +++ b/docs/offline-data-preprocessing.md @@ -33,7 +33,8 @@ python -m tuning.sft_trainer \ --output_dir /path/to/output/directory \ --log_level info \ --num_train_dataset_shards 10 \ ---num_eval_dataset_shards 1 +--num_eval_dataset_shards 1 \ +--do_dataprocessing_only ``` Additionally, once the offline data processing is complete, users can leverage the shards stored in `output_dir` for tuning by passing it through the `--training_data_path` flag or passing it via `data_paths` argument in data config yaml, provided they find the sharded datasets beneficial for training. @@ -113,7 +114,8 @@ python -m tuning.sft_trainer \ --response_template "<|start_of_role|>assistant<|end_of_role|>" \ --split_batches "true" \ --use_flash_attn "true" \ ---num_train_dataset_shards "10" +--num_train_dataset_shards "10" \ +--do_dataprocessing_only ``` The resulting shards are saved in the directory `/test/data/offline_processing_shards`, as specified by the `--output_dir` argument. These shards can then be used for tuning the model by pointing the `training_data_path` argument to the directory where the shards are stored—in this example, @@ -175,5 +177,6 @@ accelerate launch \ --use_reentrant="true" \ --warmup_ratio="0.1" \ --warmup_steps="200" \ - --weight_decay="0.1" -``` \ No newline at end of file + --weight_decay="0.1" \ + --do_dataprocessing_only +``` diff --git a/docs/supported-models.md b/docs/supported-models.md new file mode 100644 index 000000000..345dfcec5 --- /dev/null +++ b/docs/supported-models.md @@ -0,0 +1,61 @@ +# Supported models list + +- Legend: + + ✅ Ready and available + + ✔️ Ready and available - compatible architecture (*see first bullet point above) + + 🚫 Not supported + + ? May be supported, but not tested + +Model Name & Size | Model Architecture | Full Finetuning | Low Rank Adaptation (i.e. LoRA) | qLoRA(quantized LoRA) | +-------------------- | ---------------- | --------------- | ------------------------------- | --------------------- | +[Granite 4.0 Tiny Preview](https://huggingface.co/ibm-granite/granite-4.0-tiny-preview) | GraniteMoeHybridForCausalLM | ✅ | ✅ | ? | +[Granite PowerLM 3B](https://huggingface.co/ibm-research/PowerLM-3b) | GraniteForCausalLM | ✅ | ✅ | ✅ | +[Granite 3.1 1B](https://huggingface.co/ibm-granite/granite-3.1-1b-a400m-base) | GraniteForCausalLM | ✔️ | ✔️ | ✔️ | +[Granite 3.1 2B](https://huggingface.co/ibm-granite/granite-3.1-2b-base) | GraniteForCausalLM | ✔️ | ✔️ | ✔️ | +[Granite 3.1 8B](https://huggingface.co/ibm-granite/granite-3.1-8b-base) | GraniteForCausalLM | ✔️ | ✔️ | ✔️ | +[Granite 3.0 2B](https://huggingface.co/ibm-granite/granite-3.0-2b-base) | GraniteForCausalLM | ✔️ | ✔️ | ✔️ | +[Granite 3.0 8B](https://huggingface.co/ibm-granite/granite-3.0-8b-base) | GraniteForCausalLM | ✅ | ✅ | ✔️ | +[GraniteMoE 1B](https://huggingface.co/ibm-granite/granite-3.0-1b-a400m-base) | GraniteMoeForCausalLM | ✅ | ✅* | ? | +[GraniteMoE 3B](https://huggingface.co/ibm-granite/granite-3.0-3b-a800m-base) | GraniteMoeForCausalLM | ✅ | ✅* | ? | +[Granite 3B Code](https://huggingface.co/ibm-granite/granite-3b-code-base-2k) | LlamaForCausalLM | ✅ | ✔️ | ✔️ | +[Granite 8B Code](https://huggingface.co/ibm-granite/granite-8b-code-base-4k) | LlamaForCausalLM | ✅ | ✅ | ✅ | +Granite 13B | GPTBigCodeForCausalLM | ✅ | ✅ | ✔️ | +Granite 20B | GPTBigCodeForCausalLM | ✅ | ✔️ | ✔️ | +[Granite 34B Code](https://huggingface.co/ibm-granite/granite-34b-code-instruct-8k) | GPTBigCodeForCausalLM | 🚫 | ✅ | ✅ | +[Llama3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) | LlamaForCausalLM | ✅** | ✔️ | ✔️ |   +[Llama3.1-70B](https://huggingface.co/meta-llama/Llama-3.1-70B)(same architecture as llama3) | LlamaForCausalLM | 🚫 - same as Llama3-70B | ✔️ | ✔️ | +[Llama3.1-405B](https://huggingface.co/meta-llama/Llama-3.1-405B) | LlamaForCausalLM | 🚫 | 🚫 | ✅ | +[Llama3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) | LlamaForCausalLM | ✅ | ✅ | ✔️ |   +[Llama3-70B](https://huggingface.co/meta-llama/Meta-Llama-3-70B) | LlamaForCausalLM | 🚫 | ✅ | ✅ | +aLLaM-13b | LlamaForCausalLM |  ✅ | ✅ | ✅ | +[Mixtral 8x7B](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) | MixtralForCausalLM | ✅ | ✅ | ✅ | +[Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) | MistralForCausalLM | ✅ | ✅ | ✅ |   +Mistral large | MistralForCausalLM | 🚫 | 🚫 | 🚫 | +[GPT-OSS-20B](https://huggingface.co/openai/gpt-oss-20b) | GptOssForCausalLM | ✅ | ✅ | ? |   +[GPT-OSS-120B](https://huggingface.co/openai/gpt-oss-120b) | GptOssForCausalLM | ✅ | ✅ | ? |   + +(*) - Supported for q,k,v,o layers . `all-linear` target modules does not infer on vLLM yet. + +(**) - Supported from platform up to 8k context length - same architecture as llama3-8b. + +### Supported vision model + +We also support full fine-tuning and LoRA tuning for vision language models - `Granite 3.2 Vision`, `Llama 3.2 Vision`, and `LLaVa-Next` from `v2.8.1` onwards. +For information on supported dataset formats and how to tune a vision-language model, please see [this document](./vision-language-model-tuning.md). + +Model Name & Size | Model Architecture | LoRA Tuning | Full Finetuning | +-------------------- | ---------------- | --------------- | --------------- | +Llama 3.2-11B Vision | MllamaForConditionalGeneration | ✅ | ✅ | +Llama 3.2-90B Vision | MllamaForConditionalGeneration | ✔️ | ✔️ | +Granite 3.2-2B Vision | LlavaNextForConditionalGeneration | ✅ | ✅ | +Llava Mistral 1.6-7B | LlavaNextForConditionalGeneration | ✅ | ✅ | +Llava 1.6-34B | LlavaNextForConditionalGeneration | ✔️ | ✔️ | +Llava 1.5-7B | LlavaForConditionalGeneration | ✅ | ✅ | +Llava 1.5-13B | LlavaForConditionalGeneration | ✔️ | ✔️ | + +**Note**: +* vLLM currently does not support inference with LoRA-tuned vision models. To use a tuned LoRA adapter of vision model, please merge it with the base model before running vLLM inference. \ No newline at end of file diff --git a/docs/training.md b/docs/training.md new file mode 100644 index 000000000..40f3c90b9 --- /dev/null +++ b/docs/training.md @@ -0,0 +1,257 @@ +# Training with fms-hf-tuning + +- [Training with fms-hf-tuning](#training-with-fms-hf-tuning) + - [Single GPU](#single-gpu) + - [Using pre-processed dataset](#single-gpu) + - [Using formatter with JSON/JSONL files](#single-gpu) + - [Multiple GPUs with FSDP](#multiple-gpus-with-fsdp) + - [Tips on Parameters to Set](#tips-on-parameters-to-set) + - [Saving checkpoints while training](#saving-checkpoints-while-training-does-not-apply-to-activated-lora) + - [Saving model after training](#saving-model-after-training) + - [Ways you can use `save_model_dir` and more tips](#ways-you-can-use-save_model_dir-and-more-tips) + - [Optimizing writing checkpoints](#optimizing-writing-checkpoints) + - [Resuming tuning from checkpoints](#resuming-tuning-from-checkpoints) + - [Setting Gradient Checkpointing](#setting-gradient-checkpointing) + - [Training MXFP4 quantized with fms-hf-tuning](#training-mxfp4-quantized-models) + + +## Single GPU + +Below example runs fine tuning with the given datasets and model: +1. Using pre-processed dataset for training. + +```bash +# if you want to use one GPU on multi-gpu machine +export CUDA_VISIBLE_DEVICES=0 + +# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint +# TRAIN_DATA_PATH=twitter_complaints.json # Path to the dataset + # contains data in single sequence {"output": "### Input: text \n\n### Response: text"} +# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved + +python tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 5 \ +--per_device_train_batch_size 4 \ +--gradient_accumulation_steps 4 \ +--learning_rate 1e-5 \ +--response_template "\n### Response:" \ +--dataset_text_field "output" +``` + +2. Using formatter with JSON/JSONL files + +```bash +# if you want to use one GPU on multi-gpu machine +export CUDA_VISIBLE_DEVICES=0 + +# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint +# TRAIN_DATA_PATH=twitter_complaints.json # Path to the dataset + # contains data in form of [{"input": text , "output": text}] +# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved + +python tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 5 \ +--per_device_train_batch_size 4 \ +--gradient_accumulation_steps 4 \ +--learning_rate 1e-5 \ +--response_template "\n## Label:" \ +--data_formatter_template: "### Input: {{input}} \n\n## Label: {{output}}" + +``` + +## Multiple GPUs with FSDP + +The recommendation is to use [huggingface accelerate](https://huggingface.co/docs/accelerate/en/index) to launch multi-gpu jobs, in particular when using FSDP: +- `accelerate` is written on top of [`torch.distributed.run`](https://github.com/pytorch/pytorch/blob/main/torch/distributed/run.py). +- `accelerate launch` CLI highly similar to `torchrun`, spawns multiple jobs (one for each gpu). +- tightly integrated with [huggingface Trainer](https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py). + +`accelerate launch` CLI to be run with specific command line arguments, see example below. Default arguments handled by passing in a +`--config_file` argument; see [reference docs](https://huggingface.co/docs/accelerate/en/package_reference/cli#accelerate-launch) and [fixtures/accelerate_fsdp_defaults.yaml](./fixtures/accelerate_fsdp_defaults.yaml) for sample defaults. + +Below example runs multi-GPU fine tuning on 8 GPUs with FSDP: +```bash +# Please set the environment variables: +# MASTER_PORT=1234 # The port at which the process with rank 0 listens to and should be set to an unused port +# MODEL_PATH=meta-llama/Llama-2-7b-hf # Huggingface model id or path to a checkpoint +# TRAIN_DATA_PATH=twitter_complaints.json # Path to the training dataset +# OUTPUT_PATH=out # Path to the output folder where the checkpoints are saved + +accelerate launch \ +--config_file fixtures/accelerate_fsdp_defaults.yaml \ +--num_processes=8 \ +--main_process_port=$MASTER_PORT \ +tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--training_data_path $TRAIN_DATA_PATH \ +--torch_dtype bfloat16 \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 5 \ +--per_device_train_batch_size 4 \ +--gradient_accumulation_steps 4 \ +--learning_rate 1e-5 \ +--response_template "\n### Response:" \ +--dataset_text_field "output" \ +--tokenizer_name_or_path $MODEL_PATH # This field is optional and if not specified, tokenizer from model_name_or_path will be used +``` + +To summarize you can pick either python for single-GPU jobs or use accelerate launch for multi-GPU jobs. The following tuning techniques can be applied: + +# Tips on Parameters to Set + +## Saving checkpoints while training (does not apply to Activated LoRA) + +By default, [`save_strategy`](tuning/config/configs.py) is set to `"epoch"` in the TrainingArguments. This means that checkpoints will be saved on each epoch. This can also be set to `"steps"` to save on every `"save_steps"` or `"no"` to not save any checkpoints. + +Checkpoints are saved to the given `output_dir`, which is a required field. If `save_strategy="no"`, the `output_dir` will only contain the training logs with loss details. + +A useful flag to set to limit the number of checkpoints saved is [`save_total_limit`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.save_total_limit). Older checkpoints are deleted from the `output_dir` to limit the number of checkpoints, for example, if `save_total_limit=1`, this will only save the last checkpoint. However, while tuning, two checkpoints will exist in `output_dir` for a short time as the new checkpoint is created and then the older one will be deleted. If the user sets a validation dataset and [`load_best_model_at_end`](https://huggingface.co/docs/transformers/en/main_classes/trainer#transformers.TrainingArguments.load_best_model_at_end), then the best checkpoint will be saved. + +## Saving model after training + +`save_model_dir` can optionally be set to save the tuned model using `SFTTrainer.save_model()`. This can be used in tandem with `save_strategy="no"` to only save the designated checkpoint and not any intermediate checkpoints, which can help to save space. + +`save_model_dir` can be set to a different directory than `output_dir`. If set to the same directory, the designated checkpoint, training logs, and any intermediate checkpoints will all be saved to the same directory as seen below. + +
+Ways you can use `save_model_dir` and more tips: + +For example, if `save_model_dir` is set to a sub-directory of `output_dir`and `save_total_limit=1` with LoRA tuning, the directory would look like: + +```sh +$ ls /tmp/output_dir/ +checkpoint-35 save_model_dir training_logs.jsonl + +$ ls /tmp/output_dir/save_model_dir/ +README.md adapter_model.safetensors special_tokens_map.json tokenizer.model training_args.bin +adapter_config.json added_tokens.json tokenizer.json tokenizer_config.json +``` + +Here is an fine tuning example of how the directory would look if `output_dir` is set to the same value as `save_model_dir` and `save_total_limit=2`. Note the checkpoint directories as well as the `training_logs.jsonl`: + +```sh +$ ls /tmp/same_dir + +added_tokens.json model-00001-of-00006.safetensors model-00006-of-00006.safetensors tokenizer_config.json +checkpoint-16 model-00002-of-00006.safetensors model.safetensors.index.json training_args.bin +checkpoint-20 model-00003-of-00006.safetensors special_tokens_map.json training_logs.jsonl +config.json model-00004-of-00006.safetensors tokenizer.json +generation_config.json model-00005-of-00006.safetensors tokenizer.model +``` + +
+ +## Optimizing writing checkpoints +Writing models to Cloud Object Storage (COS) is an expensive operation. Saving model checkpoints to a local directory causes much faster training times than writing to COS. You can use `output_dir` and `save_model_dir` to control which type of storage you write your checkpoints and final model to. + +You can set `output_dir` to a local directory and set `save_model_dir` to COS to save time on write operations while ensuring checkpoints are saved. + +In order to achieve the fastest train time, set `save_strategy="no"`, as saving no checkpoints except for the final model will remove intermediate write operations all together. + +## Resuming tuning from checkpoints +If the output directory already contains checkpoints, tuning will automatically resume from the latest checkpoint in the directory specified by the `output_dir` flag. To start tuning from scratch and ignore existing checkpoints, set the `resume_from_checkpoint` flag to False. + +You can also use the resume_from_checkpoint flag to resume tuning from a specific checkpoint by providing the full path to the desired checkpoint as a string. This flag is passed as an argument to the [trainer.train()](https://github.com/huggingface/transformers/blob/db70426854fe7850f2c5834d633aff637f14772e/src/transformers/trainer.py#L1901) function of the SFTTrainer. + +## Setting Gradient Checkpointing + +Training large models requires the usage of a lot of GPU memory. To reduce memory usage while training, consider setting the [`gradient_checkpointing`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.gradient_checkpointing) flag. + +Gradient Checkpointing is a method that stores only certain intermediate activations during the backward pass for recomputation. This avoids storing all of the intermediate activations from the forward pass, thus saving memory. The resulting reduced memory costs allow fitting larger models on the same GPU, with the tradeoff of a ~20% increase in the time required to fully train the model. More information about Gradient Checkpointing can be found in [this paper](https://arxiv.org/abs/1604.06174), as well as [here](https://github.com/cybertronai/gradient-checkpointing?tab=readme-ov-file#how-it-works). + +To enable this feature, add the `--gradient_checkpointing` flag as an argument when calling `sft_trainer`. + +## Training MXFP4 Quantized Models + +MXFP4 Quantized models like [gpt-oss](https://huggingface.co/openai/gpt-oss-120b) series models can be tuned by passing two extra parameters. + +``` +--quantization_method mxfp4 --dequantize True \ +--flash_attn_implementation="kernels-community/vllm-flash-attn3" +``` + +1. Quantization method `mxfp4` and `dequantize=True` tells the code to dequantize the model and load it in `bf16` mode as training is not supported for `mxfp4`. +Even if support for training in `mxfp4` mode goes live it will be supported only on Hopper and above series of GPUs so users will need to specify `dequantize=False` when training on older GPUs e.g. `A100`s. + +2. Flash attention 3 is supported by custom kernels support so users need to specify the correct argument else our code will fallback to `flash attention 2` + +Full command for training GPT-OSS models can be like this - + +``` +export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7; \ +rm -rf ~/gpt-oss-120b-multilingual-reasoner; \ +accelerate launch \ +--config_file ~/fsdp_config.yaml \ +-m tuning.sft_trainer \ +--model_name_or_path "openai/gpt-oss-120b" \ +--output_dir ~/gpt-oss-120b-multilingual-reasoner \ +--gradient_accumulation_steps 1 \ +--per_device_train_batch_size 2 \ +--num_train_epochs 1 \ +--torch_dtype bfloat16 \ +--learning_rate 2e-4 \ +--warmup_ratio 0.03 \ +--lr_scheduler_type "cosine_with_min_lr" \ +--lr_scheduler_kwargs '{"min_lr_rate": 0.1}' \ +--max_seq_length 4096 \ +--logging_steps 1 \ +--data_config ~/data_config.yaml \ +--gradient_checkpointing True \ +--peft_method lora \ +--lora_r 8\ +--lora_alpha 16 \ +--lora_dropout 0.0 \ +--target_modules "all-linear" \ +--quantization_method mxfp4 --dequantize True \ +--use_flash_attn True \ +--tracker aim --aim_repo ~/aimrepo --experiment "gpt-oss-120b-lora-tuning-fa3-attn-torch-2.8" \ +--flash_attn_implementation="kernels-community/vllm-flash-attn3" +``` + +With fsdp config passed to accelerate as - +``` +compute_environment: LOCAL_MACHINE +distributed_type: FSDP +fsdp_config: + fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP + fsdp_backward_prefetch: BACKWARD_PRE + fsdp_backward_prefetch_policy: BACKWARD_PRE + fsdp_forward_prefetch: false + fsdp_offload_params: false + fsdp_sharding_strategy: FULL_SHARD + fsdp_state_dict_type: FULL_STATE_DICT + fsdp_cpu_ram_efficient_loading: true + fsdp_sync_module_states: true + fsdp_use_orig_params: true +mixed_precision: bf16 +machine_rank: 0 +num_machines: 1 +num_processes: 8 +rdzv_backend: static +same_network: true +``` + +And [data config](./advanced-data-preprocessing.md#data-config) for [HuggingFace Reasoner dataset](https://huggingface.co/datasets/HuggingFaceH4/Multilingual-Thinking) looks like + +``` +dataprocessor: + type: default +datasets: + - name: dataset_1 + data_paths: + - "HuggingFaceH4/Multilingual-Thinking" + data_handlers: + - name: tokenize_and_apply_chat_template_with_masking + arguments: + remove_columns: all + fn_kwargs: + conversation_column_name: "messages" +``` \ No newline at end of file diff --git a/docs/tuning-techniques.md b/docs/tuning-techniques.md new file mode 100644 index 000000000..abbc9ceff --- /dev/null +++ b/docs/tuning-techniques.md @@ -0,0 +1,544 @@ +# Table of Contents + +- [LoRA Tuning Example](#lora-tuning-example) + - [How to get list of LoRA target_modules of a model](#how-to-get-list-of-lora-target_modules-of-a-model) + - [Recommended target modules per model architecture](#recommended-target-modules-per-model-architecture) + - [How to specify lm_head as a target module](#how-to-specify-lm_head-as-a-target-module) + - [Post-processing needed for inference on VLLM](#post-processing-needed-for-inference-on-vllm) + - [Alternatively, if using SDK](#alternatively-if-using-sdk) + +- [Activated LoRA Tuning Example](#activated-lora-tuning-example) + - [How to get list of aLoRA target_modules of a model](#how-to-get-list-of-alora-target_modules-of-a-model) + - [Recommended target modules per model architecture](#recommended-target-modules-per-model-architecture-1) + - [Intermediate checkpoint saving](#intermediate-checkpoint-saving) + - [Inference with aLoRA models](#inference-with-alora-models) + - [Running aLoRA models on VLLM](#running-alora-models-on-vllm) + +- [GPTQ-LoRA with AutoGPTQ Tuning Example](#gptq-lora-with-autogptq-tuning-example) + +- [Fine Tuning](#fine-tuning) + +- [FMS Acceleration](#fms-acceleration) + +- [Extended Pre-Training](#extended-pre-training) + +## LoRA Tuning Example + +Set `peft_method` to `"lora"`. You can additionally pass any arguments from [LoraConfig](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig). +```py +# Args you can pass +r: int =8 +lora_alpha: int = 32 +target_modules: List[str] = field( + default=None, + metadata={ + "help": "The names of the modules to apply LORA to. LORA selects modules which either \ + completely match or " + 'end with one of the strings. If the value is ["all-linear"], \ + then LORA selects all linear and Conv1D ' + "modules except for the output layer." + }, +) +bias = "none" +lora_dropout: float = 0.05 +``` +Example command to run: + +```bash +python tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 40 \ +--per_device_train_batch_size 4 \ +---learning_rate 1e-4 \ +--response_template "\n## Label:" \ +--dataset_text_field "output" \ +--peft_method "lora" \ +--r 8 \ +--lora_dropout 0.05 \ +--lora_alpha 16 \ +--target_modules c_attn c_proj +``` + +Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: +```json +{ + "model_name_or_path": $MODEL_PATH, + "training_data_path": $TRAIN_DATA_PATH, + "output_dir": $OUTPUT_PATH, + "num_train_epochs": 40.0, + "per_device_train_batch_size": 4, + "learning_rate": 1e-4, + "response_template": "\n## Label:", + "dataset_text_field": "output", + "peft_method": "lora", + "r": 8, + "lora_dropout": 0.05, + "lora_alpha": 16, + "target_modules": ["c_attn", "c_proj"] +} +``` + +Notice the `target_modules` are the names of the modules to apply the adapter to. +- If this is specified, only the modules with the specified names will be replaced. When passing a list of strings, either an exact match will be performed or it is checked if the name of the module ends with any of the passed strings. If this is specified as `all-linear`, then all linear/Conv1D modules are chosen, excluding the output layer. If this is specified as `lm_head` which is an output layer, the `lm_head` layer will be chosen. See the Note of this [section](#recommended-target-modules-per-model-architecture) on recommended target modules by model architecture. +- If this is not specified, modules will be chosen according to the model architecture. If the architecture is not known, an error will be raised — in this case, you should specify the target modules manually. See [HuggingFace docs](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig) for more details. + +### How to get list of LoRA target_modules of a model +For each model, the `target_modules` will depend on the type of model architecture. You can specify linear or attention layers to `target_modules`. To obtain list of `target_modules` for a model: + +```py +from transformers import AutoModelForCausalLM +# load the model +model = AutoModelForCausalLM.from_pretrained(MODEL_PATH) +# see the module list +model.modules + +# to get just linear layers +import re +model_modules = str(model.modules) +pattern = r'\((\w+)\): Linear' +linear_layer_names = re.findall(pattern, model_modules) + +names = [] +for name in linear_layer_names: + names.append(name) +target_modules = list(set(names)) +``` + +For example for LLaMA model the modules look like: +``` + +``` + +You can specify attention or linear layers. With the CLI, you can specify layers with `--target_modules "q_proj" "v_proj" "k_proj" "o_proj"` or `--target_modules "all-linear"`. + +### Recommended target modules per model architecture +As per [LoRA paper](https://arxiv.org/pdf/2106.09685), section 4.2 , by using the query and value projection matrices, we can achieve reasonable quality with efficient GPU utilization. Hence, while thinking about what LoRA adapters to specify, we recommend starting with query and value matrices. You could also refer to the defaults specified by PEFT library for popular model architectures in section [TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPING](https://github.com/huggingface/peft/blob/7b1c08d2b5e13d3c99b7d6ee83eab90e1216d4ba/src/peft/utils/constants.py#L70) as a good starting point. + +
+ +How to specify lm_head as a target module + +Since `lm_head` is an output layer, it will **not** be included as a target module if you specify `all-linear`. You can, however, specify to apply the LoRA adapter to the `lm_head` layer by explicitly naming it in the `target_modules` arg. + +**NOTE**: Specifying `["lm_head", "all-linear"]` will not tune the `lm_head` layer, but will run the equivalent of `["all-linear"]`. To include `lm_head`, you must explicitly specify all of the layers to tune on. Using the example of the Llama model above, you would need to list `"q_proj" "v_proj" "k_proj" "o_proj" "lm_head"` to tune the all linear layers including `lm_head`. These 5 layers will be produced in the LoRA adapter. + +Example 1: +```json +{ + "target_modules": ["lm_head"] // this produces lm_head layer only +} +``` + +Example 2: +```json +{ + "target_modules": ["lm_head", "c_proj", "c_attn", "c_fc"] // this produces lm_head, c_proj, c_attn and c_fc layers +} +``` + +Example 3: +```json +{ + "target_modules": ["lm_head", "all-linear"] // this produces the equivalent of all-linear only, no lm_head +} +``` + +
+ +### Post-processing needed for inference on VLLM + +In order to run inference of LoRA adapters on vLLM, any new token embeddings added while tuning needs to be moved out of 'adapters.safetensors' to a new file 'new_embeddings.safetensors'. The 'adapters.safetensors' should only have LoRA weights and should not have modified embedding vectors. This is a requirement to support vLLM's paradigm that one base model can serve multiple adapters. New token embedding vectors are appended to the embedding matrix read from the base model by vLLM. + +To do this postprocessing, the tuning script sft_trainer.py will generate a file 'added_tokens_info.json' with model artifacts. After tuning, you can run script 'post_process_adapters_vLLM.py' : + +```bash +# model_path: Path to saved model artifacts which has file 'added_tokens_info.json' +# output_model_path: Optional. If you want to store modified \ +# artifacts in a different directory rather than modify in-place. +python scripts/post_process_adapters_vLLM.py \ +--model_path "/testing/tuning/output/post-process-LoRA-saved" \ +--output_model_path "/testing/tuning/output/post-process-LoRA-modified" +``` + +
+ Alternatively, if using SDK : + +```bash +# function in tuning/utils/merge_model_utils.py +post_process_vLLM_adapters_new_tokens( + path_to_checkpoint="/testing/tuning/output/post-process-LoRA-saved", + modified_checkpoint_path=None, + num_added_tokens=1, +) +# where num_added_tokens is returned by sft_trainer.train() +``` +
+ +_________________________ + +## Activated LoRA Tuning Example + +Activated LoRA (aLoRA) is a new low rank adapter architecture that allows for reusing existing base model KV cache for more efficient inference. This approach is best suited for inference pipelines which rely on the base model for most tasks/generations, but use aLoRA adapter(s) to perform specialized task(s) within the chain. For example, checking or rewriting generated outputs of the base model. + +[Paper](https://arxiv.org/abs/2504.12397) + +[IBM Research Blogpost](https://research.ibm.com/blog/inference-friendly-aloras) + +[Github](https://github.com/IBM/activated-lora) + +**Usage** Usage is very similar to standard LoRA, with the key difference that an alora_invocation_string must be specified so that the model knows when to turn on i.e "activate" the adapter weights. The model will scan any input strings (during training or at test time) for this alora_invocation_string, and activate the adapter weights 1 token after the start of the sequence. If there are multiple instances of the alora_invocation_string in the same input, it will activate at the last such instance. + +**Note** Often (not always) aLoRA requires higher rank (r) than LoRA. r=32 can be a good starting point for challenging tasks. + +**Installation** ALoRA support is provided via [HF PEFT](https://github.com/huggingface/peft) library later than this [patch](https://github.com/huggingface/peft/pull/2609) + +Set `peft_method` to `"alora"`. + +You *must* pass in an alora_invocation_string argument. This alora_invocation_string *must be present* in both training data inputs and the input at test time. A good solution is to set alora_invocation_string = response_template, this will ensure that every training input will have the alora_invocation_string present. We keep these separate arguments for flexibility. It is most robust if the alora_invocation_string begins and ends with special tokens. + +You can additionally pass any arguments from `LoraConfig`, see the LoRA section for examples. + +Example command to run, here using the ([Granite Instruct response template](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct/blob/main/tokenizer_config.json#L188)) as the invocation sequence: + +```bash +python tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 40 \ +--per_device_train_batch_size 4 \ +--learning_rate 1e-4 \ +--response_template "<|start_of_role|>assistant<|end_of_role|>" \ #this example uses special tokens in the Granite tokenizer, adjust for other models +--alora_invocation_string "<|start_of_role|>assistant<|end_of_role|>" \ +--dataset_text_field "output" \ +--peft_method "alora" \ +--r 32 \ +--lora_dropout 0.05 \ +--lora_alpha 16 \ +--target_modules q_proj k_proj v_proj +``` + +Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: +```json +{ + "model_name_or_path": $MODEL_PATH, + "training_data_path": $TRAIN_DATA_PATH, + "output_dir": $OUTPUT_PATH, + "num_train_epochs": 40.0, + "per_device_train_batch_size": 4, + "learning_rate": 1e-4, + "response_template": "<|start_of_role|>assistant<|end_of_role|>", + "alora_invocation_string": "<|start_of_role|>assistant<|end_of_role|>", + "dataset_text_field": "output", + "peft_method": "alora", + "r": 32, + "lora_dropout": 0.05, + "lora_alpha": 16, + "target_modules": ["q_proj", "k_proj", "v_proj"] +} +``` + +Notice the `target_modules` are the names of the modules to apply the adapter to. +- If this is specified, only the modules with the specified names will be replaced. When passing a list of strings, either an exact match will be performed or it is checked if the name of the module ends with any of the passed strings. If this is specified as `all-linear`, then all linear/Conv1D modules are chosen, excluding the output layer. +- If this is not specified, modules will be chosen according to the model architecture. If the architecture is not known, an error will be raised — in this case, you should specify the target modules manually. See [HuggingFace docs](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig) for more details. + + +### How to get list of aLoRA target_modules of a model +See [How to get list of LoRA target_modules of a model](#how-to-get-list-of-lora-target_modules-of-a-model). + +### Recommended target modules per model architecture +As per [aLoRA paper](https://arxiv.org/abs/2504.12397), by using the key, query and value projection matrices, we can achieve good quality with efficient GPU utilization. Hence, while thinking about what aLoRA adapters to specify, we recommend starting with key, query and value matrices. + +### Intermediate checkpoint saving +Note that `sft_trainer.py` will always save the final trained model for you. If you want to save intermediate checkpoints from within the training process, the below applies. + +For now, `save_strategy` is not supported (it is always reset to `none`). You can either save the model once training is complete, or pass in a custom callback in `additional_callbacks` directly to `tuning.sft_trainer.train` to perform saving. For example the following (from [alora github](https://github.com/IBM/activated-lora/blob/fms-hf-tuning/train_scripts/finetune_example_callback.py)) saves and updates the best performing model so far, checking whenever eval is called according to `eval_strategy`: +```py +class SaveBestModelCallback(TrainerCallback): + def __init__(self): + self.best_eval_loss = float("inf") # Track best loss + + def on_evaluate(self, args, state, control, **kwargs): + """Save the best model manually during evaluation.""" + + model = kwargs["model"] + metrics = kwargs["metrics"] + + eval_loss = metrics.get("eval_loss") + if eval_loss is not None and eval_loss < self.best_eval_loss: + self.best_eval_loss = eval_loss # Update best loss + + # Manually save best model + model.save_pretrained(args.output_dir) +``` +### Inference with aLoRA models +*Important* Inference with aLoRA models requires nsuring that the invocation string is present in the input (usually the end). + +Example inference: +```py +# Load the model +loaded_model = TunedCausalLM.load(ALORA_MODEL, BASE_MODEL_NAME) + +# Retrieve the invocation string from the model config +alora_invocation_string = loaded_model.peft_model.peft_config[ + loaded_model.peft_model.active_adapter +].alora_invocation_string + +# In this case, we have the invocation string at the end of the input +input_string = "Simply put, the theory of relativity states that \n" + alora_invocation_string + +# Run inference on the text +output_inference = loaded_model.run( + input_string, + max_new_tokens=50, +) +``` + +### Running aLoRA models on VLLM + +Coming soon! For now, there is inference support in this package, or see [aLoRA github](https://github.com/IBM/activated-lora/experiments/inference_example.py) for example code demonstrating KV cache reuse from prior base model calls. + +__________ + + + +## GPTQ-LoRA with AutoGPTQ Tuning Example + +This method is similar to LoRA Tuning, but the base model is a quantized model. We currently only support GPTQ-LoRA model that has been quantized with 4-bit AutoGPTQ technique. Bits-and-Bytes (BNB) quantized LoRA is not yet enabled. +The qLoRA tuning technique is enabled via the [fms-acceleration](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/README.md#fms-acceleration) package. +You can see details on a sample configuration of Accelerated GPTQ-LoRA [here](https://github.com/foundation-model-stack/fms-acceleration/blob/main/sample-configurations/accelerated-peft-autogptq-sample-configuration.yaml). + + +To use GPTQ-LoRA technique, you can set the `quantized_lora_config` defined [here](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/tuning/config/acceleration_configs/quantized_lora_config.py). See the Notes section of FMS Acceleration doc [below](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/README.md#fms-acceleration) for usage. The only kernel we are supporting currently is `triton_v2`. + +In addition, LoRA tuning technique is required to be used, set `peft_method` to `"lora"` and pass any arguments from [LoraConfig](https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig). + +Example command to run: + +```bash +python tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 40 \ +--per_device_train_batch_size 4 \ +--learning_rate 1e-4 \ +--response_template "\n## Label:" \ +--dataset_text_field "output" \ +--peft_method "lora" \ +--r 8 \ +--lora_dropout 0.05 \ +--lora_alpha 16 \ +--target_modules c_attn c_proj \ +--auto_gptq triton_v2 \ # setting quantized_lora_config +--torch_dtype float16 \ # need this for triton_v2 +--fp16 \ # need this for triton_v2 +``` + +Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: + +```json +{ + "model_name_or_path": $MODEL_PATH, + "training_data_path": $TRAIN_DATA_PATH, + "output_dir": $OUTPUT_PATH, + "num_train_epochs": 40.0, + "per_device_train_batch_size": 4, + "learning_rate": 1e-4, + "response_template": "\n## Label:", + "dataset_text_field": "output", + "peft_method": "lora", + "r": 8, + "lora_dropout": 0.05, + "lora_alpha": 16, + "target_modules": ["c_attn", "c_proj"], + "auto_gptq": ["triton_v2"], // setting quantized_lora_config + "torch_dtype": "float16", // need this for triton_v2 + "fp16": true // need this for triton_v2 +} +``` + +Similarly to LoRA, the `target_modules` are the names of the modules to apply the adapter to. See the LoRA [section](#lora-tuning-example) on `target_modules` for more info. + +Note that with LoRA tuning technique, setting `all-linear` on `target_modules` returns linear modules. And with qLoRA tuning technique, `all-linear` returns all quant linear modules, excluding `lm_head`. + +_________________________ + +## Fine Tuning: + +Set `peft_method` to `'None'` or do not provide `peft_method` flag. + +Full fine tuning needs more compute resources, so it is advised to use the MultiGPU method. Example command: + +```bash +accelerate launch \ +--num_processes=4 +--config_file fixtures/accelerate_fsdp_defaults.yaml \ +tuning/sft_trainer.py \ +--model_name_or_path $MODEL_PATH \ +--tokenizer_name_or_path $MODEL_PATH \ # This field is optional and if not specified, tokenizer from model_name_or_path will be used +--training_data_path $TRAIN_DATA_PATH \ +--output_dir $OUTPUT_PATH \ +--num_train_epochs 5 \ +--per_device_train_batch_size 4 \ +--learning_rate 1e-5 \ +--response_template "\n## Label:" \ +--dataset_text_field "output" \ +--peft_method "None" +``` + +Equally you can pass in a JSON configuration for running tuning. See [build doc](./build/README.md) for more details. The above can also be passed in as JSON: +```json +{ + "model_name_or_path": $MODEL_PATH, + "training_data_path": $TRAIN_DATA_PATH, + "output_dir": $OUTPUT_PATH, + "num_train_epochs": 5.0, + "per_device_train_batch_size": 4, + "learning_rate": 1e-5, + "response_template": "\n## Label:", + "dataset_text_field": "output", + "peft_method": "None" +} +``` + +## FMS Acceleration + +`fms-acceleration` is fuss-free approach to access a curated collection of acceleration plugins that acclerate your `tuning/sft-trainer.py` experience. Accelerations that apply to a variety of use-cases, e.g., PeFT / full-finetuning, are being planned for. As such, the accelerations are grouped into *plugins*; only install the plugins needed for the acceleration of interest. The plugins are housed in the [seperate repository found here](https://github.com/foundation-model-stack/fms-acceleration). + +To access `fms-acceleration` features the `[fms-accel]` dependency must first be installed: + ``` + $ pip install fms-hf-tuning[fms-accel] + ``` + +Furthermore, the required `fms-acceleration` plugin must be installed. This is done via the command line utility `fms_acceleration.cli`. To show available plugins: + ``` + $ python -m fms_acceleration.cli plugins + ``` +as well as to install the `fms_acceleration_peft`: + + ``` + $ python -m fms_acceleration.cli install fms_acceleration_peft + ``` + +If you do not know what plugin to install (or forget), the framework will remind + +``` +An acceleration feature is requested by specifying the '--auto_gptq' argument, but the this requires acceleration packages to be installed. Please do: +- python -m fms_acceleration.cli install fms_acceleration_peft +``` + +The list of configurations for various `fms_acceleration` plugins: +- [quantized_lora_config](./tuning/config/acceleration_configs/quantized_lora_config.py): For quantized 4bit LoRA training + - `--auto_gptq`: 4bit GPTQ-LoRA with AutoGPTQ + - `--bnb_qlora`: 4bit QLoRA with bitsandbytes +- [fused_ops_and_kernels](./tuning/config/acceleration_configs/fused_ops_and_kernels.py): + - `--fused_lora`: fused lora for more efficient LoRA training. + - `--fast_kernels`: fast cross-entropy, rope, rms loss kernels. +- [attention_and_distributed_packing](./tuning/config/acceleration_configs/attention_and_distributed_packing.py): + - `--padding_free`: technique to process multiple examples in single batch without adding padding tokens that waste compute. + - `--multipack`: technique for *multi-gpu training* to balance out number of tokens processed in each device, to minimize waiting time. +- [fast_moe_config](./tuning/config/acceleration_configs/fast_moe.py) (experimental): + - `--fast_moe`: trains MoE models in parallel with [Scatter MoE kernels](https://github.com/foundation-model-stack/fms-acceleration/tree/main/plugins/accelerated-moe#fms-acceleration-for-mixture-of-experts), increasing throughput and decreasing memory usage. +- [odm_config](./tuning/config/acceleration_configs/odm.py) (experimental): See [online data mixing](./online-data-mixing.md) and [PyTorch conf poster](https://static.sched.com/hosted_files/pytorchconference/70/PyTorch%20Native%20Online%20Dynamic%20Reward%20Based%20Data%20Mixing%20Framework.pdf) for usage with data_config. This plugin allows dynamically mixing datasets online during training adapting to training signals. + +Notes: + * `quantized_lora_config` requires that it be used along with LoRA tuning technique. See [LoRA tuning section](https://github.com/foundation-model-stack/fms-hf-tuning/tree/main?tab=readme-ov-file#lora-tuning-example) on the LoRA parameters to pass. + * When setting `--auto_gptq triton_v2` plus note to also pass `--torch_dtype float16` and `--fp16`, or an exception will be raised. This is because these kernels only support this dtype. + * When using `fused_ops_and_kernels` together with `quantized_lora_config`, + make sure to appropriately set `--fused_lora auto_gptq True` or `bitsandbytes True`; the `True` sets `fast_lora==True`. + * `fused_ops_and_kernels` works for full-finetuning, LoRA, QLoRA and GPTQ-LORA, + - Pass `--fast_kernels True True True` for full finetuning/LoRA + - Pass `--fast_kernels True True True --auto_gptq triton_v2 --fused_lora auto_gptq True` for GPTQ-LoRA + - Pass `--fast_kernels True True True --bitsandbytes nf4 --fused_lora bitsandbytes True` for QLoRA + - Note the list of supported models [here](https://github.com/foundation-model-stack/fms-acceleration/blob/main/plugins/fused-ops-and-kernels/README.md#supported-models). + * Notes on Padding Free + - Works for both *single* and *multi-gpu*. + - Works on both *pretokenized* and *untokenized* datasets + - Verified against the version found in HF main, merged in via PR https://github.com/huggingface/transformers/pull/31629. + * Notes on Multipack + - Works only for *multi-gpu*. + - Currently only includes the version of *multipack* optimized for linear attention implementations like *flash-attn*. + - Streaming datasets or use of `IterableDatasets` is not compatible with the fms-acceleration multipack plugin because multipack sampler has to run thorugh the full dataset every epoch. Using multipack and streaming together will raise an error. + * Notes on Fast MoE + - `--fast_moe` takes either an integer or boolean value. + - When an integer `n` is passed, it enables expert parallel sharding with the expert parallel degree as `n` along with Scatter MoE kernels enabled. + - When a boolean is passed, the expert parallel degree defaults to 1 and further the behaviour would be as follows: + - if True, it is Scatter MoE Kernels with experts sharded based on the top level sharding protocol (e.g. FSDP). + - if False, Scatter MoE Kernels with complete replication of experts across ranks. + - FSDP must be used when lora tuning with `--fast_moe` + - lora tuning with ScatterMoE is supported, but because of inference restrictions on vLLM/vanilla PEFT, the expert layers and router linear layer should not be trained as `target_modules` for models being tuned with ScatterMoE. Users have control over which `target_modules` they wish to train: + - At this time, only attention layers are trainable when using LoRA with scatterMoE. Until support for the router linear layer is added in, target modules must be specified explicitly (i.e `target_modules: ["q_proj", "v_proj", "o_proj", "k_proj"]`) instead of passing `target_modules: ["all-linear"]`. + - `world_size` must be divisible by the `ep_degree` + - `number of experts` in the MoE module must be divisible by the `ep_degree` + - Running fast moe modifies the state dict of the model, and must be post-processed which happens automatically and the converted checkpoint can be found at `hf_converted_checkpoint` folder within every saved checkpoint directory. Alternatively, we can perform similar option manually through [checkpoint utils](https://github.com/foundation-model-stack/fms-acceleration/blob/main/plugins/accelerated-moe/src/fms_acceleration_moe/utils/checkpoint_utils.py) script. + - The typical usecase for this script is to run: + ``` + python -m fms_acceleration_moe.utils.checkpoint_utils \ + \ + \ + + ``` + +Note: To pass the above flags via a JSON config, each of the flags expects the value to be a mixed type list, so the values must be a list. For example: +```json +{ + "fast_kernels": [true, true, true], + "padding_free": ["huggingface"], + "multipack": [16], + "auto_gptq": ["triton_v2"] +} +``` + +Activate `TRANSFORMERS_VERBOSITY=info` to see the huggingface trainer printouts and verify that `AccelerationFramework` is activated! + +``` +# this printout will be seen in huggingface trainer logs if acceleration is activated +***** FMS AccelerationFramework ***** +Active Plugin: AutoGPTQAccelerationPlugin. Python package: fms_acceleration_peft. Version: 0.0.1. +***** Running training ***** +Num examples = 1,549 +Num Epochs = 1 +Instantaneous batch size per device = 4 +Total train batch size (w. parallel, distributed & accumulation) = 4 +Gradient Accumulation steps = 1 +Total optimization steps = 200 +Number of trainable parameters = 13,631,488 +``` + +The `fms_acceleration.cli` can do more to search for all available configs, plugins and arguments, [see the advanced flow](https://github.com/foundation-model-stack/fms-acceleration#advanced-flow). + + +## Extended Pre-Training + +We also have support for extended pre training where users might wanna pretrain a model with large number of samples. Please refer our separate doc on [EPT Use Cases](./ept.md) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d1f84dc87..10fc72b4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,41 +27,36 @@ classifiers=[ "Programming Language :: Python :: 3.12" ] dependencies = [ -"numpy>=1.26.4,<2.0", -"accelerate>=0.20.3,!=0.34,<1.7", -"transformers>=4.49,<=4.52.4", -"torch>=2.2.0,<2.7", +"numpy>=1.26.4,<2.2.0", +"accelerate>=1.9.0,<2.0.0", +"transformers>=4.55.0,<=4.55.4", +"torch>2.7.0,<2.9.0", "sentencepiece>=0.1.99,<0.3", -"tokenizers>=0.13.3,<1.0", +"tokenizers<=0.22", "tqdm>=4.66.2,<5.0", -"trl>=0.13,<0.18", -"peft>=0.15.0,<=0.15.2", -"protobuf>=5.28.0,<6.0.0", -"datasets>=3.5.0,<4.0", +"trl>=0.19.1,<0.20.0", +"peft @ git+https://github.com/huggingface/peft.git@293aea5df6db240856a77f89955d1a89ce38b50d", +"datasets>=4.0.0,<5.0.0", "simpleeval>=0.9.13,<2.0", "pillow>=11.0.0,<12.0", +"kernels<=0.9.0", ] [project.optional-dependencies] dev = ["wheel>=0.42.0,<1.0", "packaging>=23.2,<25", "ninja>=1.11.1.1,<2.0", "scikit-learn>=1.0, <2.0", "boto3>=1.34, <2.0"] -flash-attn = ["flash-attn>=2.5.3,<2.8"] +flash-attn = ["flash-attn>=2.8.3"] aim = ["aim>=3.19.0,<4.0"] mlflow = ["mlflow"] clearml = ["clearml==2.0.0"] -fms-accel = ["fms-acceleration>=0.6"] +fms-accel = ["fms-acceleration>=0.6.2"] gptq-dev = ["auto_gptq>0.4.2", "optimum>=1.15.0"] mamba = ["mamba_ssm[causal-conv1d]>=2.0.0,<3.0.0"] scanner-dev = ["HFResourceScanner>=0.1.0"] -activated-lora = ["alora>=0.3.0"] - [tool.setuptools.packages.find] exclude = ["tests", "tests.*"] namespaces = false -[tool.setuptools_scm] -version_file = "tuning/_version.py" - [project.urls] Homepage = "https://github.com/foundation-model-stack/fms-hf-tuning" Repository = "https://github.com/foundation-model-stack/fms-hf-tuning" diff --git a/scripts/checkpoint_utils.py b/scripts/checkpoint_utils.py new file mode 100644 index 000000000..1db4d84b6 --- /dev/null +++ b/scripts/checkpoint_utils.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python3 +# Checkpoint utilities (unified --inplace): +# - Default: copy INPUT -> OUTPUT unchanged +# - --convert-model-to-bf16: convert model FP32 -> BF16 (optimizer tensors remain FP32) +# - --no-optimizer: when writing outputs, drop optimizer files/dirs (defaults + --drop-files) +# - --drop-files: comma-separated extra file/dir (used with --no-optimizer, and with --inplace) +# - --inplace: perform conversion and/or dropping directly in INPUT (destructive) + + +# Standard +from pathlib import Path +from typing import Any, Iterable, Set +import argparse +import os +import shutil + +# Third Party +import torch + +try: + # Third Party + from safetensors.torch import safe_open, save_file + + HAS_SAFETENSORS = True +except ImportError: + HAS_SAFETENSORS = False + +OPTIM_ROOT_KEYS = {"optimizer", "optim", "opt_state"} + +DEFAULT_OPTIM_DROPS = {"optimizer.pt", "optimizer", "optimizer_0", "optimizer_1"} + + +def _atomic_replace(tmp: Path, dst: Path) -> None: + dst.parent.mkdir(parents=True, exist_ok=True) + os.replace(str(tmp), str(dst)) # atomic on POSIX + + +def cast_fp32_to_bf16(x: Any, *, in_optim: bool = False) -> Any: + """Recursively cast float32 tensors to bfloat16, skipping optimizer subtrees.""" + if isinstance(x, torch.Tensor): + return x if in_optim or x.dtype != torch.float32 else x.to(torch.bfloat16) + if isinstance(x, dict): + out = {} + for k, v in x.items(): + k_lower = k.lower() if isinstance(k, str) else "" + child_in_optim = in_optim or any( + k_lower.startswith(root) for root in OPTIM_ROOT_KEYS + ) + out[k] = cast_fp32_to_bf16(v, in_optim=child_in_optim) + return out + if isinstance(x, (list, tuple)): + return type(x)(cast_fp32_to_bf16(v, in_optim=in_optim) for v in x) + return x + + +def is_optim_tensor_name(name: str) -> bool: + first = (name or "").lower().replace("/", ".").split(".")[0] + return any(first.startswith(root) for root in OPTIM_ROOT_KEYS) + + +def convert_pt_pth(inp: Path, out: Path) -> None: + data = torch.load(inp, map_location="cpu") + data = cast_fp32_to_bf16(data) + out.parent.mkdir(parents=True, exist_ok=True) + torch.save(data, out) + print(f"[pt/pth] wrote: {out}") + + +def convert_pt_pth_inplace(inp: Path) -> None: + tmp = inp.with_suffix(inp.suffix + ".tmp") + convert_pt_pth(inp, tmp) + _atomic_replace(tmp, inp) + print(f"[pt/pth][inplace] updated: {inp}") + + +def convert_safetensors_file(inp: Path, out: Path) -> None: + if not HAS_SAFETENSORS: + raise RuntimeError("safetensors not installed. pip install safetensors") + tensors = {} + with safe_open(str(inp), framework="pt", device="cpu") as f: + for key in f.keys(): + t = f.get_tensor(key) + if t.dtype == torch.float32 and not is_optim_tensor_name(key): + t = t.to(torch.bfloat16) + tensors[key] = t + out.parent.mkdir(parents=True, exist_ok=True) + save_file(tensors, str(out), metadata={"converted_to": "bfloat16"}) + print(f"[safetensors] wrote: {out}") + + +def convert_safetensors_file_inplace(inp: Path) -> None: + tmp = inp.with_suffix(inp.suffix + ".tmp") + convert_safetensors_file(inp, tmp) + _atomic_replace(tmp, inp) + print(f"[safetensors][inplace] updated: {inp}") + + +def convert_dir_of_safetensors(src: Path, dst: Path) -> None: + """Convert all .safetensors in a directory; copy other files as-is.""" + dst.mkdir(parents=True, exist_ok=True) + for item in src.iterdir(): + if item.suffix == ".safetensors": + convert_safetensors_file(item, dst / item.name) + else: + target = dst / item.name + if item.is_file(): + shutil.copy2(item, target) + elif item.is_dir(): + shutil.copytree(item, target, dirs_exist_ok=True) + print(f"[dir] wrote: {dst}") + + +def convert_dir_of_safetensors_inplace(src: Path) -> None: + """Convert all .safetensors files in-place within `src`.""" + count = 0 + for item in src.iterdir(): + if item.suffix == ".safetensors": + convert_safetensors_file_inplace(item) + count += 1 + if count == 0: + raise SystemExit("Directory has no .safetensors files.") + print(f"[dir][inplace] converted {count} shard(s) in: {src}") + + +def _name_matches(name: str, patterns: Set[str]) -> bool: + """Exact-name match (simple and predictable).""" + return name in patterns + + +def copy_dir_drop(src: Path, dst: Path, drop_names: Iterable[str]) -> None: + """Copy directory but drop certain files/dirs by exact name.""" + dst.mkdir(parents=True, exist_ok=True) + drop_set: Set[str] = set(drop_names) + for item in src.iterdir(): + if _name_matches(item.name, drop_set): + continue + target = dst / item.name + if item.is_file(): + shutil.copy2(item, target) + elif item.is_dir(): + shutil.copytree(item, target, dirs_exist_ok=True) + print( + f"[copy-drop] wrote: {dst} (dropped: {', '.join(sorted(drop_set)) if drop_set else 'none'})" + ) + + +def prune_dir_inplace(src: Path, drop_names: Iterable[str]) -> None: + """Delete top-level files/dirs in `src` whose names match `drop_names`. Destructive.""" + drop_set: Set[str] = set(drop_names) + removed = [] + for item in src.iterdir(): + if _name_matches(item.name, drop_set): + if item.is_file(): + item.unlink() + elif item.is_dir(): + shutil.rmtree(item) + removed.append(item.name) + print( + f"[inplace-drop] removed: {', '.join(sorted(removed)) if removed else 'nothing'}" + ) + + +def copy_any(src: Path, dst: Path) -> None: + """Pure copy (no dtype changes, no dropping).""" + if src.is_file(): + dst.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(src, dst if dst.suffix else dst / src.name) + elif src.is_dir(): + dst.mkdir(parents=True, exist_ok=True) + for item in src.iterdir(): + target = dst / item.name + if item.is_file(): + shutil.copy2(item, target) + elif item.is_dir(): + shutil.copytree(item, target, dirs_exist_ok=True) + else: + raise SystemExit(f"Not found: {src}") + print(f"[copy] wrote: {dst}") + + +def main(): + ap = argparse.ArgumentParser( + description="Checkpoint utilities: copy by default; \ + optionally convert FP32->BF16 and/or drop optimizer files. " + "Use --inplace to modify INPUT directly." + ) + ap.add_argument("input", type=Path, help="Input file or directory") + ap.add_argument("output", type=Path, help="Output file or directory") + + ap.add_argument( + "--convert-model-to-bf16", + action="store_true", + help="Convert FP32 -> BF16 for model tensors; optimizer tensors remain FP32.", + ) + ap.add_argument( + "--no-optimizer", + action="store_true", + help="When writing outputs, drop optimizer files/dirs (defaults + --drop-files).", + ) + ap.add_argument( + "--drop-files", + default="", + help="Comma-separated extra file/dir names to drop \ + (works with --no-optimizer and/or --inplace).", + ) + ap.add_argument( + "--inplace", + action="store_true", + help="Perform operations directly on INPUT (destructive). For files: overwrite in place; " + "for directories: convert shards in-place and/or delete dropped names.", + ) + + args = ap.parse_args() + + p = args.input + + user_drops = {s.strip() for s in args.drop_files.split(",") if s.strip()} + if args.no_optimizer: + drop_set = DEFAULT_OPTIM_DROPS | user_drops + else: + drop_set = user_drops + + if args.inplace: + if not p.exists(): + raise SystemExit(f"Not found: {p}") + + if args.convert_model_to_bf16: + if p.is_file(): + sfx = p.suffix.lower() + if sfx in {".pt", ".pth"}: + convert_pt_pth_inplace(p) + elif sfx == ".safetensors": + convert_safetensors_file_inplace(p) + else: + raise SystemExit( + f"Unsupported file type for inplace conversion: {p}" + ) + elif p.is_dir(): + convert_dir_of_safetensors_inplace(p) + else: + raise SystemExit(f"Not found: {p}") + + if drop_set: + if not p.is_dir(): + print( + "[inplace] --drop-files applies to directories; skipping for file input." + ) + else: + prune_dir_inplace(p, drop_set) + + print("Done.") + return + + if not args.convert_model_to_bf16 and not args.no_optimizer and not drop_set: + copy_any(p, args.output) + print("Done.") + return + + if p.is_file(): + sfx = p.suffix.lower() + if args.convert_model_to_bf16: + if sfx in {".pt", ".pth"}: + convert_pt_pth(p, args.output) + elif sfx == ".safetensors": + out = ( + args.output + if args.output.suffix == ".safetensors" + else (args.output / p.name) + ) + convert_safetensors_file(p, out) + else: + raise SystemExit(f"Unsupported file type: {p}") + else: + copy_any(p, args.output) + print("Done.") + return + + if p.is_dir(): + if args.convert_model_to_bf16: + if not any(x.suffix == ".safetensors" for x in p.iterdir()): + raise SystemExit("Directory has no .safetensors files.") + convert_dir_of_safetensors(p, args.output) + if args.no_optimizer or drop_set: + tmp = args.output.parent / (args.output.name + "_tmp_drop") + if tmp.exists(): + shutil.rmtree(tmp) + copy_dir_drop( + args.output, + tmp, + DEFAULT_OPTIM_DROPS | drop_set if args.no_optimizer else drop_set, + ) + shutil.rmtree(args.output) + tmp.rename(args.output) + else: + if args.no_optimizer or drop_set: + copy_dir_drop( + p, + args.output, + DEFAULT_OPTIM_DROPS | drop_set if args.no_optimizer else drop_set, + ) + else: + copy_any(p, args.output) + print("Done.") + return + + raise SystemExit(f"Not found: {p}") + + +if __name__ == "__main__": + main() diff --git a/scripts/run_inference.py b/scripts/run_inference.py index a4d1d06b7..691107ba4 100644 --- a/scripts/run_inference.py +++ b/scripts/run_inference.py @@ -138,11 +138,10 @@ def __exit__(self, exc_type, exc_value, exc_tb): ### Funcs for loading and running models class TunedCausalLM: - def __init__(self, model, tokenizer, device, use_alora=False): + def __init__(self, model, tokenizer, device): self.peft_model = model self.tokenizer = tokenizer self.device = device - self.use_alora = use_alora @classmethod def load( @@ -150,7 +149,6 @@ def load( checkpoint_path: str, base_model_name_or_path: str = None, use_flash_attn: bool = False, - use_alora: bool = False, ) -> "TunedCausalLM": """Loads an instance of this model. @@ -224,36 +222,14 @@ def load( tokenizer_and_embedding_resize( {}, tokenizer=tokenizer, model=base_model ) - if use_alora: - # Third Party - try: - # Third Party - from alora.peft_model_alora import ( # pylint: disable=import-outside-toplevel - aLoRAPeftModelForCausalLM, - ) - - model = aLoRAPeftModelForCausalLM.from_pretrained( - base_model, - checkpoint_path, - attn_implementation="flash_attention_2" - if use_flash_attn - else None, - torch_dtype=torch.bfloat16 if use_flash_attn else None, - ) - except ImportError as exc: - raise ImportError( - "The alora package is required for this operation. " - "Please install it with pip install alora." - ) from exc - else: - model = PeftModel.from_pretrained( - base_model, - checkpoint_path, - attn_implementation="flash_attention_2" - if use_flash_attn - else None, - torch_dtype=torch.bfloat16 if use_flash_attn else None, - ) + model = PeftModel.from_pretrained( + base_model, + checkpoint_path, + attn_implementation="flash_attention_2" + if use_flash_attn + else None, + torch_dtype=torch.bfloat16 if use_flash_attn else None, + ) except (OSError, ValueError) as e: print("Failed to initialize checkpoint model!") raise e @@ -283,7 +259,7 @@ def load( ) model.to(device) - return cls(model, tokenizer, device, use_alora) + return cls(model, tokenizer, device) def run( self, @@ -307,42 +283,16 @@ def run( str Text generation result. """ - if not self.use_alora: - tok_res = self.tokenizer(text, return_tensors="pt") - input_ids = tok_res.input_ids.to(self.device) - peft_outputs = self.peft_model.generate( - input_ids=input_ids, max_new_tokens=max_new_tokens - ) - else: # pass in alora_offsets needed for alora model - # Retrieve invocation string - invocation_string = self.peft_model.peft_config[ - self.peft_model.active_adapter - ].invocation_string - # Find the invocation string in input - if invocation_string in text: - before, after = text.rsplit(invocation_string, 1) - after = invocation_string + after - else: - raise ValueError( - f"aLoRA invocation string '{invocation_string}' not found in input '{text}'." - ) - # Tokenize separately to enforce correct token boundary - before_ids = self.tokenizer(before, return_tensors="pt").input_ids - after_ids = self.tokenizer(invocation_string, return_tensors="pt").input_ids - alora_offsets = [after_ids.shape[1] - 1] - input_ids = torch.cat([before_ids, after_ids], dim=1).to(self.device) - - peft_outputs = self.peft_model.generate( - input_ids=input_ids, - max_new_tokens=max_new_tokens, - alora_offsets=alora_offsets, - ) - if ret_gen_text_only: - tok_to_decode = peft_outputs[:, input_ids.shape[1] :] - else: - tok_to_decode = peft_outputs + tok_res = self.tokenizer(text, return_tensors="pt") + input_ids = tok_res.input_ids.to(self.device) + peft_outputs = self.peft_model.generate( + input_ids=input_ids, max_new_tokens=max_new_tokens + ) + tok_to_decode = ( + peft_outputs[:, input_ids.shape[1] :] if ret_gen_text_only else peft_outputs + ) decoded_result = self.tokenizer.batch_decode( - tok_to_decode, skip_special_tokens=False + tok_to_decode, skip_special_tokens=ret_gen_text_only )[0] return decoded_result @@ -360,11 +310,6 @@ def main(): help="JSON file to write results to", default="inference_result.json", ) - parser.add_argument( - "--use_alora", - help="Whether to use alora", - default=False, - ) parser.add_argument( "--base_model_name_or_path", help="Override for base model to be used for non-merged models \ @@ -398,7 +343,6 @@ def main(): checkpoint_path=args.model, base_model_name_or_path=args.base_model_name_or_path, use_flash_attn=args.use_flash_attn, - use_alora=args.use_alora, ) # Run inference on the text; if multiple were provided, process them all diff --git a/tests/artifacts/predefined_data_configs/__init__.py b/tests/artifacts/predefined_data_configs/__init__.py index 9261152a2..90f0e3307 100644 --- a/tests/artifacts/predefined_data_configs/__init__.py +++ b/tests/artifacts/predefined_data_configs/__init__.py @@ -34,6 +34,9 @@ DATA_CONFIG_MULTIPLE_DATASETS_SAMPLING_AND_SPLIT_YAML = os.path.join( PREDEFINED_DATA_CONFIGS, "multiple_datasets_with_sampling_and_split.yaml" ) +DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML = os.path.join( + PREDEFINED_DATA_CONFIGS, "multiple_datasets_with_odm.yaml" +) DATA_CONFIG_MULTIPLE_DATASETS_SAMPLING_AND_SPLIT_YAML_2 = os.path.join( PREDEFINED_DATA_CONFIGS, "multiple_datasets_with_sampling_and_split_2.yaml" ) @@ -58,6 +61,10 @@ PREDEFINED_DATA_CONFIGS, "granite_3_1b_chat_template.txt", ) +CHAT_TEMPLATE_JINJA = os.path.join( + PREDEFINED_DATA_CONFIGS, + "chat_template.jinja", +) DATA_CONFIG_YAML_STREAMING_INPUT_OUTPUT = os.path.join( PREDEFINED_DATA_CONFIGS, "tokenize_and_apply_input_masking_streaming.yaml" ) diff --git a/tests/artifacts/predefined_data_configs/chat_template.jinja b/tests/artifacts/predefined_data_configs/chat_template.jinja new file mode 100644 index 000000000..487920c59 --- /dev/null +++ b/tests/artifacts/predefined_data_configs/chat_template.jinja @@ -0,0 +1,49 @@ +{%- if messages[0]['role'] == 'system' %} + {%- set system_message = messages[0]['content'] %} + {%- set loop_messages = messages[1:] %} +{%- else %} + {%- set system_message = "Knowledge Cutoff Date: April 2024.\nToday's Date: " + strftime_now('%B %d, %Y') + ".\nYou are Granite, developed by IBM." %} + {%- if tools and documents %} + {%- set system_message = system_message + " You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.\n\nWrite the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %} + {%- elif tools %} + {%- set system_message = system_message + " You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request." %} + {%- elif documents %} + {%- set system_message = system_message + " Write the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %} + {%- else %} + {%- set system_message = system_message + " You are a helpful AI assistant." %} + {%- endif %} + {%- if 'citations' in controls and documents %} + {%- set system_message = system_message + '\n\nIn your response, use the symbols and to indicate when a fact comes from a document in the search result, e.g 0 for a fact from document 0. Afterwards, list all the citations with their corresponding documents in an ordered list.' %} + {%- endif %} + {%- if 'hallucinations' in controls and documents %} + {%- set system_message = system_message + '\n\nFinally, after the response is written, include a numbered list of sentences from the response that are potentially hallucinated and not based in the documents.' %} + {%- endif %} + {%- set loop_messages = messages %} +{%- endif %} +{{- '<|start_of_role|>system<|end_of_role|>' + system_message + '<|end_of_text|>\n' }} +{%- if tools %} + {{- '<|start_of_role|>tools<|end_of_role|>' }} + {{- tools | tojson(indent=4) }} + {{- '<|end_of_text|>\n' }} +{%- endif %} +{%- if documents %} + {{- '<|start_of_role|>documents<|end_of_role|>' }} + {%- for document in documents %} + {{- 'Document ' + loop.index0 | string + '\n' }} + {{- document['text'] }} + {%- if not loop.last %} + {{- '\n\n'}} + {%- endif%} + {%- endfor %} + {{- '<|end_of_text|>\n' }} +{%- endif %} +{%- for message in loop_messages %} + {{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' + message['content'] + '<|end_of_text|>\n' }} + {%- if loop.last and add_generation_prompt %} + {{- '<|start_of_role|>assistant' }} + {%- if controls %} + {{- ' ' + controls | tojson()}} + {%- endif %} + {{- '<|end_of_role|>' }} + {%- endif %} +{%- endfor %} diff --git a/tests/artifacts/predefined_data_configs/multiple_datasets_with_odm.yaml b/tests/artifacts/predefined_data_configs/multiple_datasets_with_odm.yaml new file mode 100644 index 000000000..74c72a5fd --- /dev/null +++ b/tests/artifacts/predefined_data_configs/multiple_datasets_with_odm.yaml @@ -0,0 +1,70 @@ +dataprocessor: + type: odm + sampling_stopping_strategy: first_exhausted # ignored + seed: 66 + odm: + update_interval: 1 # update every step + sampling_interval: 1 # sample category for every sample + reward_type: validation_loss # uses eval loss of each dataset as reward + gamma: 0.1 # MAB hyper-parameter + eta: 0.2 # MAB hyper-parameter +datasets: + - name: dataset_1 + split: + train: 0.8 + validation: 0.2 # validation set is also used in ODM reward computation when reward_type is validation_loss. + sampling: 0.3 # used as starting weights for online data mixing + data_paths: + - "FILE_PATH" + data_handlers: + - name: tokenize_and_apply_input_masking + arguments: + remove_columns: all + batched: false + fn_kwargs: + input_column_name: input + output_column_name: output + - name: dataset_2 + split: + train: 0.6 + validation: 0.2 # validation set is also used in ODM reward computation when reward_type is validation_loss. + sampling: 0.4 # used as starting weights for online data mixing + data_paths: + - "FILE_PATH" + data_handlers: + - name: tokenize_and_apply_input_masking + arguments: + remove_columns: all + batched: false + fn_kwargs: + input_column_name: input + output_column_name: output + - name: dataset_3 + split: + train: 0.4 + validation: 0.1 # validation set is also used in ODM reward computation when reward_type is validation_loss. + sampling: 0.3 # used as starting weights for online data mixing + data_paths: + - "FILE_PATH" + data_handlers: + - name: tokenize_and_apply_input_masking + arguments: + remove_columns: all + batched: false + fn_kwargs: + input_column_name: input + output_column_name: output + - name: dataset_4 + split: + train: 0.0 + validation: 0.3 # validation set is also used in ODM reward computation when reward_type is validation_loss. + data_paths: + - "FILE_PATH" + data_handlers: + - name: tokenize_and_apply_input_masking + arguments: + remove_columns: all + batched: false + fn_kwargs: + input_column_name: input + output_column_name: output diff --git a/tests/artifacts/predefined_data_configs/pretokenized_data.yaml b/tests/artifacts/predefined_data_configs/pretokenized_data.yaml index 833173dea..2371e4585 100644 --- a/tests/artifacts/predefined_data_configs/pretokenized_data.yaml +++ b/tests/artifacts/predefined_data_configs/pretokenized_data.yaml @@ -1,5 +1,3 @@ -dataprocessor: - type: default datasets: - name: pretokenized_dataset data_paths: diff --git a/tests/artifacts/testdata/__init__.py b/tests/artifacts/testdata/__init__.py index 564b9cd93..3923d5639 100644 --- a/tests/artifacts/testdata/__init__.py +++ b/tests/artifacts/testdata/__init__.py @@ -44,6 +44,9 @@ TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL = os.path.join( JSONL_DATA_DIR, "twitter_complaints_input_output.jsonl" ) +NESTFUL_DATA_INPUT_OUTPUT_JSONL = os.path.join( + JSONL_DATA_DIR, "nestful_100_samples_input_output.jsonl" +) TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_ARROW = os.path.join( ARROW_DATA_DIR, "twitter_complaints_input_output.arrow" ) diff --git a/tests/artifacts/testdata/jsonl/nestful_100_samples_input_output.jsonl b/tests/artifacts/testdata/jsonl/nestful_100_samples_input_output.jsonl new file mode 100644 index 000000000..fb319343e --- /dev/null +++ b/tests/artifacts/testdata/jsonl/nestful_100_samples_input_output.jsonl @@ -0,0 +1,100 @@ +{"sample_id":"3a4b7b77-f0a1-4537-8623-432023f545bb","input":"If 20 liters of chemical X are added to 80 liters of a mixture that is 25% chemical X and 75% chemical Y, then what percentage of the resulting mixture is chemical X?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 25, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 80}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 20, \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"40.0"} +{"sample_id":"1e9cc106-de96-423d-a75f-e5d9bc48e150","input":"It takes 10 days for digging a trench of 100 m long, 50 m broad and 10 m deep. What length of trench,\n25 m broad and 15 m deep can be dug in 30 days ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 30, \"arg_1\": 50}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 10}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 10, \"arg_1\": 25}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 15, \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"400.0"} +{"sample_id":"95bcb3e1-3f25-4d3c-b611-cd19379cc1af","input":"Two employees X and Y are paid a total of Rs. 440 per week by their employer. If X is paid 120 percent of the sum paid to Y, how much is Y paid per week?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 1, \"arg_1\": 4}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 440, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 1, \"arg_1\": 4}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_7.result$\"}}]","tools":"[{\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}]","gold_answer":"200.0"} +{"sample_id":"e3e68bf5-479b-450b-8c4f-c635b0f75604","input":"I have a list of integers [1, 2, 3, 4, 5]. I want to find the 3rd largest element. Then, I want to convert the result to a float if possible, or keep it as a string otherwise.","output":"[{\"name\": \"find_kth_largest\", \"arguments\": {\"nums\": [1, 2, 3, 4, 5], \"k\": 3}, \"label\": \"$var1\"}, {\"name\": \"convert_to_float_or_string\", \"arguments\": {\"input_string\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"count_total_characters\", \"description\": \"Counts the total number of characters present in all lists in the dictionary.\", \"parameters\": {\"d\": {\"additionalProperties\": {\"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"description\": \"A dictionary where keys represent digits and values represent lists of strings.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The total number of characters as a single integer.\", \"type\": \"integer\"}}}, {\"name\": \"read_persons\", \"description\": \"Reads a JSON file and returns a list of dictionaries representing persons.\", \"parameters\": {\"file_path\": {\"description\": \"The path to the JSON file.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of dictionaries representing persons. Each dictionary has the keys \\\"name\\\", \\\"age\\\", \\\"height\\\", and \\\"weight\\\".\", \"type\": \"array\"}}}, {\"name\": \"convert_to_float_or_string\", \"description\": \"Converts a string to a float if possible, or returns the original string otherwise.\", \"parameters\": {\"input_string\": {\"description\": \"The input string to be converted.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The converted float or the original string.\", \"type\": [\"integer\", \"number\", \"string\"]}}}, {\"name\": \"create_foo_instance\", \"description\": \"Creates an object instance of Foo with the desired attributes.\", \"parameters\": {\"bar\": {\"description\": \"The value to set for the bar attribute of the Foo object. Default is 0.\", \"nullable\": true, \"type\": \"integer\"}, \"baz\": {\"description\": \"The value to set for the baz attribute of the Foo object. Default is 1.\", \"nullable\": true, \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"An object instance of Foo with the specified attributes.\", \"type\": \"object\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"verify_boolean\", \"description\": \"Determines whether a string represents a boolean value.\", \"parameters\": {\"s\": {\"description\": \"The string to be checked.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the string represents a valid boolean value, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"make_query_string\", \"description\": \"Creates a properly-formatted query string from a given list of search terms.\", \"parameters\": {\"start\": {\"description\": \"The starting index for the list of terms (defaults to 0).\", \"type\": \"integer\"}, \"terms\": {\"description\": \"A list of search terms (strings).\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of query strings.\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"add_if_unique\", \"description\": \"Adds `x` to the list `L` if and only if `x` does not already belong to `L`.\", \"parameters\": {\"L\": {\"description\": \"The list to which `x` may be added.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"x\": {\"description\": \"The element to be added to `L`.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"generate_lr_sequence\", \"description\": \"Generates a sequence of learning rates for a deep learning model.\\nThe learning rate decays exponentially over the course of `num_epochs` epochs.\", \"parameters\": {\"decay_factor\": {\"description\": \"The factor by which to decay the learning rate each epoch.\", \"type\": \"number\"}, \"initial_lr\": {\"description\": \"The initial learning rate.\", \"type\": \"number\"}, \"num_epochs\": {\"description\": \"The number of epochs over which to decay the learning rate.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of learning rates.\", \"type\": \"object\"}}}, {\"name\": \"find_kth_largest\", \"description\": \"Finds the kth largest element in a list of integers.\", \"parameters\": {\"k\": {\"description\": \"A positive integer.\", \"type\": \"integer\"}, \"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The kth largest element in the list. If k is not valid, returns None.\", \"type\": \"integer\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}]","gold_answer":"3"} +{"sample_id":"a6da425f-e619-4c73-abe5-88c175e4a938","input":"In a group of 95 students, 36 are taking History, and 32 are taking Statistics. If 59 students are taking History or Statistics or both, then how many students are taking History but not Statistics?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 36, \"arg_1\": 32}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 59}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 36, \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"27.0"} +{"sample_id":"877968a0-4dc7-49d5-935e-9cb886461607","input":"Find the unique common values in two lists [1, 2, 3, 4, 5] and [4, 5, 6, 7, 8]. Then, swap the values at index 0 and 1 in the resulting list.","output":"[{\"name\": \"unique_common_values\", \"arguments\": {\"list1\": [1, 2, 3, 4, 5], \"list2\": [4, 5, 6, 7, 8]}, \"label\": \"$var1\"}, {\"name\": \"swap_by_index\", \"arguments\": {\"values\": \"$var1.output_0$\", \"i\": 0, \"j\": 1}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"swap_by_index\", \"description\": \"Swaps the values at index i and j in the given list of integers.\", \"parameters\": {\"i\": {\"description\": \"The index of the first value to swap.\", \"type\": \"integer\"}, \"j\": {\"description\": \"The index of the second value to swap.\", \"type\": \"integer\"}, \"values\": {\"description\": \"The list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"read_source\", \"description\": \"Reads the content of a file and returns it as a string, skipping any lines that start with `#`.\\nA comment is added at the beginning of the returned value stating that it has been generated by this function.\", \"parameters\": {\"file\": {\"description\": \"The path to the file to be read.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"generate_signal\", \"description\": \"Generates a binary signal of given length.\\nThe generated signal consists of randomly generated 1-bit signals,\\nwhere each signal has a 10% chance of being a 1 (true) and a 90% chance\\nof being a 0 (false). The signal is represented as a string of 1s and 0s,\\nwith each character representing a signal.\", \"parameters\": {\"length\": {\"description\": \"The length of the signal to generate.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string of 1s and 0s representing the generated signal.\", \"type\": \"string\"}}}, {\"name\": \"unique_common_values\", \"description\": \"Returns a list of unique common values that occur in both input lists.\", \"parameters\": {\"list1\": {\"description\": \"The first input list.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"list2\": {\"description\": \"The second input list.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of unique common values.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"check_dates_for_increase_by_one_day\", \"description\": \"Checks if consecutive dates in a list differ by no more than one day.\", \"parameters\": {\"date_strings\": {\"description\": \"A list of date strings in the format '%Y-%m-%d %H:%M:%S'.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the difference between consecutive dates is less than one day, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"convert_filter\", \"description\": \"Converts a dictionary of key-value pairs into a list of tuples, `(key, value)`, where the key is a string (or an integer), and the value is a dictionary (or a list). Filters the list by excluding any tuples where the key is `\\\"foo\\\"` and the value is a list.\", \"parameters\": {\"dict_input\": {\"additionalProperties\": {\"type\": [\"array\", \"object\"]}, \"description\": \"The input dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of tuples, `(key, value)`, where the key is a string (or an integer), and the value is a dictionary (or a list).\", \"type\": \"array\"}}}, {\"name\": \"extract_tags_and_values\", \"description\": \"Parses an XML string and extracts all the tags and their corresponding values.\", \"parameters\": {\"xml_string\": {\"description\": \"The XML string to parse.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary containing each tag-value pair, where the key is the tag name and the value is its value.\", \"type\": \"object\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"partition_comments\", \"description\": \"Partitions a list of comments into a dictionary mapping user_id to a list of comment_texts.\", \"parameters\": {\"comments\": {\"description\": \"A list of strings, each in the format `user_id|comment_id|comment_text`.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary mapping `user_id` to a list of `comment_texts`.\", \"type\": \"object\"}}}, {\"name\": \"trend_and_retrend\", \"description\": \"Performs trending and retrending on a sequence of data points.\", \"parameters\": {\"sequence\": {\"description\": \"A sequence of real numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}, \"start\": {\"description\": \"The start value.\", \"type\": \"number\"}, \"trend\": {\"description\": \"The trend value.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"remove_subsequence\", \"description\": \"Removes all subsequences between two specific characters in a string.\", \"parameters\": {\"start_end\": {\"description\": \"A tuple of two characters representing the start and end of the subsequence to remove.\", \"prefixItems\": [{\"type\": \"string\"}, {\"type\": \"string\"}], \"type\": \"array\"}, \"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The modified string, excluding the subsequence between the characters.\", \"type\": \"string\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"multiply_max_k_vector\", \"description\": \"Returns the maximum product of any two distinct elements in `nums` that are `k` indices apart.\", \"parameters\": {\"k\": {\"description\": \"A positive integer.\", \"type\": \"integer\"}, \"nums\": {\"description\": \"A non-empty list of non-zero integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The maximum product of any two distinct elements in `nums` that are `k` indices apart.\", \"type\": \"integer\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}]","gold_answer":"[5, 4]"} +{"sample_id":"d6bd765f-9551-4099-8b2a-da154e0cf2aa","input":"At a loading dock, each worker on the night crew loaded 2\/3 as many boxes as each worker on the day crew. If the night crew has 5\/6 as many workers as the day crew, what fraction of all the boxes loaded by the two crews did the day crew load?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 3}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 3}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 2, \"arg_1\": 5}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"0.6428571428571429"} +{"sample_id":"236711c7-5a1c-4bf5-b578-6e965b98a085","input":"A train running at the speed of 60 km\/hr crosses a pole in 6 seconds. Find the length of the train.","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 1000}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 3600}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 6}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}]","gold_answer":"100.0"} +{"sample_id":"9abbe8fb-bcc9-4ea6-91f9-e23c24cf0f60","input":"I have a dictionary {'a': 1, 'b': 2, 'c': 3} and I want to convert it to a JSON string. Then, I want to tokenize the JSON string by removing punctuation and converting words to lowercase.","output":"[{\"name\": \"make_json_string\", \"arguments\": {\"dictionary\": {\"a\": 1, \"b\": 2, \"c\": 3}}, \"label\": \"$var1\"}, {\"name\": \"tokenize_sentence\", \"arguments\": {\"sentence\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"make_json_string\", \"description\": \"Converts a dictionary to a JSON string.\", \"parameters\": {\"dictionary\": {\"description\": \"The dictionary to convert to JSON.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string representing the same data in JSON format.\", \"type\": \"string\"}}}, {\"name\": \"count_runs\", \"description\": \"Returns a list of tuples (start, end, count) where each tuple represents a contiguous run of the same number in the input list.\", \"parameters\": {\"numbers\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of tuples (start, end, count) where each tuple represents a contiguous run of the same number in the input list.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"escape_single_quotes_and_backslash\", \"description\": \"Escapes single quotes and backslashes in a string.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new string with all single quotes and backslashes escaped.\", \"type\": \"object\"}}}, {\"name\": \"compute_vector_distance\", \"description\": \"Calculates the Euclidean distance between two 1-dimensional vectors.\", \"parameters\": {\"vector1\": {\"description\": \"The first 1-dimensional vector.\", \"type\": \"object\"}, \"vector2\": {\"description\": \"The second 1-dimensional vector.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The Euclidean distance between the two vectors.\", \"type\": \"number\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"shorten_list\", \"description\": \"Removes duplicate values from a list of integers and returns a new list with unique values in reverse order.\", \"parameters\": {\"lst\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new list with unique values in reverse order.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"validate_alpha_underscore_string\", \"description\": \"Checks if a string consists only of uppercase and lowercase letters and underscores.\", \"parameters\": {\"s\": {\"description\": \"The input string to validate.\", \"nullable\": true, \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the string consists only of uppercase and lowercase letters and underscores, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"escape_special_characters\", \"description\": \"Escapes all special characters in a string using Python's escaping rules.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The escaped string.\", \"type\": \"string\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"list_length\", \"description\": \"Calculates the length of a list without using the built-in `len()` function.\", \"parameters\": {\"data\": {\"description\": \"The list to calculate the length of.\", \"items\": {}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The length of the list.\", \"type\": \"integer\"}}}, {\"name\": \"fill_lat_long_for_fingerprints\", \"description\": \"A function that returns None and does not accept any parameters.\", \"parameters\": {}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"get_top\", \"description\": \"Creates a dictionary with the top n largest amounts from a list of tuples.\\n\\nThe dictionary is keyed by the unique id of the element, and the value is the amount.\\nThe dictionary is sorted in descending order.\", \"parameters\": {\"arr\": {\"description\": \"A list of tuples of the form (id, amount) with id being a unique identifier and amount being a positive integer.\", \"items\": {\"prefixItems\": [{\"type\": \"string\"}, {\"type\": \"integer\"}], \"type\": \"array\"}, \"type\": \"array\"}, \"n\": {\"description\": \"The number of top elements to return.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"tokenize_sentence\", \"description\": \"Tokenizes a sentence by removing punctuation and converting words to lowercase.\", \"parameters\": {\"sentence\": {\"description\": \"The sentence to tokenize.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of tokens.\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}]","gold_answer":"['{\"a\":', '1', '\"b\":', '2', '\"c\":', '3}']"} +{"sample_id":"04833334-0a98-443d-b24e-41b78da083b1","input":"A trader sells 23 meters of cloth for Rs. 529 at the profit of Rs. 5 per metre of cloth. What is the cost price of one metre of cloth?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 529, \"arg_1\": 23}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 5}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"18.0"} +{"sample_id":"c200f317-59a8-49a8-9d06-b832587ef4bf","input":"Replace every occurrence of 0 in the list [1, 0, 1, 0, 1] with 2. Then, group all the 0's and 1's together in the resulting list.","output":"[{\"name\": \"replace_with_target\", \"arguments\": {\"src_list\": [1, 0, 1, 0, 1], \"target\": 0, \"replacement\": 2}, \"label\": \"$var1\"}, {\"name\": \"group_zeros_and_ones\", \"arguments\": {\"input_list\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"replace_with_target\", \"description\": \"Replaces every occurrence of `target` in `src_list` with `replacement`.\\nIf `target` does not occur in `src_list`, returns an empty list.\", \"parameters\": {\"replacement\": {\"description\": \"The integer to replace `target` with.\", \"type\": \"integer\"}, \"src_list\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"target\": {\"description\": \"The integer to be replaced.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"split_text_into_key_val_tuples\", \"description\": \"Splits a string of key-value pairs into a list of tuples representing the split key-value pairs.\", \"parameters\": {\"text\": {\"description\": \"A string of key-value pairs.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing a list of tuples representing the split key-value pairs and the default value.\", \"type\": \"array\"}}}, {\"name\": \"convert_to_base64_url\", \"description\": \"Converts a byte array to a Base64-encoded string using the URL-safe alphabet.\", \"parameters\": {\"byte_array\": {\"description\": \"A byte array to be converted to Base64.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"group_zeros_and_ones\", \"description\": \"Groups all the 0's together and all the 1's together in a list.\", \"parameters\": {\"input_list\": {\"description\": \"A list of 0's and 1's.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of 0's and 1's with all the 0's grouped together and all the 1's grouped together.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"get_range_description\", \"description\": \"Returns the corresponding description for a given range string, or None if the range string is not present in the table.\", \"parameters\": {\"range_string\": {\"description\": \"A string in the form of \\\"x-y\\\" representing a range.\", \"type\": \"string\"}, \"table\": {\"description\": \"A list of lists, where each inner list corresponds to a row in the table. Each row contains two elements: the range string and the description string.\", \"items\": {\"items\": {\"nullable\": true, \"type\": \"string\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"generate_integer_string\", \"description\": \"Generates a string representation of a given integer.\", \"parameters\": {\"integer\": {\"description\": \"The integer to be represented as a string.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"replace_abc_with_def\", \"description\": \"Replaces all occurrences of the substring \\\"abc\\\" with \\\"def\\\" in the input string.\", \"parameters\": {\"input_string\": {\"description\": \"The input string to be modified.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The modified string with all occurrences of \\\"abc\\\" replaced with \\\"def\\\".\", \"type\": \"string\"}}}]","gold_answer":"[1, 2, 1, 2, 1]"} +{"sample_id":"680c7db5-488f-4216-8c9c-1e29e98be289","input":"An amount at compound interest sums to Rs.17640\/- in 2 years and to Rs.20286\/- in 3 years at the same rate of interest. Find the rate percentage?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 20286, \"arg_1\": 17640}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 17640}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"rhombus_area\", \"description\": \"Calculate the area of a rhombus\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the first diagonal\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Length of the second diagonal\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the rhombus\", \"type\": \"float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"15.0"} +{"sample_id":"a86a1e7c-50d5-4b95-8406-ca3da90ca7a8","input":"If P(A) = 3\/5 and P (B) = 2\/5, find P (A n B) if A and B are independent events.","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 5}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 2, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"rhombus_area\", \"description\": \"Calculate the area of a rhombus\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the first diagonal\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Length of the second diagonal\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the rhombus\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"0.24"} +{"sample_id":"0c2bb42b-09bd-41c8-b1c3-a3e0aec4c077","input":"If a > x > y > z on the number line, y is halfway between x and z, and x is halfway between w and z, then (y - x)\/(y - a) =","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 2, \"arg_1\": 2}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"rhombus_area\", \"description\": \"Calculate the area of a rhombus\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the first diagonal\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Length of the second diagonal\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the rhombus\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"0.3333333333333333"} +{"sample_id":"038d6798-cb67-4083-8293-acf7a4719d36","input":"a department of 10 people - 6 men and 4 women - needs to send a team of 5 to a conference . if they want to make sure that there are no more than 3 members of the team from any one gender , how many distinct groups are possible to send ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 4}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 5}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 5}}, {\"name\": \"add\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"180.0"} +{"sample_id":"47e99ea3-6afe-4fec-87ea-bbd2847d8f79","input":"If 20 men can build a water fountain 56 metres long in 3 days, what length of a similar water fountain can be built by 35 men in 3 days?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 20, \"arg_1\": 3}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 56, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 35, \"arg_1\": 3}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"98.0"} +{"sample_id":"25558ef9-4c6d-4de8-b3a4-a1f4bf6eb7b9","input":"A person crosses a 500 m long street in 4 minutes. What is his speed in km per hour?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 500, \"arg_1\": 1000}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 60}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 3600}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"7.5"} +{"sample_id":"88659452-fa94-4511-b6c2-f44d1d792cfe","input":"the averge score of a cricketer for 10 matches is 45 runs . if the average for the first 6 matches is 48 . then find the average for the last 4 matches ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 45, \"arg_1\": 10}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 48}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 4}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"40.5"} +{"sample_id":"86326e16-0769-4d0a-95f0-a811626ba616","input":"The difference between the compound interest compounded annually and simple interest for 2 years at 20% per annum is Rs.288. Find the principal?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 20, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 1}}, {\"name\": \"power\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 20, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 1}}, {\"name\": \"subtract\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_6.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": 288, \"arg_1\": \"$var_7.result$\"}}]","tools":"[{\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}]","gold_answer":"7200.0"} +{"sample_id":"003e29b9-7757-4365-93aa-efdaa8e2f7c1","input":"Generate a random string of 10 characters. Then check if the generated string is iterable.","output":"[{\"name\": \"rand_str\", \"arguments\": {\"num_chars\": 10}, \"label\": \"$var1\"}, {\"name\": \"is_object_iterable\", \"arguments\": {\"obj\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"is_object_iterable\", \"description\": \"Checks if a given object is iterable or not.\", \"parameters\": {\"obj\": {\"description\": \"The object to check.\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the object is iterable, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"linear_operator\", \"description\": \"Applies a linear operator to a list of numbers.\", \"parameters\": {\"input\": {\"description\": \"A single-dimensional Python list of numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}, \"operator\": {\"description\": \"One of `'sum'`, `'mean'`, or `'max'`.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"get_sorted_pairs\", \"description\": \"Returns a sorted list of key-value pairs based on the values of the dictionary.\\nThe pairs are sorted in descending order based on the values.\", \"parameters\": {\"dictionary\": {\"additionalProperties\": {\"type\": \"integer\"}, \"description\": \"The input dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"dynamic_sum\", \"description\": \"Calculates the sum of each integer and the sum of all preceding integers in a list.\", \"parameters\": {\"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of integers where each element is the sum of the integer itself and the sum of all preceding integers in the original list.\", \"type\": \"array\"}}}, {\"name\": \"convert_ip_to_decimal\", \"description\": \"Converts an IP address from a string representation to a decimal number representation.\", \"parameters\": {\"ip_string\": {\"description\": \"A string in the format \\\"a.b.c.d\\\", where a, b, c, and d are decimal numbers ranging from 0 to 255.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"An integer representation of the IP address.\", \"type\": \"integer\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"rand_str\", \"description\": \"Generates a pseudo-random string of `num_chars` characters.\\nThe string is composed of lowercase letters, digits, and underscores (`_`).\", \"parameters\": {\"num_chars\": {\"description\": \"The number of characters in the string.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"remove_dollar_sign_and_commas\", \"description\": \"Removes the dollar sign and commas from a string and returns a number.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A number (float or int) without the dollar sign or commas.\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"urlsafe_base64_encode\", \"description\": \"Generates a base64 encoding of a given string, where the generated encoding is URL-safe and uses a `-` and `_` character set instead of the default `+` and `\/` characters.\", \"parameters\": {\"text\": {\"description\": \"The input string to be encoded.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A URL-safe base64 encoded string.\", \"type\": \"string\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}]","gold_answer":"True"} +{"sample_id":"7727cd5b-d0a1-4779-bfee-60e255bd98fb","input":"If a man lost 7% by selling oranges at the rate of 21 a rupee at how many a rupee must he sell them to gain 42%?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 7}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 21}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 42}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}]","gold_answer":"13.75"} +{"sample_id":"a090dadc-191f-4557-87fb-ab16b9929bb0","input":"I have a list of integers [1, 2, 3, 4, 5, 6, 7, 8, 9] and I want to find the largest integer that is less than 10. Then, I want to pad this number with leading zeroes so that it has at least 4 digits in length.","output":"[{\"name\": \"find_largest_less_than\", \"arguments\": {\"numbers\": [1, 2, 3, 4, 5, 6, 7, 8, 9], \"value\": 10}, \"label\": \"$var1\"}, {\"name\": \"pad_to_len\", \"arguments\": {\"num\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"pad_to_len\", \"description\": \"Pads a number with leading zeroes so that it has at least 4 digits in length.\", \"parameters\": {\"num\": {\"description\": \"The number to pad.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The padded number as a string.\", \"type\": \"string\"}}}, {\"name\": \"read_lines_containing_python\", \"description\": \"Reads the specified file and returns all lines containing \\\"python\\\", \\\"Python\\\", or \\\"PYTHON\\\" (case-insensitive).\", \"parameters\": {\"file_path\": {\"description\": \"The path to the file to read.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of lines containing \\\"python\\\", \\\"Python\\\", or \\\"PYTHON\\\".\", \"type\": \"array\"}}}, {\"name\": \"extract_item_value\", \"description\": \"Extracts the \\\"value\\\" attribute of the \\\"item\\\" tag from an XML document.\", \"parameters\": {\"xml_doc\": {\"description\": \"The XML document as a string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of \\\"value\\\" attribute values if successful, otherwise None.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"find_largest_less_than\", \"description\": \"Finds the largest integer in a list that is less than a given value.\", \"parameters\": {\"numbers\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"value\": {\"description\": \"The value to compare against.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The largest integer in the list that is less than the given value, or None if no such integer exists.\", \"type\": \"integer\"}}}, {\"name\": \"remove_trailing_whitespace_and_split\", \"description\": \"Removes all trailing whitespaces from the input string, splits the string into a list of words, uses list comprehension to build the list of words, and raises an exception if the string contains any non-alphabetic characters.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"get_top_3\", \"description\": \"Reads a JSON-formatted file and returns a list of tuples with the top 3 pairs of keys and values, sorted in descending order of values.\", \"parameters\": {\"file_path\": {\"description\": \"The path to the JSON-formatted file.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of tuples with the top 3 pairs of keys and values.\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"extract_consecutive_substrings\", \"description\": \"Extracts all consecutive substrings of the given string that match the regular expression.\", \"parameters\": {\"s\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of all consecutive substrings that match the regular expression.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}]","gold_answer":"0009"} +{"sample_id":"6dab689a-7d58-4d74-8286-0b328f3316fe","input":"An inspector rejects 15% of the meters as defective. How many will he examine to reject 15?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 15, \"arg_1\": 100}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 15}}]","tools":"[{\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"100.0"} +{"sample_id":"76de8525-048b-4209-8867-48bfb6ff6fa8","input":"5 years ago , the average age of a , b , c and d was 45 years . with e joining them now , the average of all the 5 is 50 years . the age of e is ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 50, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 2, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 45, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 4}}, {\"name\": \"add\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"50.0"} +{"sample_id":"4a6b0fd5-d75b-47c0-8130-ff584963f6c4","input":"A mixture of sand and cement contains, 3 parts of sand and 5 parts of cement. How much of the mixture must be substituted with sand to make the mixture half sand and half cement?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 5}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 3}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"0.2"} +{"sample_id":"4b9c599c-337e-4c65-8fc9-0d2cf7d4cfdb","input":"15 men take 21 days of 8 hrs. each to do a piece of work. How many days of 4 hrs. each would it take for 21 women if 3 women do as much work as 2 men?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 15, \"arg_1\": 21}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 8}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 21, \"arg_1\": 4}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 2, \"arg_1\": 3}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}]","gold_answer":"45.0"} +{"sample_id":"9fa5c9a4-4c21-426d-8886-acbf08539139","input":"A big container is 35% full with water. If 16 liters of water is added, the container becomes 3\/4 full. What is the capacity of the big container in liters?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 4}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 35, \"arg_1\": 100}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 16, \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"40.0"} +{"sample_id":"fcd633f2-90eb-42fb-88db-1fbfb3382071","input":"Given a dictionary {'1': 10, '2': 20, '3': 30}, find the maximum value and then format it with padding of length 5.","output":"[{\"name\": \"find_dict_max\", \"arguments\": {\"d\": {\"1\": 10, \"2\": 20, \"3\": 30}}, \"label\": \"$var1\"}, {\"name\": \"format_string_with_padding\", \"arguments\": {\"string\": \"$var1.output_0$\", \"padding_length\": 5}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"format_file_path\", \"description\": \"Formats a file path.\\n\\nIf the file path is a relative path, the function returns the path starting with '.\/',\\notherwise, the function returns the path without any changes.\", \"parameters\": {\"path\": {\"description\": \"The file path to format.\", \"type\": [\"object\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"format_headers\", \"description\": \"Formats a list of HTTP headers, represented as a list of tuples.\\n\\nEach tuple should have the format `(key, value)` and should be converted to a string of the form `key: value`,\\nwhere the key and value are separated by a colon.\", \"parameters\": {\"headers\": {\"description\": \"A list of tuples, where each tuple has exactly two elements.\", \"items\": {\"prefixItems\": [{\"type\": \"string\"}, {\"type\": \"string\"}], \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of formatted headers.\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"calculate_total_frames\", \"description\": \"Calculates the total number of frames in a video given its duration and frame rate.\", \"parameters\": {\"frame_rate\": {\"description\": \"The number of frames per second.\", \"type\": \"number\"}, \"video_duration\": {\"description\": \"The duration of the video in seconds.\", \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"abs_limited_to\", \"description\": \"Calculates the absolute value of an integer `x`, limited to a minimum value of `min_value`.\", \"parameters\": {\"min_value\": {\"description\": \"The minimum value to limit the absolute value to.\", \"type\": [\"integer\", \"number\"]}, \"x\": {\"description\": \"The integer to calculate the absolute value of.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The absolute value of `x`, limited to a minimum value of `min_value`.\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"identity_matrix\", \"description\": \"Returns the identity matrix of a given tensor.\", \"parameters\": {\"tensor\": {\"description\": \"The input tensor.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"find_dict_max\", \"description\": \"Finds the maximum value in a dictionary, given its keys are integers.\", \"parameters\": {\"d\": {\"additionalProperties\": {\"type\": \"number\"}, \"description\": \"The dictionary to find the maximum value in.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The maximum value in the dictionary.\", \"type\": \"number\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"clamp_and_convert_to_uint8\", \"description\": \"Clamps the values in a PyTorch tensor to the range [0, 1] and converts them to the uint8 dtype.\", \"parameters\": {\"x\": {\"description\": \"The input PyTorch tensor representing an image with dimensions (C, H, W).\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The clamped and converted tensor.\", \"type\": \"object\"}}}, {\"name\": \"map_list_of_tuples\", \"description\": \"Maps a list of tuples (containing a string and an integer) into a list of strings.\\nEach string is constructed from the tuple's string component and an integer starting from 0.\", \"parameters\": {\"tuple_list\": {\"description\": \"A list of tuples, where each tuple contains a string and an integer.\", \"items\": {\"prefixItems\": [{\"type\": \"string\"}, {\"type\": \"integer\"}], \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of strings, where each string is constructed from the tuple's string component and an integer starting from 0.\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"format_string_with_padding\", \"description\": \"Formats a string with padding.\", \"parameters\": {\"padding_length\": {\"description\": \"The total length of the string with padding.\", \"type\": [\"integer\", \"number\"]}, \"string\": {\"description\": \"The original string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"normalize_and_rescale\", \"description\": \"Normalizes and rescales a time series dataset.\", \"parameters\": {\"dataset\": {\"description\": \"A pandas DataFrame containing columns 'Time', 'Value', and 'Diff'.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}]","gold_answer":" 30"} +{"sample_id":"f6aa4233-451e-4e33-abe1-451a313b6fec","input":"If 50% of (x-y) = 30% of (x+y) then what percent of x is y?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 50, \"arg_1\": 30}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 50, \"arg_1\": 30}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}]","gold_answer":"25.0"} +{"sample_id":"6f343b2c-42bb-4d4d-956e-2628490d5350","input":"If x\/y = 5\/3, then (x + y)\/(x - y) = ?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 3}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 3}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"4.0"} +{"sample_id":"d849c5fb-b7db-456e-9aa1-d55dae6d8cb8","input":"A particular store purchased a stock of turtleneck sweaters and marked up its cost by 20%. During the New Year season, it further marked up its prices by 25% of the original retail price. In February, the store then offered a discount of 15%. What was its profit on the items sold in February?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 15}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 20}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 25}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_5.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_6.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"27.5"} +{"sample_id":"95f4c040-4bac-4c75-b790-8446b76e4609","input":"Given a list of integers [1, 2, 3, 4, 5], calculate the maximum sum of all non-empty sublists. Then, convert the result to its decimal representation as a string, starting from the least significant digit.","output":"[{\"name\": \"maxSubarraySum\", \"arguments\": {\"nums\": [1, 2, 3, 4, 5]}, \"label\": \"$var1\"}, {\"name\": \"convert_reversed\", \"arguments\": {\"n\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"maxSubarraySum\", \"description\": \"Calculates the maximum sum of all non-empty sublists in a list of integers.\", \"parameters\": {\"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The maximum sum of all non-empty sublists.\", \"type\": \"integer\"}}}, {\"name\": \"remove_less_or_equal_to_3\", \"description\": \"Removes every element from a list of numbers whose value is less than or equal to 3.\", \"parameters\": {\"numbers\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new list containing only the elements from the input list that are greater than 3.\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"hex_from_bytes\", \"description\": \"Converts a byte array to its hexadecimal representation.\", \"parameters\": {\"byte_array\": {\"description\": \"The byte array to convert.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The hexadecimal representation of the byte array as a string.\", \"type\": \"string\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"search_terms\", \"description\": \"Counts the number of search terms that appear in the text string.\", \"parameters\": {\"terms\": {\"description\": \"A collection of search terms.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"text\": {\"description\": \"The text string to search.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The number of search terms that appear in the text string.\", \"type\": \"integer\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"replace_tabs\", \"description\": \"Replaces any tab characters in a string with spaces.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The modified string with tab characters replaced by spaces.\", \"type\": \"string\"}}}, {\"name\": \"sum_and_avg\", \"description\": \"Calculates the sum and average of a list of three numbers.\", \"parameters\": {\"numbers\": {\"description\": \"A list of three numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing the sum and average of the input numbers.\", \"type\": \"array\"}}}, {\"name\": \"nth_fib_recursion\", \"description\": \"Computes the n-th digit in the Fibonacci sequence.\", \"parameters\": {\"n\": {\"description\": \"The position of the digit in the Fibonacci sequence.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"is_mobile\", \"description\": \"Determines whether a user agent string is from a mobile device or not.\", \"parameters\": {\"user_agent\": {\"description\": \"The user agent string to check.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the user agent string contains the substring 'Mobile' or 'Android', and False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"broadcast_add\", \"description\": \"Adds two NumPy arrays `a` and `b` of compatible shapes by performing broadcasting on the arrays to match each other's shapes.\", \"parameters\": {\"a\": {\"description\": \"The first NumPy array.\", \"type\": \"object\"}, \"b\": {\"description\": \"The second NumPy array.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"calculate_subarray_sum\", \"description\": \"Calculates the sum of all subarrays of size K in the given array.\", \"parameters\": {\"K\": {\"description\": \"The size of the subarrays.\", \"type\": \"integer\"}, \"array\": {\"description\": \"The input array of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"convert_reversed\", \"description\": \"Converts a positive integer `n` to its decimal representation as a string, starting from the least significant digit.\", \"parameters\": {\"n\": {\"description\": \"A positive integer.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The decimal representation of `n` as a string, starting from the least significant digit.\", \"type\": \"string\"}}}]","gold_answer":"51"} +{"sample_id":"e74da2b0-ed5d-4a47-9011-3aa9357f21db","input":"the sum of 7th and 23rd term of A.P. is equal to the sum of 8th , 15th and 13 th term . find the term which is 0","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 8, \"arg_1\": 15}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 13, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 23}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}]","gold_answer":"6.0"} +{"sample_id":"44ed2df4-0f98-4839-b8ab-c0aa5c03e8b2","input":"The sum q of prime numbers that are greater than 60 but less than 70 is","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 1}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 70, \"arg_1\": 3}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}]","gold_answer":"128.0"} +{"sample_id":"2b820d2a-4e43-433b-939c-69e6e8719c57","input":"If n is a prime number greater than 5, what is the remainder when n^2 is divided by 12?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 2}}, {\"name\": \"power\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 12, \"arg_1\": 4}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"1.0"} +{"sample_id":"55754e10-54f7-4798-8c97-c3db54fbb9b1","input":"The average age of 15 students of a class is 15 years. Out of these, the average age of 4 students is 14 years and that of the other 10 students is 16 years. The age of the 15th student is","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 15, \"arg_1\": 15}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 14}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 10, \"arg_1\": 16}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}]","gold_answer":"9.0"} +{"sample_id":"f50c216d-76ee-4609-8fd7-5e6efeb01927","input":"The mean of 50 observations was 36. It was found later that an observation 48 was wrongly taken as 23. The corrected new mean is :","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 36, \"arg_1\": 50}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 50, \"arg_1\": 2}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 23}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 50}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}]","gold_answer":"36.5"} +{"sample_id":"0ab5c7ba-2c53-4207-af42-6c1ce32aac9b","input":"A fashion designer sold a pair of jeans to a retail store for 40 percent more than it cost to manufacture the pair of jeans. A customer bought the pair of jeans for 35 percent more than the retailer paid for them. The price the customer paid was what percent greater than the cost of manufacturing the jeans?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 40, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 100, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 35, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_5.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 100}}, {\"name\": \"subtract\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": \"$var_8.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}]","gold_answer":"89.0"} +{"sample_id":"de437463-bbfe-4f72-8150-448d6469ba43","input":"I want to find the elastic modulus of a material with a Young's modulus of 200 GPa and a Poisson's ratio of 0.3. Then, I want to round this value to the nearest 10 GPa.","output":"[{\"name\": \"calculate_elastic_modulus\", \"arguments\": {\"E_Y\": 200, \"v\": 0.3}, \"label\": \"$var1\"}, {\"name\": \"round_to_value\", \"arguments\": {\"x\": \"$var1.output_0$\", \"y\": 10, \"strategy\": \"nearest\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"check_if_valid_number\", \"description\": \"Checks if a string is a valid number.\", \"parameters\": {\"string\": {\"description\": \"The string to check.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the string is a valid number, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"pixel_position_to_angle\", \"description\": \"Converts a pixel position `x` to an angle in degrees.\\n\\nThe angle is in the range `-90` to `90`, where `-90` maps to the leftmost pixel and `90` maps to the rightmost pixel.\", \"parameters\": {\"width\": {\"description\": \"The image width in pixels.\", \"type\": \"integer\"}, \"x\": {\"description\": \"The pixel position.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The angle in degrees.\", \"type\": \"number\"}}}, {\"name\": \"detect_outliers\", \"description\": \"Detects outliers in a dataset.\\n\\nAn outlier is a data point that is significantly different from the rest of the data.\\nThis function uses the mean and standard deviation to detect outliers.\", \"parameters\": {\"data\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of indices of the outliers.\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"create_person_json\", \"description\": \"Creates a Person object with the given name and age and returns a JSON object containing the name and age properties.\", \"parameters\": {\"age\": {\"description\": \"The age of the person.\", \"type\": \"integer\"}, \"name\": {\"description\": \"The name of the person.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A JSON object containing the name and age properties.\", \"type\": \"object\"}}}, {\"name\": \"calculate_elastic_modulus\", \"description\": \"Calculates the elastic modulus of a material based on its Young's modulus and Poisson's ratio.\", \"parameters\": {\"E_Y\": {\"description\": \"The Young's modulus of the material.\", \"type\": [\"integer\", \"number\"]}, \"v\": {\"description\": \"The Poisson's ratio of the material.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"convert_shortened_url\", \"description\": \"Converts a shortened URL into a long URL by concatenating a given base URL with the string following the last slash in the shortened URL.\", \"parameters\": {\"base_url\": {\"description\": \"The base URL to be used for concatenation.\", \"type\": \"string\"}, \"shortened_url\": {\"description\": \"The shortened URL to be converted.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The long URL as a string.\", \"type\": \"string\"}}}, {\"name\": \"round_to_value\", \"description\": \"Rounds a value to a specified value using a specified rounding strategy.\", \"parameters\": {\"strategy\": {\"description\": \"The rounding strategy to use. Can be either \\\"ceil\\\", \\\"floor\\\", or \\\"nearest\\\".\", \"type\": \"string\"}, \"x\": {\"description\": \"The value to be rounded.\", \"type\": [\"integer\", \"number\"]}, \"y\": {\"description\": \"The value to round to.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"serialize_file\", \"description\": \"Serializes the data of a file using pickle and returns a list containing the serialized data and its size.\", \"parameters\": {\"path\": {\"description\": \"The file path.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list containing the serialized data and its size.\", \"type\": \"object\"}}}, {\"name\": \"convert_datetime_to_string\", \"description\": \"Converts a datetime object to a string representing the corresponding date and time in the format \\\"YYYY-MM-DD HH:MM:SS\\\".\", \"parameters\": {\"dt\": {\"description\": \"The datetime object to be converted.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string representing the corresponding date and time in the format \\\"YYYY-MM-DD HH:MM:SS\\\".\", \"type\": \"string\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"filter_df_by_regex\", \"description\": \"Filters a given pandas DataFrame based on a regex matching pattern.\", \"parameters\": {\"columns\": {\"description\": \"A list of columns to match the pattern in.\", \"type\": \"object\"}, \"df\": {\"description\": \"A pandas DataFrame to be filtered.\", \"type\": \"object\"}, \"regex\": {\"description\": \"A regular expression pattern used for matching.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new DataFrame that contains only the rows that match the regular expression pattern in the specified columns.\", \"type\": \"object\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}]","gold_answer":"220"} +{"sample_id":"4156224c-b760-4b07-9ab2-2835fff4d77d","input":"How many bricks, each measuring 25cm*11.25cm*6cm, will be needed to build a wall 8m*6m*22.5m","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 8, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 6, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 22}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 25, \"arg_1\": 11}}, {\"name\": \"multiply\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 6}}, {\"name\": \"divide\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": \"$var_6.result$\"}}]","tools":"[{\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"6400.0"} +{"sample_id":"c5877c48-14f3-4ca5-a211-18e00054e484","input":"Cindy has her eye on a sundress but thinks it is too expensive. It goes on sale for 15% less than the original price. Before Cindy can buy the dress, however, the store raises the new price by 25%. If the dress cost $51 after it went on sale for 15% off, what is the difference between the original price and the final price?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 25}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 51, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 15}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 100}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 51, \"arg_1\": \"$var_5.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_6.result$\"}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}]","gold_answer":"3.75"} +{"sample_id":"2d889f67-4268-4127-8af8-7412e813208d","input":"A, B and C can do a piece of work in 7 days, 14 days and 28 days respectively. How long will they take to finish the work, if all the three work together?","output":"[{\"name\": \"inverse\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 28}}, {\"name\": \"inverse\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 7}}, {\"name\": \"inverse\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 14}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"add\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"inverse\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"4.0"} +{"sample_id":"bb1b666b-9820-472a-87ab-7c03411de17b","input":"A person buys an article at $380. At what price should he sell the article so as to make a profit of 25%?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 25, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 380, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 380, \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}]","gold_answer":"475.0"} +{"sample_id":"3f65525e-d400-455f-b5b1-5139d3264086","input":"How many gallons of milk that is 10 percent butter-fat must be added to 8 gallons of milk that is 25 percent butterfat to obtain milk that is 20 percent butterfat?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 25, \"arg_1\": 20}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 8}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 10}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rhombus_area\", \"description\": \"Calculate the area of a rhombus\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the first diagonal\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Length of the second diagonal\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the rhombus\", \"type\": \"float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}]","gold_answer":"4.0"} +{"sample_id":"ba2f29b4-2df5-448e-af7a-6ed3bf3a817a","input":"Village P\u2019s population is 1150 greater than Village Q's population. If Village Q\u2019s population were reduced by 200 people, then Village P\u2019s population would be 4 times as large as Village Q's population. What is Village Q's current population?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 200, \"arg_1\": 4}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1150, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 3}}]","tools":"[{\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}]","gold_answer":"650.0"} +{"sample_id":"b174255f-9249-4dc5-a214-1bfed5112330","input":"In a certain warehouse, 50 percent of the packages weigh less than 75 pounds, and a total of 48 packages weigh less than 25 pounds. If 80 percent of the packages weigh at least 25 pounds, how many of the packages weigh at least 25 pounds but less than 75 pounds?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 80}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 48, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 50}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 100}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 48}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"rhombus_area\", \"description\": \"Calculate the area of a rhombus\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the first diagonal\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Length of the second diagonal\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the rhombus\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}]","gold_answer":"72.0"} +{"sample_id":"535072fe-c1ab-4eda-adbf-feeb2bf4d808","input":"If the number is divided by 3, it reduced by 34. The number is","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 34, \"arg_1\": 3}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"51.0"} +{"sample_id":"48fdeea6-6a06-4a60-8b8f-b0e425761d1a","input":"50% of the population of a village is 23040. The total population of the village is ?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 50}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 23040}}]","tools":"[{\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}]","gold_answer":"46080.0"} +{"sample_id":"ecef87a4-23be-44fe-957f-3da0c460b4c1","input":"Calculate the square root of 100, then add two leading zeros to the result if its length is less than 2.","output":"[{\"name\": \"math_sqrt\", \"arguments\": {\"x\": 100}, \"label\": \"$var1\"}, {\"name\": \"add_leading_zeros\", \"arguments\": {\"string\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"format_labels\", \"description\": \"Formats a list of labels by adding underscores to ensure all labels have a length of exactly `label_length`.\", \"parameters\": {\"label_length\": {\"description\": \"The desired length of each label.\", \"type\": \"integer\"}, \"labels\": {\"description\": \"A list of labels.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of formatted labels, where each label is a string of exactly `label_length` characters.\", \"type\": \"array\"}}}, {\"name\": \"extract_element_text\", \"description\": \"Extracts the text contents of a specific element from a given HTML string.\", \"parameters\": {\"element\": {\"description\": \"A string representing the element tag to extract.\", \"type\": \"string\"}, \"html\": {\"description\": \"A string containing the HTML code.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The text contents of the specified element, or a message indicating that the element was not found.\", \"type\": \"string\"}}}, {\"name\": \"calculate_azimuth_zenith\", \"description\": \"Calculates the azimuth and zenith angles of a vector in a Cartesian coordinate system.\", \"parameters\": {\"vector\": {\"description\": \"The vector expressed as a NumPy array.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing the azimuth and zenith angles.\", \"type\": \"object\"}}}, {\"name\": \"format_javadoc_comment\", \"description\": \"Formats a string with javadoc style comment formatting.\", \"parameters\": {\"text\": {\"description\": \"The input string to format.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The formatted string.\", \"type\": \"object\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"extract_exclamation_marks\", \"description\": \"Extracts all exclamation marks (!) from a given string and returns the count.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The count of exclamation marks in the string.\", \"type\": \"integer\"}}}, {\"name\": \"first_words\", \"description\": \"Returns a list of strings that contain only the first word of each string.\", \"parameters\": {\"strings\": {\"description\": \"A list of strings.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of strings that contain only the first word of each string.\", \"type\": \"array\"}}}, {\"name\": \"convert_dict_keys_to_camel_case\", \"description\": \"Converts the keys of a dictionary to camel case.\", \"parameters\": {\"input_dict\": {\"additionalProperties\": {}, \"description\": \"The dictionary to be transformed.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new dictionary with the transformed keys and the same values as the input dictionary.\", \"type\": \"object\"}}}, {\"name\": \"delete_empty_keys\", \"description\": \"Deletes the keys with empty values from a dictionary.\", \"parameters\": {\"d\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"The input dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new dictionary with all the keys that have an empty value removed.\", \"type\": \"object\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"search_nested_dict\", \"description\": \"Searches for a key in a nested dictionary structure.\", \"parameters\": {\"dictionary\": {\"additionalProperties\": {}, \"description\": \"The nested dictionary to search in.\", \"type\": \"object\"}, \"key\": {\"description\": \"The key to search for.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing the key and its corresponding value if found, otherwise None.\", \"type\": \"array\"}}}, {\"name\": \"add_leading_zeros\", \"description\": \"Adds two leading zeros to the input string if its length is less than 2.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": [\"integer\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The input string with two leading zeros if its length is less than 2,\\n otherwise the original input string.\", \"type\": \"string\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"sort_tuples_by_second_value\", \"description\": \"Sorts a list of tuples by the second value in descending order.\\n\\nThe returned sorted list contains tuples of number pairs, and the function uses the first value of each pair as the sorting key. If two tuples have the same first values, the function uses the second value as the tie-breaker.\", \"parameters\": {\"tuples\": {\"description\": \"A list of tuples to be sorted.\", \"items\": {\"prefixItems\": [{\"type\": \"integer\"}, {\"type\": \"integer\"}], \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A sorted list of tuples.\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"choose_best_color\", \"description\": \"Chooses the best color based on the given colors and preferences.\\nThe best color is the one with the highest value that is preferred by the user.\\nIf there are multiple colors with the maximum value, the function chooses the one with the longest name.\\nIf there are still multiple colors, the function chooses the one that comes first alphabetically.\", \"parameters\": {\"colors\": {\"additionalProperties\": {\"type\": \"integer\"}, \"description\": \"A dictionary of colors and their associated values.\", \"type\": \"object\"}, \"preferences\": {\"description\": \"A list of preferred colors.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The best color.\", \"type\": \"string\"}}}, {\"name\": \"math_sqrt\", \"description\": \"Calculates the square root of a number `x` using the `math.sqrt` function.\", \"parameters\": {\"x\": {\"description\": \"The number to calculate the square root of.\", \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}]","gold_answer":"10.0"} +{"sample_id":"07341e6a-f838-45df-b83e-1ed142ffa487","input":"Two trains of equal length, running with the speeds of 60 and 40 kmph, take 75 seconds to cross each other while they are running in the same direction. What time will they take to cross each other if they are running in opposite directions?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 40}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 2778, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 75}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 40}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 2778, \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"inverse\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_6.result$\"}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}]","gold_answer":"15.0"} +{"sample_id":"d156dd17-ea2e-45f8-bdae-e4f3a47015ed","input":"If the population of a certain country increases at the rate of one person every 15 seconds, by how many persons does the population increase in 10 minutes?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 15}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 10}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}]","gold_answer":"40.0"} +{"sample_id":"406d0c79-b87a-4a04-885d-81ac834107e9","input":"John makes $50 a week from his job. He earns a raise and now makes $60 a week. What is the % increase?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 60, \"arg_1\": 50}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 50}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"20.0"} +{"sample_id":"a6e63d71-6a62-42d0-9084-741d3ab474ad","input":"8 men can dig a pit in 20 days. If a man works half as much again a s a boy, then 4 men and 9 boys can dig a similar pit in:","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 8, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 20}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 4, \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"add\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 9}}, {\"name\": \"divide\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_6.result$\"}}]","tools":"[{\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}]","gold_answer":"16.0"} +{"sample_id":"b0bc0070-cb02-4d46-9cee-cb74c5cb4c91","input":"Given a list of integers [1, 2, 3, 4, 5] and another list of integers [5, 4, 3, 2, 1], calculate the element-wise division of the first list by the second list. Then, find the maximum length of a substring of the resulting list that consists of only the same integer.","output":"[{\"name\": \"elementwise_division\", \"arguments\": {\"list_a\": [1, 2, 3, 4, 5], \"list_b\": [5, 4, 3, 2, 1]}, \"label\": \"$var1\"}, {\"name\": \"max_len_substring_same_char\", \"arguments\": {\"s\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"check_object_type\", \"description\": \"Checks if a given object is a string, list, tuple, or dictionary.\\nIf it is any of these types, returns the object's length.\\nIf it is none of these types, returns `None`.\", \"parameters\": {\"obj\": {\"description\": \"The object to check.\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"find_avg_even\", \"description\": \"Computes the average of all the even numbers from an input array of positive integers.\", \"parameters\": {\"array\": {\"description\": \"The input array of positive integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The average of all the even numbers in the array.\", \"type\": \"number\"}}}, {\"name\": \"elementwise_division\", \"description\": \"Calculates the element-wise division of two lists of integers.\", \"parameters\": {\"list_a\": {\"description\": \"The first list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"list_b\": {\"description\": \"The second list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the element-wise division of the first list by the second list.\", \"type\": \"array\"}}}, {\"name\": \"check_event\", \"description\": \"Checks if the dictionary has the following 3 keys: \\\"type\\\", \\\"payload\\\", and \\\"user\\\".\\nIf it does not, raise an exception with the message \\\"Invalid event: missing type, payload, or user\\\".\", \"parameters\": {\"event\": {\"additionalProperties\": {\"type\": \"object\"}, \"description\": \"The dictionary to check.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"elementwise_product_with_broadcasting\", \"description\": \"Calculates the element-wise product of two tensors, allowing for broadcasting to take place.\\nThe returned tensor is always of the same shape as the first input tensor.\", \"parameters\": {\"t0\": {\"description\": \"The first tensor.\", \"type\": \"object\"}, \"t1\": {\"description\": \"The second tensor.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"parse_json_str\", \"description\": \"Parses a JSON string and returns the corresponding Python data structure.\", \"parameters\": {\"json_str\": {\"description\": \"The JSON string to parse.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"contains_only_alphabetic\", \"description\": \"Checks if a given string contains only alphabetic characters using regular expressions.\", \"parameters\": {\"string\": {\"description\": \"The string to check.\", \"type\": [\"object\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"boolean\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"compute_mean_variance_stddev\", \"description\": \"Computes the mean, variance, and standard deviation of a given list of numbers.\", \"parameters\": {\"data\": {\"description\": \"A list or numpy array of numbers.\", \"type\": [\"array\", \"object\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing the mean, variance, and standard deviation of the input data.\", \"type\": \"array\"}}}, {\"name\": \"compute_learning_rate\", \"description\": \"Computes a learning rate given a normalized value x.\", \"parameters\": {\"x\": {\"description\": \"A normalized value.\", \"nullable\": true, \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The learning rate.\", \"type\": \"number\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"get_weekday_from_date\", \"description\": \"Returns the weekday as an integer (0 for Monday, 1 for Tuesday, ..., 6 for Sunday) for a given date string in the format of \\\"%Y-%m-%d\\\".\\nIf the input date is not in the correct format, the function raises a ValueError.\", \"parameters\": {\"date_str\": {\"description\": \"The date string in the format of \\\"%Y-%m-%d\\\".\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": [\"integer\", \"object\"]}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"max_len_substring_same_char\", \"description\": \"Calculates the maximum length of a substring of `s` that consists of only the same character.\", \"parameters\": {\"s\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The maximum length of a substring of `s` that consists of only the same character.\", \"type\": \"integer\"}}}, {\"name\": \"normalize_point\", \"description\": \"Transforms two integer coordinates (x, y) to a unit vector (x', y') on the unit circle.\", \"parameters\": {\"x\": {\"description\": \"The x-coordinate of the point.\", \"type\": \"integer\"}, \"y\": {\"description\": \"The y-coordinate of the point.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"read_file_numbers\", \"description\": \"Reads a file containing numbers and returns a list of unique numbers.\", \"parameters\": {\"file_path\": {\"description\": \"The path to the file containing numbers.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}]","gold_answer":"1"} +{"sample_id":"31fda7c2-7b09-4f52-b439-86205698858a","input":"A person travels from P to Q a speed of 60 km\/hr and returns by increasing his speed by 20%. What is his average speed for both the trips?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 20, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 60, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 60}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 2}}]","tools":"[{\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}]","gold_answer":"66.0"} +{"sample_id":"d4c761eb-50a5-40eb-802f-c27c23600ecb","input":"The percentage profit earned by selling an article for Rs. 1920 is equal to the percentage loss incurred by selling the same article for Rs. 1280. At what price should the article be sold to make 25% profit?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 25}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 1920, \"arg_1\": 1280}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"2000.0"} +{"sample_id":"ffc20e46-5975-4bc7-b0d5-23f712931223","input":"A starts business with Rs. 3500 and after 5 months, B joins with A as his partner. After a year, the profit is divided in the ratio 2 : 3. What is B's contribution in the capital?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3500, \"arg_1\": 12}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 3}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 12, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}]","gold_answer":"9000.0"} +{"sample_id":"45b5167f-c781-402e-a8b4-313578d97b76","input":"Carina has 130 ounces of coffee divided into 5- and 10-ounce packages. If she has 2 more 5-ounce packages than 10-ounce packages, how many 10-ounce packages does she have?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 2}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 130, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 10, \"arg_1\": 5}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}]","gold_answer":"8.0"} +{"sample_id":"5f434520-5eb5-48f1-a5ba-e4b51c400976","input":"I want to extract all the digits from the string 'hello123 world456', then replace all non-printable characters with a single space and multiple spaces, tabs, and newlines with a single space.","output":"[{\"name\": \"extract_digits_from_string\", \"arguments\": {\"input_string\": \"hello123 world456\"}, \"label\": \"$var1\"}, {\"name\": \"replace_non_printable_characters\", \"arguments\": {\"text\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"perspective_projection\", \"description\": \"Performs perspective projection of a 3D point (x, y, z) using a camera matrix (K) and returns its 2D projection (x', y') in the image plane.\", \"parameters\": {\"K\": {\"description\": \"A numpy array representing the camera matrix.\", \"type\": \"object\"}, \"point\": {\"description\": \"A numpy array representing a 3D point (x, y, z).\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A numpy array representing the projected 2D point (x', y') in the image plane.\", \"type\": \"object\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"result\", \"description\": \"Returns a string that is a permutation of the input string `s` with the following properties:\\n1. All characters in the result must come from `s`.\\n2. The result must have all possible permutations of the characters in `s` sorted in lexicographic order.\\n3. The result must have the lowest possible length.\\n4. The result must start with the first character of `s`.\", \"parameters\": {\"s\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The result string.\", \"type\": \"string\"}}}, {\"name\": \"replace_non_printable_characters\", \"description\": \"Replaces all non-printable characters with a single space and multiple spaces, tabs, and newlines with a single space.\", \"parameters\": {\"text\": {\"description\": \"The input text.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The modified text.\", \"type\": \"string\"}}}, {\"name\": \"four_axis_mean\", \"description\": \"Calculates the mean of a four-dimensional input array along the first two axes.\", \"parameters\": {\"input_array\": {\"description\": \"The input array to calculate the mean of.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"create_cyclic_graph\", \"description\": \"Creates a cyclic graph data structure from a nested list of integers.\", \"parameters\": {\"integers\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The root node of the graph.\", \"type\": \"object\"}}}, {\"name\": \"join_paths\", \"description\": \"Concatenates two file paths using the Path type from the pathlib module.\", \"parameters\": {\"path1\": {\"description\": \"The first file path.\", \"nullable\": true, \"type\": \"object\"}, \"path2\": {\"description\": \"The second file path.\", \"nullable\": true, \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"extract_digits_from_string\", \"description\": \"Extracts all the digits from a given string.\", \"parameters\": {\"input_string\": {\"description\": \"The input string to extract digits from.\", \"type\": [\"object\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The extracted digits as a string.\", \"type\": \"string\"}}}, {\"name\": \"get_shape_str\", \"description\": \"Returns a string of the form \\\"width x height\\\" for an object with width and height attributes.\", \"parameters\": {\"obj\": {\"description\": \"The object with width and height attributes.\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"check_pipeline_io_types\", \"description\": \"Checks if the pipeline input and output types match the expected types defined in pipeline.\", \"parameters\": {\"pipeline\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"A dictionary that defines the input and output types of a pipeline.\", \"type\": \"object\"}, \"pipeline_io_types\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"A dictionary that defines the expected input and output types of a pipeline.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the pipeline input and output types match the expected types, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"create_combined_dict\", \"description\": \"Creates a new dictionary that contains all the keys and values from both `dict1` and `dict2`.\\nIf a key appears in both dictionaries, the value from `dict2` is used.\", \"parameters\": {\"dict1\": {\"description\": \"The first dictionary.\", \"type\": \"object\"}, \"dict2\": {\"description\": \"The second dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new dictionary that contains all the keys and values from both `dict1` and `dict2`.\", \"type\": \"object\"}}}, {\"name\": \"common_values\", \"description\": \"Finds the common values between two dictionaries.\", \"parameters\": {\"dict1\": {\"additionalProperties\": {\"type\": \"object\"}, \"description\": \"The first dictionary.\", \"type\": \"object\"}, \"dict2\": {\"additionalProperties\": {\"type\": \"object\"}, \"description\": \"The second dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of values from the first dictionary whose keys are also present in the second dictionary.\", \"type\": \"array\"}}}]","gold_answer":"123456"} +{"sample_id":"4c733cb3-3e30-46f4-9570-225aabee657f","input":"3 pumps, working 8 hours a day, can empty a tank in 2 days. How many hours a day must 10 pumps work to empty the tank in 1 day?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 8}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 10}}]","tools":"[{\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"4.8"} +{"sample_id":"1b41306e-1f29-4d59-99e5-f72b47afb112","input":"A broker invested her own money in the stock market. During the first year, she increased her stock market wealth by 40 percent. In the second year, largely as a result of a slump in the stock market, she suffered a 30 percent decrease in the value of her stock investments. What was the net increase or decrease on her overall stock investment wealth by the end of the second year?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 40, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 30, \"arg_1\": 100}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}]","gold_answer":"-2.0"} +{"sample_id":"dcd68513-2c4f-4b12-9e4b-ce6266dccf8d","input":"The membership of a committee consists of 3 English teachers, 4 Mathematics teachers, and 2 Social Studies teachers. If 2 committee members are to be selected at random to write the committee\u2019s report, what is the probability that the two members selected will both be social teachers?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 4}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 3, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 4}}, {\"name\": \"add\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 2}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": 2, \"arg_1\": \"$var_6.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_7.result$\"}}]","tools":"[{\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"0.08333333333333333"} +{"sample_id":"f28ffb2e-0c89-4b9b-88dd-88d6e3db3b05","input":"A batsman scores 26 runs and increases his average from 14 to 15. Find the runs to be made if he wants top increasing the average to 19 in the same match ?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 26, \"arg_1\": 15}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 19, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 26, \"arg_1\": 15}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": 14, \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_5.result$\"}}]","tools":"[{\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}]","gold_answer":"74.0"} +{"sample_id":"8f47c4b6-3257-4fdf-a9aa-e327631aa564","input":"Given a list of numbers [1.1, 2.2, 3.3, 4.4], convert them to integers and count the total number of elements.","output":"[{\"name\": \"to_integer_list\", \"arguments\": {\"float_list\": [1.1, 2.2, 3.3, 4.4]}, \"label\": \"$var1\"}, {\"name\": \"count_elements_in_object\", \"arguments\": {\"obj\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"convert_voltage_to_dbm\", \"description\": \"Converts a signal from voltage to dBm using the formula $P_{dBm} = 10 \\\\cdot \\\\log_{10}(P_{dBm})$.\", \"parameters\": {\"voltage\": {\"description\": \"The input signal in either dBm or voltage.\", \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"error_propagation\", \"description\": \"Computes the standard deviation of a function given the partial derivatives and standard deviations of its variables.\", \"parameters\": {\"partial_x\": {\"description\": \"The partial derivative of the function with respect to x.\", \"type\": \"number\"}, \"partial_y\": {\"description\": \"The partial derivative of the function with respect to y.\", \"type\": \"number\"}, \"sigma_x\": {\"description\": \"The standard deviation of x.\", \"type\": \"number\"}, \"sigma_y\": {\"description\": \"The standard deviation of y.\", \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"count_elements_in_object\", \"description\": \"Counts the total number of elements in an object that supports the `__getitem__` and `__len__` protocols.\", \"parameters\": {\"obj\": {\"description\": \"The object to count the elements in.\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"to_integer_list\", \"description\": \"Converts a list of numbers in float format to an equivalent list of integers.\", \"parameters\": {\"float_list\": {\"description\": \"A list of numbers in float format.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"avg\", \"description\": \"Calculates the arithmetic mean of a given list of numbers. If the list is empty, return 0.\", \"parameters\": {\"numbers\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"get_sum_of_foo\", \"description\": \"Calculates the sum of the `foo` attribute of all objects in a list.\", \"parameters\": {\"obj_list\": {\"description\": \"A list of objects, where each object is a dictionary with a `foo` attribute.\", \"items\": {\"additionalProperties\": {\"type\": \"integer\"}, \"type\": \"object\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The sum of the `foo` attribute of all objects in the list.\", \"type\": \"integer\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"add_space_to_str_lines\", \"description\": \"Adds a space to each line of the input string while preserving the original indentation.\", \"parameters\": {\"text\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The modified string with a space added to each line.\", \"type\": \"string\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}]","gold_answer":"4"} +{"sample_id":"000b6bed-2a29-4199-a359-0e107922a1ff","input":"Sandy bought 65 books for $1180 from one shop and 55 books for $860 from another shop. What is the average price that Sandy paid per book?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 1180, \"arg_1\": 860}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 65, \"arg_1\": 55}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"17.0"} +{"sample_id":"5bbe0356-c4f3-40f1-ba56-bbf37156213a","input":"Given a list of integers [1, 2, 3, 4, 5], calculate the sum of the squares of the even numbers. Then, count the occurrences of each distinct integer in the list. Finally, calculate the factorial of the sum of the squares of the even numbers using bitwise operators and recursion.","output":"[{\"name\": \"get_sum_of_squares_of_evens\", \"arguments\": {\"nums\": [1, 2, 3, 4, 5]}, \"label\": \"$var1\"}, {\"name\": \"count_distinct_integers\", \"arguments\": {\"nums\": [1, 2, 3, 4, 5]}, \"label\": \"$var2\"}, {\"name\": \"factorial_bitwise\", \"arguments\": {\"n\": \"$var1.output_0$\"}, \"label\": \"$var3\"}]","tools":"[{\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"round_float_to_even\", \"description\": \"Rounds a float number to the nearest integer. If the decimal part is exactly 0.5,\\nround up to the closest even integer.\", \"parameters\": {\"num\": {\"description\": \"The float number to be rounded.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"min_with_default\", \"description\": \"Returns the smaller of two integer values. If the two values are equal,\\nreturns the smaller of the two values by default. However, the function\\nalso supports accepting an optional `default` parameter to override the\\ndefault behavior and return the default value when the two values are equal.\", \"parameters\": {\"a\": {\"description\": \"The first integer value.\", \"type\": \"integer\"}, \"b\": {\"description\": \"The second integer value.\", \"type\": \"integer\"}, \"default\": {\"description\": \"The default value to return when the two values are equal. If not provided, the function will return the smaller of the two values by default.\", \"nullable\": true, \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"get_sum_of_squares_of_evens\", \"description\": \"Calculates the sum of the squares of the even numbers in a list of integers.\", \"parameters\": {\"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"check_positive_and_unique\", \"description\": \"Checks if a given list contains only positive integers and no duplicates.\", \"parameters\": {\"lst\": {\"description\": \"The list to be checked.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the list meets the criteria, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"format_float_number\", \"description\": \"Converts a float number represented as a string into a string representation\\nwith the specified characteristics.\", \"parameters\": {\"float_number_str\": {\"description\": \"The float number represented as a string.\", \"type\": [\"number\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The formatted string representation of the float number.\", \"type\": \"string\"}}}, {\"name\": \"convert_decimal_to_hex\", \"description\": \"Converts a decimal number into a hexadecimal string.\", \"parameters\": {\"decimal_number\": {\"description\": \"The decimal number to be converted.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The hexadecimal string representation of the input number.\", \"type\": \"string\"}}}, {\"name\": \"get_fetal_weight\", \"description\": \"Calculates the fetal weight based on the input dictionary.\", \"parameters\": {\"input_dict\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"A dictionary containing the gestational age, birth weight, and whether the patient had a Caesarian section.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The fetal weight as a float.\", \"type\": \"number\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"bit_not_inverse\", \"description\": \"Calculates the bitwise inverse of a positive integer `x`.\", \"parameters\": {\"x\": {\"description\": \"The positive integer to calculate the bitwise inverse of.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The bitwise inverse of `x`.\", \"type\": \"object\"}}}, {\"name\": \"get_day_of_week_phrase\", \"description\": \"Returns a phrase corresponding to the day of the week based on the input number.\", \"parameters\": {\"number\": {\"description\": \"An integer from 1 to 7 representing the day of the week.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"factorial_bitwise\", \"description\": \"Calculates the factorial of a given number using bitwise operators and recursion.\", \"parameters\": {\"n\": {\"description\": \"The number to calculate the factorial of.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The factorial of the given number.\", \"type\": \"integer\"}}}, {\"name\": \"compare_timestamps\", \"description\": \"Compares the value of two timestamps and returns a boolean value.\", \"parameters\": {\"timestamp1\": {\"description\": \"The first timestamp.\", \"type\": [\"object\", \"string\"]}, \"timestamp2\": {\"description\": \"The second timestamp.\", \"type\": [\"object\", \"string\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the value of the second timestamp is greater than the first, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"count_distinct_integers\", \"description\": \"Counts the occurrences of each distinct integer in a list.\", \"parameters\": {\"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary where the keys are the distinct integers in the list,\\n and the values are the number of occurrences of each key.\", \"type\": \"object\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}]","gold_answer":"2432902008176640000"} +{"sample_id":"e1c636cb-685c-4013-8f5b-0990dfaa23ee","input":"There are 240 doctors and nurses at a hospital. If the ratio of doctors to nurses is 3 to 7, how many nurses are at the hospital?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 7}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 240, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 7}}]","tools":"[{\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}]","gold_answer":"168.0"} +{"sample_id":"ce16cd43-3947-45b1-8dca-3946b69719e7","input":"A room is 7 meters 68 centimeters in length and 4 meters 32 centimeters in Width. Find the least number of square tiles of equal size required to cover the entire floor of the room.","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 68}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 32}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 68}}, {\"name\": \"multiply\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": \"$var_8.result$\", \"arg_1\": 32}}, {\"name\": \"gcd\", \"label\": \"$var_10\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": \"$var_9.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_11\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_12\", \"arguments\": {\"arg_0\": \"$var_11.result$\", \"arg_1\": 68}}, {\"name\": \"multiply\", \"label\": \"$var_13\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_14\", \"arguments\": {\"arg_0\": \"$var_13.result$\", \"arg_1\": 32}}, {\"name\": \"gcd\", \"label\": \"$var_15\", \"arguments\": {\"arg_0\": \"$var_12.result$\", \"arg_1\": \"$var_14.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_16\", \"arguments\": {\"arg_0\": \"$var_10.result$\", \"arg_1\": \"$var_15.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_17\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": \"$var_16.result$\"}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}]","gold_answer":"144.0"} +{"sample_id":"448ed990-a316-46e4-8ecf-dd91f1ffe955","input":"The average age of a class of 24 students is 23 years. The average increased by 1 when the teacher's age also included. What is the age of the teacher?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 24, \"arg_1\": 1}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 23, \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 24, \"arg_1\": 23}}, {\"name\": \"subtract\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"48.0"} +{"sample_id":"d2f60c36-a1dd-449c-820f-7ef26e8db0ce","input":"63 + 5 * 12 \/ (180\/3) = ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 5, \"arg_1\": 12}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 180, \"arg_1\": 3}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 63, \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"64.0"} +{"sample_id":"04bd68f8-3e77-4cda-b43f-c42616d95d33","input":"Students at a school were on average 180 cm tall. The average female height was 170 cm, and the average male height was 181 cms. What was the ratio of men to women?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 180, \"arg_1\": 170}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 181, \"arg_1\": 180}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}, {\"name\": \"power\", \"description\": \"Raise a number to a power\", \"parameters\": {\"arg_0\": {\"description\": \"The base number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The exponent number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the power result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"10.0"} +{"sample_id":"1d7544df-ed8c-43e9-abb0-f7bc6228e485","input":"If 1,000 microns = 1 decimeter, and 1,000,000,000 angstroms = 1 decimeter, how many angstroms equal 1 micron?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 100}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 100, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}]","gold_answer":"1.0"} +{"sample_id":"020f129c-336e-41a2-97a2-5f2dc6ddd3f4","input":"If 40% of a certain number is 160, then what is 90% of that number?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 40, \"arg_1\": 100}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 160, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 90, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"360.0"} +{"sample_id":"06da593d-833c-457a-a042-343e08425e0c","input":"If 36 men can do a piece of work in 25 hours, in how mwny hours will15 men do it?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 36, \"arg_1\": 25}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 15}}]","tools":"[{\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}]","gold_answer":"60.0"} +{"sample_id":"2d8f19d8-ad3c-4616-87f7-32ea3d1a42f2","input":"Given a fraction 3\/4, simplify it and then combine each character of the simplified fraction with the string 'hello'.","output":"[{\"name\": \"get_simplified_fraction\", \"arguments\": {\"numerator\": 3, \"denominator\": 4}, \"label\": \"$var1\"}, {\"name\": \"combine_characters\", \"arguments\": {\"a\": \"$var1.output_0$\", \"b\": \"hello\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"get_simplified_fraction\", \"description\": \"Simplifies a fraction and returns it as a string in the format \\\"numerator\/denominator\\\".\", \"parameters\": {\"denominator\": {\"description\": \"The denominator of the fraction.\", \"type\": \"integer\"}, \"numerator\": {\"description\": \"The numerator of the fraction.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The simplified fraction as a string in the format \\\"numerator\/denominator\\\".\", \"type\": \"string\"}}}, {\"name\": \"calculate_factorial\", \"description\": \"Calculates the factorial of a given number.\", \"parameters\": {\"number\": {\"description\": \"The number to calculate the factorial of.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"list_to_string_list\", \"description\": \"Converts a list of integers to a list of strings.\", \"parameters\": {\"lst\": {\"description\": \"The input list.\", \"items\": {}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of strings with each integer represented as a string.\\n If the input list is empty, the function returns an empty list.\\n The function handles any generic type and returns an optional value.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"format_with_leading_zeros\", \"description\": \"Formats a given integer into a string with a fixed width and leading zeros.\", \"parameters\": {\"integer\": {\"description\": \"The integer to format.\", \"type\": [\"integer\", \"number\"]}, \"width\": {\"description\": \"The desired width of the formatted string.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"combine_characters\", \"description\": \"Combines each character of two strings exactly once, inserting remaining characters at the end.\", \"parameters\": {\"a\": {\"description\": \"The first string.\", \"type\": \"string\"}, \"b\": {\"description\": \"The second string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new string that combines each character of the input strings exactly once.\", \"type\": \"string\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"get_ordinal_number\", \"description\": \"Generates ordinal numbers as strings.\", \"parameters\": {\"num\": {\"description\": \"A positive integer between 1 and 100.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"The ordinal number of the input as a string, or None if the input is invalid.\", \"type\": \"string\"}}}, {\"name\": \"read_int64\", \"description\": \"Reads a 64-bit signed integer from a binary file with a given endianness.\", \"parameters\": {\"endianness\": {\"description\": \"The endianness of the binary file, either \\\"little\\\" or \\\"big\\\".\", \"type\": \"string\"}, \"filename\": {\"description\": \"The name of the binary file.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The 64-bit signed integer read from the binary file.\", \"type\": \"integer\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}]","gold_answer":"3h\/e4llo"} +{"sample_id":"e2d15e8e-2f65-4928-aa14-85edc07ff784","input":"in a certain game , a large container is filled with red , yellow , green , and blue beads worth , respectively , 7 , 5 , 3 , and 2 points each . a number of beads are then removed from the container . if the product of the point values of the removed beads is 30 , 870000 , how many red beads were removed ?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 1}}]","tools":"[{\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"3.0"} +{"sample_id":"f39b094a-54f6-4915-8ede-44b3515fcceb","input":"A is two years older than B who is twice as old as C. If the total of the ages of A, B and C be 37, the how old is B?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 37, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}]","gold_answer":"14.0"} +{"sample_id":"3f8be461-f9fe-46b6-91b7-69d977c2dab5","input":"In a manufacturing plant, it takes 36 machines 4 hours of continuous work to fill 6 standard orders. At this rate, how many hours of continuous work by 72 machines are required to fill 12 standard orders?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 36, \"arg_1\": 12}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 4}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 72}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 6}}]","tools":"[{\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"4.0"} +{"sample_id":"6d15e4f0-bd08-46af-890f-a0d654e9e59e","input":"Generate the first 5 terms of the \\\"power of two\\\" sequence. Then, calculate the product of all numbers in the sequence, excluding the number at each index.","output":"[{\"name\": \"generate_power_of_two_list\", \"arguments\": {\"n\": 5}, \"label\": \"$var1\"}, {\"name\": \"exclude_product\", \"arguments\": {\"numbers\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"generate_power_of_two_list\", \"description\": \"Generates the first `n` terms of the \\\"power of two\\\" sequence.\\n\\nThe sequence is defined as follows: the first term is 1, the second term is 2,\\nthe third term is 4, and so on.\", \"parameters\": {\"n\": {\"description\": \"A non-negative integer.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the first `n` terms of the \\\"power of two\\\" sequence.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"insert_file_into_database\", \"description\": \"Inserts the content of a file into a SQLite database.\", \"parameters\": {\"conn\": {\"description\": \"The SQLite database connection.\", \"type\": \"object\"}, \"file_path\": {\"description\": \"The path to the file to be inserted.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The number of rows inserted into the database.\", \"type\": \"integer\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"generate_sql_insert_query\", \"description\": \"Constructs a SQL query that does an `INSERT` into a table named `my_table` with the given records.\\nIf the column names are not provided explicitly, they should be derived from the first dictionary in the list.\", \"parameters\": {\"records\": {\"description\": \"A list of dictionaries representing database records.\", \"items\": {\"additionalProperties\": {\"type\": \"string\"}, \"type\": \"object\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"count_non_zeros\", \"description\": \"Counts the number of non-zero integers in a list.\", \"parameters\": {\"nums\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The number of non-zero integers in the list.\", \"type\": \"integer\"}}}, {\"name\": \"exclude_product\", \"description\": \"Calculates the product of all numbers in a list, excluding the number at each index.\", \"parameters\": {\"numbers\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new list where each element is the product of all numbers in the original list except the one at that index.\", \"type\": \"array\"}}}, {\"name\": \"sort_and_print_dictionary\", \"description\": \"Sorts the keys of a dictionary and returns a string with the key-value pairs.\", \"parameters\": {\"dictionary\": {\"additionalProperties\": {\"type\": \"integer\"}, \"description\": \"The dictionary to sort and print.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string with the key-value pairs in sorted order.\", \"type\": \"string\"}}}, {\"name\": \"filter_employees\", \"description\": \"Filters the employees based on the given rules.\", \"parameters\": {\"employees\": {\"description\": \"a list of dictionaries representing employees.\", \"items\": {\"type\": \"object\"}, \"type\": \"array\"}, \"gender\": {\"description\": \"a string representing the desired gender ('male' or 'female').\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"a list of dictionaries containing only the filtered employees.\", \"type\": \"array\"}}}, {\"name\": \"list_average\", \"description\": \"Calculates the average of a list of numbers.\", \"parameters\": {\"numbers\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The average of the numbers.\", \"type\": \"number\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"capitalize_first_letter_of_each_word\", \"description\": \"Capitalizes the first letter of each word in a string.\", \"parameters\": {\"s\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"get_cookie_value\", \"description\": \"Parses request headers to extract a specific cookie value by its name.\", \"parameters\": {\"cookie_name\": {\"description\": \"The name of the cookie to extract the value for.\", \"type\": \"string\"}, \"headers\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"A dictionary with keys representing header names and values representing their corresponding values.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The value of the cookie if found, otherwise `None`.\", \"type\": \"string\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"get_strings_containing_char\", \"description\": \"Returns a new list with only the strings that contain a specific character.\", \"parameters\": {\"my_char\": {\"description\": \"The character to search for.\", \"type\": \"string\"}, \"my_strings\": {\"description\": \"A list of strings.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}]","gold_answer":"[1024, 512, 256, 128, 64]"} +{"sample_id":"82d9ce55-dd6f-42a3-ab17-a19011863dce","input":"A 6 litre sol is 20% alcohol .How many litres of pure alcohol must be added to produce a sol that is 50% alcohol ?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 20, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 6}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 2, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 6, \"arg_1\": \"$var_3.result$\"}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}]","gold_answer":"3.6"} +{"sample_id":"a845fa23-f94d-436b-b550-86cb6f3da886","input":"Out of 400 students of a school, 325 play football, 175 play cricket and 50 neither play football nor cricket. How many students play both football and cricket ?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 175, \"arg_1\": 325}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 400, \"arg_1\": 50}}, {\"name\": \"subtract\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}]","gold_answer":"150.0"} +{"sample_id":"fa57c28a-e9d8-44fb-a358-a9404a557d5b","input":"Get the text content of the URL 'https:\/\/www.example.com', then count the occurrence of the word 'the' in the text content.","output":"[{\"name\": \"get_url_content\", \"arguments\": {\"url\": \"https:\/\/www.example.com\"}, \"label\": \"$var1\"}, {\"name\": \"count_the_word\", \"arguments\": {\"string\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"count_the_word\", \"description\": \"Counts the occurrence of the word \\\"the\\\" in a given string.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of integers. The first integer is the index of the word \\\"the\\\" in the string.\\n The second integer is the number of times the word \\\"the\\\" occurs. The third integer\\n is the number of times the word \\\"the\\\" repeats itself in the string.\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"get_maximum_score\", \"description\": \"Calculates the maximum score from a JSON file representing a game's scores.\", \"parameters\": {\"json_file_path\": {\"description\": \"The path to the JSON file.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"rearrange_date_string\", \"description\": \"Rearranges a date string into the format \\\"yyyy\/mm\/dd\\\".\", \"parameters\": {\"date_string\": {\"description\": \"A string representing a date in the format \\\"yyyy\/mm\/dd\\\".\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string representing the date in the format \\\"yyyy\/mm\/dd\\\", or None if the input string is not a valid date.\", \"type\": \"string\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"generate_iterative_dictionary\", \"description\": \"Generates a dictionary with `length` number of keys and their corresponding values.\\nThe values for each key are a concatenation of the key and its numeric value.\", \"parameters\": {\"length\": {\"description\": \"The number of keys to generate in the dictionary.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary with the generated keys and their corresponding values.\", \"type\": \"object\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"extract_license_type\", \"description\": \"Extracts the license type from a given license text string using regular expressions.\", \"parameters\": {\"license_text\": {\"description\": \"The license text string to parse.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string containing the license type (for example, \\\"GPLv3\\\") if found,\\n otherwise an empty string.\", \"type\": \"string\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"parse_chemical_formula\", \"description\": \"Parses a string of a chemical formula and returns a tuple of the parsed charge and multiplicity.\", \"parameters\": {\"formula\": {\"description\": \"The string of the chemical formula following the format of `name(m, c)`, where `name` is the name of the chemical, `m` is the multiplicity, and `c` is the charge.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple of the multiplicity and charge.\", \"type\": \"array\"}}}, {\"name\": \"find_max_word_frequency\", \"description\": \"Finds the word with the highest frequency in a dictionary.\\nIf two or more words have the same frequency, returns the word that comes first alphabetically.\\nIf the frequency is zero, returns an empty string.\", \"parameters\": {\"word_frequency_map\": {\"additionalProperties\": {\"type\": \"integer\"}, \"description\": \"A dictionary where keys are words and values are their frequencies.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"generate_drs_uri\", \"description\": \"Generates a DRS URI for accessing an object on the DRS server.\", \"parameters\": {\"obj_id\": {\"description\": \"The object ID.\", \"nullable\": true, \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"extract_unique_words\", \"description\": \"Extracts unique words from a sentence and outputs them in a human-readable format.\\n\\nIf an empty string is passed to the function, it returns a string containing only the message \\\"No words found.\\\".\", \"parameters\": {\"sentence\": {\"description\": \"The input sentence.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string containing the unique words from the input sentence, separated by commas and spaces.\", \"type\": \"string\"}}}, {\"name\": \"merge_two_dicts\", \"description\": \"Merges two Python dictionaries recursively.\", \"parameters\": {\"dict1\": {\"description\": \"The first dictionary to merge.\", \"type\": \"object\"}, \"dict2\": {\"description\": \"The second dictionary to merge.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new dictionary that contains the combined contents of `dict1` and `dict2`.\", \"type\": \"object\"}}}, {\"name\": \"check_duplicates\", \"description\": \"Checks if two lists have the same elements without duplicates.\", \"parameters\": {\"list_one\": {\"description\": \"The first list.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"list_two\": {\"description\": \"The second list.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A boolean value indicating whether the two lists have the same elements without duplicates.\", \"type\": \"boolean\"}}}, {\"name\": \"kilometers_to_miles\", \"description\": \"Converts a distance from kilometers to miles.\", \"parameters\": {\"kilometers\": {\"description\": \"The distance in kilometers.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"get_url_content\", \"description\": \"Gets the text content of a URL's page.\", \"parameters\": {\"url\": {\"description\": \"The URL to get the text content from.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The text content of the URL's page.\", \"type\": \"string\"}}}]","gold_answer":"[-1, 0, 0]"} +{"sample_id":"602de5a8-0653-4427-bcc5-3fe582cd714e","input":"A soccer team played 160 games and won 65 percent of them. How many games did it win?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 65, \"arg_1\": 160}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"square_edge_by_area\", \"description\": \"Calculate the edge length of a square given its area\", \"parameters\": {\"arg_0\": {\"description\": \"Area of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}]","gold_answer":"104.0"} +{"sample_id":"6e46d58b-4319-430e-b6ca-72689e56a189","input":"The length of rectangle is thrice its breadth and its perimeter is 72 m, find the area of the rectangle?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 1, \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 72, \"arg_1\": \"$var_3.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 3}}, {\"name\": \"multiply\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 3, \"arg_1\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": 1, \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": \"$var_7.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": 72, \"arg_1\": \"$var_8.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_10\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": \"$var_9.result$\"}}]","tools":"[{\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"243.0"} +{"sample_id":"350b17ae-24ee-44bf-ba33-0fe539967c38","input":"The ratio of spinsters to cats is 2 to 7. If there are 40 more cats than spinsters, how many spinsters are there?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 40, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 2}}]","tools":"[{\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"negate_prob\", \"description\": \"Calculate the probability of an event not occurring\", \"parameters\": {\"arg_0\": {\"description\": \"Probability of the event occurring\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Probability of the event not occurring\", \"type\": \"float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"cube_edge_by_volume\", \"description\": \"Calculate the edge length of a cube given its volume\", \"parameters\": {\"arg_0\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the cube\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}]","gold_answer":"16.0"} +{"sample_id":"f2b677d4-4070-4676-a766-1a40f43bedeb","input":"One ball will drop from a certain height. The height it will reach after rebounding from the floor is 50 percent of the previous height. The total travel is 150cm when it touches the floor on third time. What is the value of the original height?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 50, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 2, \"arg_1\": \"$var_1.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 150, \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}]","gold_answer":"60.0"} +{"sample_id":"0cea3214-8bbb-443a-943e-de9038f8b5f9","input":"Repeat the string 'hello' 3 times, then convert the resulting string to the opposite case.","output":"[{\"name\": \"repeat_str\", \"arguments\": {\"n\": 3, \"string\": \"hello\"}, \"label\": \"$var1\"}, {\"name\": \"convert_to_opposite_case\", \"arguments\": {\"text\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"x_and_y\", \"description\": \"Returns a string formatted with the values of x and y.\", \"parameters\": {\"x\": {\"description\": \"The value of x.\", \"type\": [\"integer\", \"number\"]}, \"y\": {\"description\": \"The value of y.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"str_format_named_params\", \"description\": \"Formats a string by replacing placeholders with their corresponding values from a dictionary.\", \"parameters\": {\"params\": {\"additionalProperties\": {\"type\": \"string\"}, \"description\": \"A dictionary of placeholder names and their corresponding values.\", \"type\": \"object\"}, \"string\": {\"description\": \"The string to format.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"find_max_indices\", \"description\": \"Finds the indices of the maximum value in every dimension of a 3D array.\", \"parameters\": {\"data\": {\"description\": \"A 3D array of size (M, N, O), where M is the number of y-coordinates, N is the number of x-coordinates, and O is the number of z-coordinates. The three dimensions correspond to the three coordinates.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple of indices of the maximum value in every dimension of `data`.\", \"type\": \"object\"}}}, {\"name\": \"convert_to_opposite_case\", \"description\": \"Converts a string to the opposite case.\", \"parameters\": {\"text\": {\"description\": \"The input string.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The input string with all lower-case characters replaced by their upper-case counterparts and vice-versa.\", \"type\": \"object\"}}}, {\"name\": \"repeat_str\", \"description\": \"Returns a new string with n copies of the original string.\", \"parameters\": {\"n\": {\"description\": \"The number of times to repeat the string.\", \"nullable\": true, \"type\": \"integer\"}, \"string\": {\"description\": \"The string to repeat.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"sort_unique_integers\", \"description\": \"Sorts a list of integers without duplicates.\", \"parameters\": {\"integers\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of unique integers in sorted order.\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"count_labels\", \"description\": \"Counts the number of overall labels, the number of positive labels, and the number of negative labels in the given set.\", \"parameters\": {\"labels\": {\"description\": \"A list of labels. The labels are either 0 or 1.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A tuple containing the total number of labels, the number of positive labels, and the number of negative labels.\", \"type\": \"object\"}}}, {\"name\": \"get_visited_ancestors\", \"description\": \"Returns a list of all ancestor dictionaries of the dictionaries with a `visited` key set to `True`.\", \"parameters\": {\"node\": {\"description\": \"A dictionary containing a key called `children` that holds a list of child dictionaries.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of ancestor dictionaries.\", \"type\": \"array\"}}}, {\"name\": \"url_encode\", \"description\": \"Encodes a string to the required format for sending as part of a URL query string.\", \"parameters\": {\"string\": {\"description\": \"The string to be encoded.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The encoded string.\", \"type\": \"string\"}}}]","gold_answer":"HELLOHELLOHELLO"} +{"sample_id":"b2930682-44d7-4323-8916-134e74ba31fb","input":"I have a list of numbers in float format [1.2, 2.3, 3.4, 4.5]. I want to convert this list to a list of integers. Then, I want to concatenate the values of this list to a string with a prefix 'Numbers: ' and a suffix '.'.","output":"[{\"name\": \"to_integer_list\", \"arguments\": {\"float_list\": [1.2, 2.3, 3.4, 4.5]}, \"label\": \"$var1\"}, {\"name\": \"concatenate_to_string\", \"arguments\": {\"input_list\": \"$var1.output_0$\", \"prefix\": \"Numbers: \", \"suffix\": \".\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"add_seconds\", \"description\": \"Adds a specified number of seconds to a given time string and returns the result.\", \"parameters\": {\"seconds_to_add\": {\"description\": \"The number of seconds to add.\", \"type\": [\"integer\", \"number\"]}, \"time_string\": {\"description\": \"The input time string in the format of \\\"HH:MM:SS\\\".\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"append_length\", \"description\": \"Appends the length of each string in a comma-separated list to the end of the string.\", \"parameters\": {\"input_string\": {\"description\": \"A comma-separated list of strings.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A new comma-separated list of strings with the length of each string appended to the end of the string.\", \"type\": \"string\"}}}, {\"name\": \"combine_masks\", \"description\": \"Combines two masks into a single mask.\", \"parameters\": {\"mask1\": {\"description\": \"The first mask.\", \"type\": \"object\"}, \"mask2\": {\"description\": \"The second mask.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The combined mask.\", \"type\": \"object\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"to_integer_list\", \"description\": \"Converts a list of numbers in float format to an equivalent list of integers.\", \"parameters\": {\"float_list\": {\"description\": \"A list of numbers in float format.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"get_substrings_with_positions\", \"description\": \"Returns a list of tuples containing substrings that are all letters and their positions in the given string.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of tuples containing substrings that are all letters and their positions in the given string.\", \"type\": \"array\"}}}, {\"name\": \"crop_data\", \"description\": \"Crops the data based on the provided crop values and returns the cropped data.\", \"parameters\": {\"crop\": {\"description\": \"A list of three 2-element tuples, where each tuple specifies the start and end coordinates for each dimension.\", \"items\": {\"prefixItems\": [{\"type\": \"integer\"}, {\"type\": \"integer\"}], \"type\": \"array\"}, \"type\": \"array\"}, \"data\": {\"description\": \"The 3D numpy array to be cropped.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"concatenate_to_string\", \"description\": \"Concatenates the values of a list to a string with a prefix and suffix.\", \"parameters\": {\"input_list\": {\"description\": \"The list of values to be concatenated.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"prefix\": {\"description\": \"The prefix string to be concatenated to the beginning of the output string.\", \"type\": \"string\"}, \"suffix\": {\"description\": \"The suffix string to be concatenated to the end of the output string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"format_version_number\", \"description\": \"Formats a version number string by splitting it into a list of strings representing each number,\\nthen iterating through the list to create a new list of strings where each string is a formatted number,\\nwith a comma separating each number. Finally, joins the new list of strings into a single string and returns it.\", \"parameters\": {\"version_number\": {\"description\": \"A version number string like '3.14.1592'.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"calculate_pixel_size\", \"description\": \"Calculates the pixel size in millimeters given the physical distance and focal length of a camera.\", \"parameters\": {\"distance_mm\": {\"description\": \"The physical distance in millimeters.\", \"type\": \"number\"}, \"focal_length_mm\": {\"description\": \"The focal length of the camera in millimeters.\", \"type\": \"number\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"number\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"is_balanced\", \"description\": \"Checks if a string of parentheses is balanced.\", \"parameters\": {\"s\": {\"description\": \"The string of parentheses to check.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the string is balanced, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"extract_non_unique\", \"description\": \"Extracts non-unique elements from a list of integers.\", \"parameters\": {\"lst\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of non-unique elements from the input list.\", \"type\": \"array\"}}}, {\"name\": \"is_valid_image\", \"description\": \"Checks whether a given file path points to a valid image file.\", \"parameters\": {\"file_path\": {\"description\": \"The path to the file to check.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the file is a valid PNG image, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"get_constant_value\", \"description\": \"Returns the constant value corresponding to the given string.\", \"parameters\": {\"string\": {\"description\": \"The string representing the constant name.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The constant value if the string is a recognized constant name, or `None` otherwise.\", \"type\": \"number\"}}}]","gold_answer":"Numbers: 1, 2, 3, 4."} +{"sample_id":"f4d8b4ba-bee6-4c42-8b31-105d711e4a7f","input":"I want to find the smallest element in the list [1, 2, 3, 4, 5]. Then, I want to find the closest integer root of that smallest element.","output":"[{\"name\": \"find_smallest\", \"arguments\": {\"numbers\": [1, 2, 3, 4, 5]}, \"label\": \"$var1\"}, {\"name\": \"find_closest_root\", \"arguments\": {\"n\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"count_digits_letters\", \"description\": \"Counts the number of digits and letters in a string.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary with the counts for digits and letters.\", \"type\": \"object\"}}}, {\"name\": \"find_smallest\", \"description\": \"Finds the smallest element in a list of integers.\", \"parameters\": {\"numbers\": {\"description\": \"A list of integers.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"count_trainable_parameters\", \"description\": \"Counts the number of trainable parameters in a PyTorch model.\", \"parameters\": {\"model\": {\"description\": \"The PyTorch model.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The number of trainable parameters in the model.\", \"type\": \"integer\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"filter_dict_by_ids\", \"description\": \"Filters a dictionary based on a list of item IDs.\", \"parameters\": {\"ids_to_filter\": {\"description\": \"The list of IDs to filter.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"original_dict\": {\"additionalProperties\": {\"type\": \"integer\"}, \"description\": \"The dictionary to filter.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary containing the filtered items.\", \"type\": \"object\"}}}, {\"name\": \"find_closest_root\", \"description\": \"Finds the closest integer root of a given integer.\", \"parameters\": {\"n\": {\"description\": \"The integer to find the closest root of.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The closest integer root of `n`.\", \"type\": [\"integer\", \"number\"]}}}, {\"name\": \"convert_time_to_uint32\", \"description\": \"Converts a time value in seconds to a big-endian 4-byte unsigned integer representation.\", \"parameters\": {\"time_in_seconds\": {\"description\": \"The time value in seconds as an integer.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The big-endian 4-byte unsigned integer representation of the time value.\", \"type\": \"integer\"}}}, {\"name\": \"check_valid_identifier\", \"description\": \"Checks if a given sequence of characters is a valid identifier in Python.\", \"parameters\": {\"sequence\": {\"description\": \"The sequence of characters to check.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the sequence is a valid identifier, False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"compare_matrices_with_mask\", \"description\": \"Compares the elements of two matrices element-wise using a boolean mask.\\n\\nThe comparison result is True if the corresponding entry in the mask is True and the corresponding elements in the two matrices are equal, and False otherwise.\", \"parameters\": {\"m1\": {\"description\": \"The first matrix to compare.\", \"type\": \"object\"}, \"m2\": {\"description\": \"The second matrix to compare.\", \"type\": \"object\"}, \"m_mask\": {\"description\": \"The boolean mask indicating which elements to compare.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A NumPy array with the same shape as the input matrices containing the comparison results.\", \"type\": \"object\"}}}, {\"name\": \"format_filesize\", \"description\": \"Formats a filesize into a human-readable string representation.\", \"parameters\": {\"filesize\": {\"description\": \"The filesize in bytes.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string in the format \\\"{filesize} {unit}\\\", where the unit is the appropriate unit for the filesize.\\n If the filesize is zero or negative, the output is \\\"0 B\\\".\", \"type\": \"string\"}}}, {\"name\": \"convert_to_c_style_identifier\", \"description\": \"Converts a string `name` from a Python-style identifier to a C-style identifier.\\n\\nIf the string does not start with an alphabetical character or underscore, prepend an underscore.\\nIf the string contains any uppercase characters, convert them to lowercase.\\nIf the string contains a hyphen, replace it with an underscore.\\nIf any other characters are encountered, ignore them.\", \"parameters\": {\"name\": {\"description\": \"The input string to be converted.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The converted string.\", \"type\": \"string\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"filter_non_empty\", \"description\": \"Filters a list of objects and returns a list of objects with only non-empty values.\", \"parameters\": {\"input_list\": {\"description\": \"A list of objects.\", \"items\": {}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"extract_sub_dict\", \"description\": \"Extracts a sub-dictionary from a given dictionary.\", \"parameters\": {\"keys\": {\"description\": \"A list of keys to extract.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"target_dict\": {\"description\": \"The target dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}]","gold_answer":"1"} +{"sample_id":"a44d9cb8-f686-46c1-bfed-b929b87defcb","input":"The ratio between the sale price and the cost price of an article is 7:4. What is the ratio between the profit and the cost price of that article?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 4}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 4}}]","tools":"[{\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"square_perimeter\", \"description\": \"Calculate the perimeter of a square given its side length\", \"parameters\": {\"arg_0\": {\"description\": \"side length\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square perimeter\", \"type\": \"int or float\"}}}]","gold_answer":"0.75"} +{"sample_id":"7804b535-d21a-4ebe-a354-7f41f824cd6a","input":"A boat running upstream takes 8 hours 48 minutes to cover a certain distance, while it takes 4 hours to cover the same distance running downstream. What is the ratio between the speed of the boat and speed of the water current respectively?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 48, \"arg_1\": 60}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 8}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 4}}, {\"name\": \"add\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 48, \"arg_1\": 60}}, {\"name\": \"add\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 8}}, {\"name\": \"divide\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": 4}}, {\"name\": \"subtract\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": \"$var_8.result$\", \"arg_1\": 1}}, {\"name\": \"divide\", \"label\": \"$var_10\", \"arguments\": {\"arg_0\": \"$var_9.result$\", \"arg_1\": 2}}, {\"name\": \"divide\", \"label\": \"$var_11\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": \"$var_10.result$\"}}]","tools":"[{\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"gcd\", \"description\": \"calculate the Greatest Common Divisor (GCD) of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Greatest Common Divisor\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}]","gold_answer":"2.6666666666666665"} +{"sample_id":"8eb2bfe1-15e6-44d1-b542-b0885cc49a42","input":"If A speaks the truth 65% of the times, B speaks the truth 60% of the times. What is the probability that they tell the truth at the same time","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 5}}, {\"name\": \"divide\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": 65, \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 4, \"arg_1\": 5}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_4.result$\", \"arg_1\": 5}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 60, \"arg_1\": \"$var_5.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_6.result$\"}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"speed\", \"description\": \"Calculate speed given distance and time.\", \"parameters\": {\"arg_0\": {\"description\": \"distance\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"time\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the speed\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"lcm\", \"description\": \"Calculate the least common multiple of two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the least common multiple\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"0.39"} +{"sample_id":"578b8277-919e-481b-8222-51205e8202c0","input":"Flatten a nested list [[1, 2], [3, 4], [5, 6]] and then calculate the sum of the numbers.","output":"[{\"name\": \"flatten_nested_list\", \"arguments\": {\"nested_list\": [[1, 2], [3, 4], [5, 6]]}, \"label\": \"$var1\"}, {\"name\": \"sum_or_average\", \"arguments\": {\"numbers\": \"$var1.output_0$\"}, \"label\": \"$var2\"}]","tools":"[{\"name\": \"extract_has_htl_code\", \"description\": \"Extracts HASHTAG codes from the input string.\", \"parameters\": {\"input_string\": {\"description\": \"The input string to extract HASHTAG codes from.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of extracted HASHTAG codes.\", \"type\": \"array\"}}}, {\"name\": \"count_words_from_sentences\", \"description\": \"Counts the words in a list of sentences.\", \"parameters\": {\"sentences\": {\"description\": \"A list of sentences.\", \"items\": {\"type\": \"string\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A dictionary of words and their corresponding counts.\", \"type\": \"object\"}}}, {\"name\": \"extract_top_k\", \"description\": \"Extracts the top k elements from a list of tuples, sorted in descending order by the second element.\", \"parameters\": {\"k\": {\"description\": \"The number of top elements to extract.\", \"type\": \"integer\"}, \"lst\": {\"description\": \"A list of tuples, where each tuple contains a string and an integer.\", \"items\": {\"prefixItems\": [{\"type\": \"string\"}, {\"type\": \"integer\"}], \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the top k elements from the input list, sorted in descending order by the second element.\", \"type\": \"array\"}}}, {\"name\": \"is_dataframe_empty\", \"description\": \"Checks whether a pandas DataFrame is empty or not.\", \"parameters\": {\"df\": {\"description\": \"The DataFrame to check.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"True if the DataFrame is empty and False otherwise.\", \"type\": \"boolean\"}}}, {\"name\": \"ratio_saliency\", \"description\": \"Calculates the saliency ratio for a given time series.\", \"parameters\": {\"time_series\": {\"description\": \"A list of integers representing the time series.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats representing the saliency ratios.\", \"type\": \"array\"}}}, {\"name\": \"compare_api\", \"description\": \"Compares two dictionaries representing API endpoints and returns a new dictionary containing the differences.\", \"parameters\": {\"api_1\": {\"additionalProperties\": {\"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"description\": \"The first API dictionary.\", \"type\": \"object\"}, \"api_2\": {\"additionalProperties\": {\"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"description\": \"The second API dictionary.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"orthogonal_projection\", \"description\": \"Computes the orthogonal projection of a 3D point onto a given axis.\", \"parameters\": {\"axis\": {\"description\": \"The axis onto which the point is projected.\", \"type\": \"object\"}, \"point\": {\"description\": \"The 3D point to project.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"non_whitespace_substrings\", \"description\": \"Returns a list of non-empty substrings that do not contain any whitespace characters.\", \"parameters\": {\"input_str\": {\"description\": \"A string containing multiple words separated by whitespace characters.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"array\"}}}, {\"name\": \"snake_to_kebab\", \"description\": \"Converts a string from snake_case to kebab-case.\", \"parameters\": {\"snake_case_string\": {\"description\": \"The string to convert.\", \"type\": \"object\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"compute_degree\", \"description\": \"Computes the degree of a polynomial expressed as a list of coefficients in decreasing order of powers.\\nThe function handles a leading zero case where the degree of the polynomial is 0 (i.e., the list only contains a single zero).\", \"parameters\": {\"coefficients\": {\"description\": \"The coefficients of the polynomial in decreasing order of powers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"integer\"}}}, {\"name\": \"fizz_buzz\", \"description\": \"Returns a string based on the truthiness and divisibility of a number.\", \"parameters\": {\"n\": {\"description\": \"The number to check.\", \"type\": [\"integer\", \"number\"]}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"string\"}}}, {\"name\": \"parse_list_of_numbers\", \"description\": \"Parses a string representing a list of numbers (separated by commas) into a list of floats.\", \"parameters\": {\"string\": {\"description\": \"The input string.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of floats.\", \"type\": \"array\"}}}, {\"name\": \"traverse_diagonal\", \"description\": \"Traverses a square matrix and returns the diagonal elements, ordered from the top-left to the bottom-right.\", \"parameters\": {\"matrix\": {\"description\": \"A square matrix represented as a list of lists.\", \"items\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the diagonal elements.\", \"type\": \"array\"}}}, {\"name\": \"create_list_with_default_value\", \"description\": \"Creates an empty list with a specified size and initializes each element to a given value.\", \"parameters\": {\"default_value\": {\"description\": \"The default value for each element.\", \"type\": \"object\"}, \"size\": {\"description\": \"The size of the list.\", \"type\": \"integer\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A list of the specified size with each element initialized to the default value.\", \"type\": \"array\"}}}, {\"name\": \"flatten_nested_list\", \"description\": \"Flattens a nested list into a single list of items.\", \"parameters\": {\"nested_list\": {\"description\": \"A nested list of integers.\", \"items\": {\"type\": [\"array\", \"integer\"]}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A flattened list of integers.\", \"type\": \"array\"}}}, {\"name\": \"get_data_by_indices\", \"description\": \"Extracts specific values from a PyTorch tensor based on a given set of indices.\", \"parameters\": {\"data\": {\"description\": \"The input tensor.\", \"type\": \"object\"}, \"idx\": {\"description\": \"The list of indices.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, \"target_idx\": {\"description\": \"The list of target indices.\", \"items\": {\"type\": \"integer\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"\", \"type\": \"object\"}}}, {\"name\": \"sum_or_average\", \"description\": \"Calculates the sum of the numbers in the list, but if the list contains an odd number of elements,\\nthe function returns the sum of the middle element and the average of the remaining elements.\", \"parameters\": {\"numbers\": {\"description\": \"A list of numbers.\", \"items\": {\"type\": \"number\"}, \"type\": \"array\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"The sum of the numbers in the list or the sum of the middle element and the average of the remaining elements.\", \"type\": \"number\"}}}, {\"name\": \"get_info_with_error_handling\", \"description\": \"Returns a string with the key and value separated by a colon and a space.\\nRaises a KeyError if the key is not in the data dictionary.\\nRaises a ValueError if the value is not a string.\", \"parameters\": {\"data\": {\"additionalProperties\": {}, \"description\": \"The data dictionary.\", \"type\": \"object\"}, \"key\": {\"description\": \"The key to look up in the data dictionary.\", \"type\": \"string\"}}, \"output_parameters\": {\"output_0\": {\"description\": \"A string with the key and value separated by a colon and a space.\", \"type\": \"string\"}}}]","gold_answer":"21"} +{"sample_id":"b9f83392-72a9-4aa7-9ebb-98f5c3ea5620","input":"How many digits are required to number a book containing 250 pages?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 10, \"arg_1\": 1}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 10, \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 10}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": 250, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": 1}}, {\"name\": \"multiply\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": 3}}, {\"name\": \"add\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": \"$var_8.result$\"}}]","tools":"[{\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"square_area\", \"description\": \"Calculate the area of a square given its side\", \"parameters\": {\"arg_0\": {\"description\": \"The sequare side\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square area\", \"type\": \"int or float\"}}}, {\"name\": \"triangle_area\", \"description\": \"Calculate the area of a triangle given base and height\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the base of the triangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the triangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Area of the triangle\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cone\", \"description\": \"Calculate the volume of a cone\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cone\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cone\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cone\", \"type\": \"float\"}}}, {\"name\": \"rectangle_perimeter\", \"description\": \"Calculate the perimeter of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle perimeter\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"642.0"} +{"sample_id":"3aaa2cdc-81ad-454c-886c-8fb9438daa49","input":"A student chose a number, multiplied it by 5, then subtracted 275 from the result and got 135. What was the number he chose?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 135, \"arg_1\": 275}}, {\"name\": \"divide\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 5}}]","tools":"[{\"name\": \"volume_cube\", \"description\": \"Calculate the volume of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cube\", \"type\": \"float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"square_edge_by_perimeter\", \"description\": \"Calculate the edge length of a square given its perimeter\", \"parameters\": {\"arg_0\": {\"description\": \"Perimeter of the square\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Edge length of the square\", \"type\": \"float\"}}}, {\"name\": \"surface_cube\", \"description\": \"Calculate the surface area of a cube\", \"parameters\": {\"arg_0\": {\"description\": \"Length of a side of the cube\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cube\", \"type\": \"float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}]","gold_answer":"82.0"} +{"sample_id":"0a31a4fd-fc27-4339-80b7-9a07e32f60d0","input":"A man and a boy complete a work together in 24 days. If for the last 6 days man alone does the work then it is completed in 26 days. How long the boy will take to complete the work alone?","output":"[{\"name\": \"subtract\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 26, \"arg_1\": 6}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 26, \"arg_1\": 2}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}]","tools":"[{\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"circle_area\", \"description\": \"Calculate the area of a circle given its radius\", \"parameters\": {\"arg_0\": {\"description\": \"The circle radius\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the circle area\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}]","gold_answer":"72.0"} +{"sample_id":"30af9f02-7490-4c7f-be99-e2f99fc57f62","input":"bag contains 7 green and 8 white balls. If two balls are drawn simultaneously, the probability that both are of the same colour is -.","output":"[{\"name\": \"factorial\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 7}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 2}}, {\"name\": \"factorial\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\"}}, {\"name\": \"factorial\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_5.result$\"}}, {\"name\": \"factorial\", \"label\": \"$var_7\", \"arguments\": {\"arg_0\": 8}}, {\"name\": \"subtract\", \"label\": \"$var_8\", \"arguments\": {\"arg_0\": 8, \"arg_1\": 2}}, {\"name\": \"factorial\", \"label\": \"$var_9\", \"arguments\": {\"arg_0\": \"$var_8.result$\"}}, {\"name\": \"factorial\", \"label\": \"$var_10\", \"arguments\": {\"arg_0\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_11\", \"arguments\": {\"arg_0\": \"$var_9.result$\", \"arg_1\": \"$var_10.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_12\", \"arguments\": {\"arg_0\": \"$var_7.result$\", \"arg_1\": \"$var_11.result$\"}}, {\"name\": \"add\", \"label\": \"$var_13\", \"arguments\": {\"arg_0\": \"$var_6.result$\", \"arg_1\": \"$var_12.result$\"}}, {\"name\": \"add\", \"label\": \"$var_14\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 8}}, {\"name\": \"factorial\", \"label\": \"$var_15\", \"arguments\": {\"arg_0\": \"$var_14.result$\"}}, {\"name\": \"add\", \"label\": \"$var_16\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 8}}, {\"name\": \"subtract\", \"label\": \"$var_17\", \"arguments\": {\"arg_0\": \"$var_16.result$\", \"arg_1\": 2}}, {\"name\": \"factorial\", \"label\": \"$var_18\", \"arguments\": {\"arg_0\": \"$var_17.result$\"}}, {\"name\": \"factorial\", \"label\": \"$var_19\", \"arguments\": {\"arg_0\": 2}}, {\"name\": \"multiply\", \"label\": \"$var_20\", \"arguments\": {\"arg_0\": \"$var_18.result$\", \"arg_1\": \"$var_19.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_21\", \"arguments\": {\"arg_0\": \"$var_15.result$\", \"arg_1\": \"$var_20.result$\"}}, {\"name\": \"divide\", \"label\": \"$var_22\", \"arguments\": {\"arg_0\": \"$var_13.result$\", \"arg_1\": \"$var_21.result$\"}}]","tools":"[{\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"choose\", \"description\": \"Calculate the number of ways to choose r items from n items without repetition and without order\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being chosen\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of combinations\", \"type\": \"int\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"diagonal\", \"description\": \"Calculate the length of the diagonal of a rectangle\", \"parameters\": {\"arg_0\": {\"description\": \"Length of the rectangle\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Width of the rectangle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Length of the diagonal\", \"type\": \"float\"}}}, {\"name\": \"sqrt\", \"description\": \"Calculate the square root of a non-negative number.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the square root of the provided number\", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"factorial\", \"description\": \" Calculate the factorial of a non-negative integer\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the factorial result\", \"type\": \"int\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}]","gold_answer":"0.4666666666666667"} +{"sample_id":"1687e9c2-fcd0-43f9-9cd4-ffbcdb497c48","input":"A merchant marks his goods up by 30% and then offers a discount of 20% on the marked price. What % profit does the merchant make after the discount?","output":"[{\"name\": \"add\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 30, \"arg_1\": 100}}, {\"name\": \"add\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 30, \"arg_1\": 100}}, {\"name\": \"multiply\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_2.result$\", \"arg_1\": 20}}, {\"name\": \"divide\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": 100}}, {\"name\": \"subtract\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_4.result$\"}}, {\"name\": \"subtract\", \"label\": \"$var_6\", \"arguments\": {\"arg_0\": \"$var_5.result$\", \"arg_1\": 100}}]","tools":"[{\"name\": \"surface_cylinder\", \"description\": \"Calculate the surface area of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"volume_cylinder\", \"description\": \"Calculate the volume of a cylinder\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the base of the cylinder\", \"type\": \"float\"}, \"arg_1\": {\"description\": \"Height of the cylinder\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the cylinder\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"remainder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"log\", \"description\": \"Calculate the logarithm of x with the given base (default is natural log)\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The base\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"logarithm of provided number with the given base \", \"type\": \"int\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}]","gold_answer":"4.0"} +{"sample_id":"a4638ff2-f88d-4791-9577-0ae12ddd098c","input":"If the perimeter of a rectangular house is 1400 m, its length when its breadth is 300 m is?","output":"[{\"name\": \"divide\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 1400, \"arg_1\": 2}}, {\"name\": \"subtract\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": 300}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"reminder\", \"description\": \"Calculate the remainder of a divided by b\", \"parameters\": {\"arg_0\": {\"description\": \"first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the remainder\", \"type\": \"int or float\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"max_number\", \"description\": \"Find the maximum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Maximum value\", \"type\": \"float\"}}}, {\"name\": \"volume_sphere\", \"description\": \"Calculate the volume of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Volume of the sphere\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"negate\", \"description\": \"Return the negation of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"permutation\", \"description\": \"Calculate the number of permutations of n items taken r at a time\", \"parameters\": {\"arg_0\": {\"description\": \"Total number of items\", \"type\": \"int\"}, \"arg_1\": {\"description\": \"Number of items being arranged\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"Number of permutations\", \"type\": \"int\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}]","gold_answer":"400.0"} +{"sample_id":"527e54a6-fd36-4274-b93c-a57e88c04eb6","input":"The average of 13 result is 60. Average of the first 7 of them is 57 and that of the last 7 is 61. Find the 8th result?","output":"[{\"name\": \"multiply\", \"label\": \"$var_1\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 57}}, {\"name\": \"multiply\", \"label\": \"$var_2\", \"arguments\": {\"arg_0\": 7, \"arg_1\": 61}}, {\"name\": \"add\", \"label\": \"$var_3\", \"arguments\": {\"arg_0\": \"$var_1.result$\", \"arg_1\": \"$var_2.result$\"}}, {\"name\": \"multiply\", \"label\": \"$var_4\", \"arguments\": {\"arg_0\": 13, \"arg_1\": 60}}, {\"name\": \"subtract\", \"label\": \"$var_5\", \"arguments\": {\"arg_0\": \"$var_3.result$\", \"arg_1\": \"$var_4.result$\"}}]","tools":"[{\"name\": \"add\", \"description\": \"adds two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The addition result\", \"type\": \"int or float\"}}}, {\"name\": \"rectangle_area\", \"description\": \"Calculate the area of a rectangle given its length and width\", \"parameters\": {\"arg_0\": {\"description\": \"rectangle length\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"rectangle width\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"the rectangle area\", \"type\": \"int or float\"}}}, {\"name\": \"subtract\", \"description\": \"subtract two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The subtraction result\", \"type\": \"int or float\"}}}, {\"name\": \"circumface\", \"description\": \"Calculate the circumference of a circle\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the circle\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Circumference of the circle\", \"type\": \"float\"}}}, {\"name\": \"surface_sphere\", \"description\": \"Calculate the surface area of a sphere\", \"parameters\": {\"arg_0\": {\"description\": \"Radius of the sphere\", \"type\": \"float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Surface area of the sphere\", \"type\": \"float\"}}}, {\"name\": \"inverse\", \"description\": \"Return the inverse (reciprocal) of a number\", \"parameters\": {\"arg_0\": {\"description\": \"The number to inverse\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The inverse result\", \"type\": \"int or float\"}}}, {\"name\": \"floor\", \"description\": \"Return the largest integer less than or equal to x.\", \"parameters\": {\"arg_0\": {\"description\": \"The input number\", \"type\": \"int\"}}, \"output_parameters\": {\"result\": {\"description\": \"the flooring result\", \"type\": \"int\"}}}, {\"name\": \"divide\", \"description\": \"divides two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The division result\", \"type\": \"int or float\"}}}, {\"name\": \"min_number\", \"description\": \"Find the minimum value among the given numbers\", \"parameters\": {\"arg_0\": {\"description\": \"A list of numbers\", \"type\": \"list of float\"}}, \"output_parameters\": {\"result\": {\"description\": \"Minimum value\", \"type\": \"float\"}}}, {\"name\": \"multiply\", \"description\": \"Multiplies two numbers\", \"parameters\": {\"arg_0\": {\"description\": \"The first number\", \"type\": \"int or float\"}, \"arg_1\": {\"description\": \"The second number\", \"type\": \"int or float\"}}, \"output_parameters\": {\"result\": {\"description\": \"The multiplication result\", \"type\": \"int or float\"}}}]","gold_answer":"46.0"} diff --git a/tests/data/test_data_preprocessing.py b/tests/data/test_data_preprocessing.py index 1ddfaaf89..a1072d2ec 100644 --- a/tests/data/test_data_preprocessing.py +++ b/tests/data/test_data_preprocessing.py @@ -768,7 +768,7 @@ def test_process_dataconfig_file_with_streaming(data_config_path, data_path): output_dir="tmp", # Not needed but positional ) - (train_set, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) + (train_set, _, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) assert isinstance(train_set, IterableDataset) if datasets_name == "text_dataset_input_output_masking": column_names = set(["input_ids", "attention_mask", "labels"]) @@ -1017,7 +1017,7 @@ def test_process_dataconfig_file(data_config_path, data_path): output_dir="tmp", # Not needed but positional ) - (train_set, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) + (train_set, _, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) assert isinstance(train_set, Dataset) if datasets_name == "text_dataset_input_output_masking": column_names = set(["input_ids", "attention_mask", "labels"]) @@ -1107,7 +1107,7 @@ def test_process_datahandler_eos_token(data_config_path, data_path, add_eos_toke output_dir="tmp", # Not needed but positional ) - (train_set, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) + (train_set, _, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) assert isinstance(train_set, Dataset) if datasets_name == "text_dataset_input_output_masking": column_names = set(["input_ids", "attention_mask", "labels"]) @@ -1258,7 +1258,7 @@ def test_process_dataconfig_multiple_files(data_config_path, data_path_list): output_dir="tmp", # Not needed but positional ) - (train_set, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) + (train_set, _, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) assert isinstance(train_set, Dataset) if datasets_name == "text_dataset_input_output_masking": column_names = set(["input_ids", "attention_mask", "labels"]) @@ -1330,7 +1330,7 @@ def test_process_dataconfig_multiple_files_folders_with_globbing( output_dir="tmp", # Not needed but positional ) - (train_set, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) + (train_set, _, _, _) = process_dataconfig_file(data_args, TRAIN_ARGS, tokenizer) assert isinstance(train_set, Dataset) assert set(["input_ids", "attention_mask", "labels"]).issubset( set(train_set.column_names) @@ -1831,7 +1831,9 @@ def test_process_dataset_configs(datafile, column_names, datasetconfigname): tokenizer=tokenizer, ) datasetconfig = [DataSetConfig(name=datasetconfigname, data_paths=[datafile])] - train_dataset, _ = processor.process_dataset_configs(dataset_configs=datasetconfig) + train_dataset, _, _ = processor.process_dataset_configs( + dataset_configs=datasetconfig + ) assert isinstance(train_dataset, Dataset) assert set(train_dataset.column_names) == column_names @@ -1953,7 +1955,9 @@ def test_rename_and_select_dataset_columns( name=datasetconfigname, data_paths=data_paths, data_handlers=handlers ) ] - train_dataset, _ = processor.process_dataset_configs(dataset_configs=datasetconfig) + train_dataset, _, _ = processor.process_dataset_configs( + dataset_configs=datasetconfig + ) assert isinstance(train_dataset, Dataset) assert set(train_dataset.column_names) == set(final) diff --git a/tests/test_sft_trainer.py b/tests/test_sft_trainer.py index e9f45876b..9cf8191aa 100644 --- a/tests/test_sft_trainer.py +++ b/tests/test_sft_trainer.py @@ -27,6 +27,7 @@ # Third Party from datasets.exceptions import DatasetGenerationError, DatasetNotFoundError +from peft import LoraConfig as HFLoraConfig from transformers.trainer_callback import TrainerCallback import pytest import torch @@ -38,8 +39,10 @@ from scripts.run_inference import TunedCausalLM from tests.artifacts.language_models import MAYKEYE_TINY_LLAMA_CACHED from tests.artifacts.predefined_data_configs import ( + CHAT_TEMPLATE_JINJA, DATA_CONFIG_DUPLICATE_COLUMNS, DATA_CONFIG_INVALID_BASE64_CHAT_TEMPLATE, + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, DATA_CONFIG_MULTIPLE_DATASETS_SAMPLING_YAML, DATA_CONFIG_MULTITURN_CHAT_TOKENIZE_AND_MASKING_DATA_HANDLER, DATA_CONFIG_MULTITURN_DATA_YAML, @@ -64,6 +67,7 @@ CUSTOM_TOKENIZER_TINYLLAMA, EMPTY_DATA, MALFORMATTED_DATA, + NESTFUL_DATA_INPUT_OUTPUT_JSONL, TWITTER_COMPLAINTS_DATA_ARROW, TWITTER_COMPLAINTS_DATA_DIR_JSON, TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_ARROW, @@ -93,7 +97,7 @@ load_and_validate_data_config, ) from tuning.data.data_handlers import DataHandler, DataHandlerType -from tuning.utils.import_utils import is_alora_available, is_fms_accelerate_available +from tuning.utils.import_utils import is_fms_accelerate_available MODEL_NAME = MAYKEYE_TINY_LLAMA_CACHED @@ -144,15 +148,13 @@ ) PEFT_LORA_ARGS = peft_config.LoraConfig(r=8, lora_alpha=32, lora_dropout=0.05) -try: # Optional package - # Third Party - from alora.config import aLoraConfig - PEFT_ALORA_ARGS = aLoraConfig( - r=8, lora_alpha=32, lora_dropout=0.05, invocation_string="Label:" - ) -except ImportError: - pass +INVOCATION_STR = "Label:" + +if hasattr(HFLoraConfig, "alora_invocation_tokens"): + PEFT_ALORA_ARGS = peft_config.LoraConfig(r=8, lora_alpha=32, lora_dropout=0.05) +else: + PEFT_ALORA_ARGS = None @pytest.mark.parametrize( @@ -407,6 +409,7 @@ def test_parse_arguments(job_config): _, _, _, + _, ) = sft_trainer.parse_arguments(parser, job_config_copy) assert str(model_args.torch_dtype) == "torch.bfloat16" assert data_args.dataset_text_field == "output" @@ -432,6 +435,7 @@ def test_parse_arguments_defaults(job_config): _, _, _, + _, ) = sft_trainer.parse_arguments(parser, job_config_defaults) assert str(model_args.torch_dtype) == "torch.bfloat16" assert model_args.use_flash_attn is False @@ -454,7 +458,9 @@ def test_parse_arguments_peft_method(job_config): _, _, _, + _, ) = sft_trainer.parse_arguments(parser, job_config_pt) + assert isinstance(tune_config, peft_config.PromptTuningConfig) job_config_lora = copy.deepcopy(job_config) @@ -471,6 +477,7 @@ def test_parse_arguments_peft_method(job_config): _, _, _, + _, ) = sft_trainer.parse_arguments(parser, job_config_lora) assert isinstance(tune_config, peft_config.LoraConfig) assert not tune_config.target_modules @@ -737,22 +744,25 @@ def test_run_causallm_lora_and_inference(request, target_modules, expected): assert "Simply put, the theory of relativity states that" in output_inference -@pytest.mark.skipif( - not is_alora_available(), - reason="Only runs if alora is installed", -) @pytest.mark.parametrize( "target_modules,expected", target_modules_val_map, ids=["default", "custom_target_modules", "all_linear_target_modules"], ) def test_run_causallm_alora_and_inference(request, target_modules, expected): - """Check if we can bootstrap and alora tune causallm models""" + """Check if we can bootstrap and alora tune causallm models via PEFT-native aLoRA.""" with tempfile.TemporaryDirectory() as tempdir: train_args = copy.deepcopy(TRAIN_ALORA_ARGS) train_args.output_dir = tempdir base_alora_args = copy.deepcopy(PEFT_ALORA_ARGS) + tokenizer = transformers.AutoTokenizer.from_pretrained( + MODEL_NAME, use_fast=True, legacy=True + ) + base_alora_args.alora_invocation_tokens = tokenizer.encode( + INVOCATION_STR, add_special_tokens=False + ) + if "default" not in request._pyfuncitem.callspec.id: base_alora_args.target_modules = target_modules @@ -767,16 +777,16 @@ def test_run_causallm_alora_and_inference(request, target_modules, expected): for module in expected: assert module in adapter_config.get("target_modules") - # Load the model - loaded_model = TunedCausalLM.load(checkpoint_path, MODEL_NAME, use_alora=True) - invocation_string = loaded_model.peft_model.peft_config[ - loaded_model.peft_model.active_adapter - ].invocation_string - # Run inference on the text - output_inference = loaded_model.run( - "Simply put, the theory of relativity states that \n" + invocation_string, - max_new_tokens=50, - ) + # aLoRA-specific: saved adapter config must contain the exact tokens + expected_tokens = tokenizer.encode(INVOCATION_STR, add_special_tokens=False) + assert adapter_config.get("alora_invocation_tokens") == expected_tokens + + # Load tuned model (no special aLoRA wrapper/flag needed) + loaded_model = TunedCausalLM.load(checkpoint_path, MODEL_NAME) + + # Inference must include the invocation string so aLoRA activates + prompt = "Simply put, the theory of relativity states that \n" + INVOCATION_STR + output_inference = loaded_model.run(prompt, max_new_tokens=50) assert len(output_inference) > 0 assert "Simply put, the theory of relativity states that \n" in output_inference @@ -1508,6 +1518,42 @@ def test_data_config_chat_template_as_base64(): data_config = load_and_validate_data_config(data_config_path) +def test_data_config_chat_template_path(): + base_cfg = DATA_CONFIG_MULTITURN_DATA_YAML + chat_template_path = CHAT_TEMPLATE_JINJA + + with open(chat_template_path, "r", encoding="utf-8") as f: + expected_template = f.read() + + with tempfile.NamedTemporaryFile("w", delete=False, suffix=".yaml") as tmp_cfg: + with open(base_cfg, "r", encoding="utf-8") as f: + cfg = yaml.safe_load(f) + + dp = cfg.get("dataprocessor", {}) or {} + dp.pop("chat_template", None) + dp["chat_template_path"] = chat_template_path + cfg["dataprocessor"] = dp + + for d in cfg.get("datasets", []): + d["data_paths"] = [TWITTER_COMPLAINTS_DATA_JSON] + + yaml.safe_dump(cfg, tmp_cfg) + mod_cfg_path = tmp_cfg.name + + data_config = load_and_validate_data_config(mod_cfg_path) + + assert ( + data_config.dataprocessor.chat_template == expected_template + ), "chat_template should equal the contents of CHAT_TEMPLATE_JINJA" + assert data_config.dataprocessor.chat_template_path is not None + assert os.path.isabs( + data_config.dataprocessor.chat_template_path + ), "stored chat_template_path should be absolute" + assert os.path.exists( + data_config.dataprocessor.chat_template_path + ), "resolved chat_template_path should exist" + + @pytest.mark.parametrize( "data_args", [ @@ -2141,3 +2187,209 @@ def test_handler(element, **kwargs): }, ) _validate_training(tempdir) + + +@pytest.mark.skipif( + not is_fms_accelerate_available(plugins="odm"), + reason="Only runs if fms-accelerate is installed along with online-data-mixing plugin", +) +@pytest.mark.parametrize( + "datafiles, datasetconfigname, reward_type", + [ + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "entropy", + ), + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "train_loss", + ), + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "validation_loss", + ), + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "ENTROPY3_VARENT1", + ), + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "ENTROPY_LAST_TOKEN", + ), + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "GRADNORM", + ), + ], +) +def test_online_data_mixing_plugin_sample_training( + datafiles, datasetconfigname, reward_type +): + """Ensure fms_acceleration_odm plugin does a sample training without failing""" + with tempfile.TemporaryDirectory() as tempdir: + data_formatting_args = copy.deepcopy(DATA_ARGS) + + # set training_data_path and response_template to none + data_formatting_args.response_template = None + data_formatting_args.training_data_path = None + + # add data_paths in data_config file + with tempfile.NamedTemporaryFile( + "w", delete=False, suffix=".yaml" + ) as temp_yaml_file: + with open(datasetconfigname, "r", encoding="utf-8") as f: + data = yaml.safe_load(f) + data["dataprocessor"]["odm"]["reward_type"] = reward_type + data["datasets"] = data["datasets"][:2] + sampling_weights = [0.4, 0.6] + i = 0 + for d, df in zip(data["datasets"], datafiles): + d["data_paths"] = [df] + d["sampling"] = sampling_weights[i] + i += 1 + yaml.dump(data, temp_yaml_file) + data_formatting_args.data_config_path = temp_yaml_file.name + + train_args = copy.deepcopy(TRAIN_ARGS) + train_args.output_dir = tempdir + train_args.logging_strategy = "steps" + train_args.max_steps = 2 + train_args.eval_strategy = "steps" + train_args.eval_steps = 1 + + sft_trainer.train(MODEL_ARGS, data_formatting_args, train_args) + + # validate full ft configs + _validate_training(tempdir) + _, checkpoint_path = _get_latest_checkpoint_trainer_state(tempdir) + + # Load the model + loaded_model = TunedCausalLM.load(checkpoint_path, MODEL_NAME) + + # Run inference on the text + output_inference = loaded_model.run( + "### Text: @NortonSupport Thanks much.\n\n### Label:", max_new_tokens=50 + ) + assert len(output_inference) > 0 + assert "### Text: @NortonSupport Thanks much.\n\n### Label:" in output_inference + + output_inference = loaded_model.run( + "It takes 10 days for digging a trench of 100 m long, " + "50 m broad and 10 m deep. What length of trench,\n25 m broad and 15 m " + "deep can be dug in 30 days ?", + max_new_tokens=50, + ) + assert len(output_inference) > 0 + assert ( + "It takes 10 days for digging a trench of 100 m long, 50 m broad and 10 m deep. " + "What length of trench,\n25 m broad and 15 m deep can be dug in 30 days ?" + in output_inference + ), f"{output_inference} does not include the prompt" + + +@pytest.mark.skipif( + not is_fms_accelerate_available(plugins="odm"), + reason="Only runs if fms-accelerate is installed along with online-data-mixing plugin", +) +@pytest.mark.parametrize( + "datafiles, datasetconfigname, reward_type", + [ + ( + [ + NESTFUL_DATA_INPUT_OUTPUT_JSONL, + TWITTER_COMPLAINTS_DATA_INPUT_OUTPUT_JSONL, + ], + DATA_CONFIG_MULTIPLE_DATASETS_ODM_YAML, + "train_loss", + ), + ], +) +def test_online_data_mixing_plugin_sample_training_no_validation_split( + datafiles, datasetconfigname, reward_type +): + """Ensure fms_acceleration_odm plugin does a sample training without + failing when on validation set is given""" + with tempfile.TemporaryDirectory() as tempdir: + data_formatting_args = copy.deepcopy(DATA_ARGS) + + # set training_data_path and response_template to none + data_formatting_args.response_template = None + data_formatting_args.training_data_path = None + + # add data_paths in data_config file + with tempfile.NamedTemporaryFile( + "w", delete=False, suffix=".yaml" + ) as temp_yaml_file: + with open(datasetconfigname, "r", encoding="utf-8") as f: + data = yaml.safe_load(f) + data["datasets"] = data["datasets"][:2] + data["dataprocessor"]["odm"]["reward_type"] = reward_type + i = 0 + sampling_weights = [0.4, 0.6] + for d, df in zip(data["datasets"], datafiles): + d["data_paths"] = [df] + d["sampling"] = sampling_weights[i] + del d["split"] + i += 1 + yaml.dump(data, temp_yaml_file) + data_formatting_args.data_config_path = temp_yaml_file.name + + train_args = copy.deepcopy(TRAIN_ARGS) + train_args.logging_strategy = "steps" + train_args.output_dir = tempdir + train_args.max_steps = 2 + train_args.eval_strategy = "steps" + train_args.eval_steps = 1 + + sft_trainer.train(MODEL_ARGS, data_formatting_args, train_args) + + # validate full ft configs + _validate_training(tempdir) + _, checkpoint_path = _get_latest_checkpoint_trainer_state(tempdir) + + # Load the model + loaded_model = TunedCausalLM.load(checkpoint_path, MODEL_NAME) + + # Run inference on the text + output_inference = loaded_model.run( + "### Text: @NortonSupport Thanks much.\n\n### Label:", max_new_tokens=50 + ) + assert len(output_inference) > 0 + assert "### Text: @NortonSupport Thanks much.\n\n### Label:" in output_inference + + output_inference = loaded_model.run( + "It takes 10 days for digging a trench of 100 m long, " + "50 m broad and 10 m deep. What length of trench,\n25 m broad and 15 m " + "deep can be dug in 30 days ?", + max_new_tokens=50, + ) + assert len(output_inference) > 0 + assert ( + "It takes 10 days for digging a trench of 100 m long, 50 m broad and 10 m deep. " + "What length of trench,\n25 m broad and 15 m deep can be dug in 30 days ?" + in output_inference + ), f"{output_inference} does not include the prompt" diff --git a/tuning/config/acceleration_configs/__init__.py b/tuning/config/acceleration_configs/__init__.py index 35d425c46..3adf2171c 100644 --- a/tuning/config/acceleration_configs/__init__.py +++ b/tuning/config/acceleration_configs/__init__.py @@ -18,4 +18,5 @@ from .callbacks import get_additional_accel_framework_callbacks from .fast_moe import FastMoeConfig from .fused_ops_and_kernels import FusedOpsAndKernelsConfig +from .odm import ODM, ODMConfig from .quantized_lora_config import QuantizedLoraConfig diff --git a/tuning/config/acceleration_configs/acceleration_framework_config.py b/tuning/config/acceleration_configs/acceleration_framework_config.py index a5a685897..09309cbfa 100644 --- a/tuning/config/acceleration_configs/acceleration_framework_config.py +++ b/tuning/config/acceleration_configs/acceleration_framework_config.py @@ -24,6 +24,7 @@ from .attention_and_distributed_packing import MultiPack, PaddingFree from .fast_moe import FastMoe from .fused_ops_and_kernels import FastKernelsConfig, FusedLoraConfig +from .odm import ODM from .quantized_lora_config import AutoGPTQLoraConfig, BNBQLoraConfig from tuning.utils.import_utils import is_fms_accelerate_available @@ -121,6 +122,17 @@ class AccelerationFrameworkConfig: ), ] = None + odm: Annotated[ + ODM, + ConfigAnnotation( + path="training.odm", + key="odm", + standalone=True, + experimental=True, + required_packages=["odm"], + ), + ] = None + multipack: Annotated[ MultiPack, ConfigAnnotation( diff --git a/tuning/config/acceleration_configs/fast_moe.py b/tuning/config/acceleration_configs/fast_moe.py index 37602daf1..39eed4f5d 100644 --- a/tuning/config/acceleration_configs/fast_moe.py +++ b/tuning/config/acceleration_configs/fast_moe.py @@ -96,16 +96,21 @@ def on_save( Also saves the final model in save_model_dir if provided. """ - def checkpoint(checkpoint_dir, save_dir): - hf_converted_output_dir = os.path.join( - save_dir, "hf_converted_checkpoint" - ) - if os.path.exists(hf_converted_output_dir): + def checkpoint(checkpoint_dir, save_dir, is_intermediate: bool = True): + if is_intermediate: + hf_converted_output_dir = os.path.join( + save_dir, "hf_converted_checkpoint" + ) + else: + hf_converted_output_dir = save_dir + + if os.path.exists(hf_converted_output_dir) and is_intermediate: # If the folder already exists # we return, since this is possible to happen # saving the checkpointing at the end of the training return - os.mkdir(hf_converted_output_dir) + + os.makedirs(hf_converted_output_dir, exist_ok=True) try: recover_safetensors_from_dcp( checkpoint_dir, @@ -165,8 +170,10 @@ def checkpoint(checkpoint_dir, save_dir): and state.global_step == state.max_steps ): if not os.path.exists(self.save_model_dir): - os.mkdir(self.save_model_dir) - checkpoint(checkpoint_dir, self.save_model_dir) + os.makedirs(self.save_model_dir, exist_ok=True) + checkpoint( + checkpoint_dir, self.save_model_dir, is_intermediate=False + ) callbacks.append( ConvertAndSaveHFCheckpointAtEverySave( diff --git a/tuning/config/acceleration_configs/odm.py b/tuning/config/acceleration_configs/odm.py new file mode 100644 index 000000000..497fc6048 --- /dev/null +++ b/tuning/config/acceleration_configs/odm.py @@ -0,0 +1,41 @@ +# Copyright The FMS HF Tuning Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Standard +from dataclasses import dataclass +from typing import Union + +# Local +from .utils import ensure_nested_dataclasses_initialized, parsable_dataclass + + +@parsable_dataclass +@dataclass +class ODM: + update_interval: int = None + sampling_interval: int = None + reward_type: str = None + gamma: float = 0.1 + eta: float = 0.1 + resume_from_checkpoint: Union[bool, str] = False + + +@dataclass +class ODMConfig: + + odm: ODM = None + + def __post_init__(self): + # ensure nested dataclasses initialized + ensure_nested_dataclasses_initialized(self) diff --git a/tuning/config/configs.py b/tuning/config/configs.py index 85c96cf47..1bca67967 100644 --- a/tuning/config/configs.py +++ b/tuning/config/configs.py @@ -61,6 +61,14 @@ class ModelArguments: tokenizer classes." }, ) + flash_attn_implementation: Optional[str] = field( + default="flash_attention_2", + metadata={ + "help": "Flash Attention implementation to choose.\ + For almost all models don't need to pass or use default i.e. flash_attention_2.\ + Requires use_flash_attn=True flag to be enabled." + }, + ) @dataclass @@ -243,6 +251,13 @@ class TrainingArguments(transformers.TrainingArguments): Other possible values are 'debug', 'info', 'warning', 'error' and 'critical'" }, ) + optim: str = field( + default="adamw_torch", + metadata={ + "help": "Pass optimizer name to use during training. \ + Please only use the optimizers that are supported with HF transformers" + }, + ) enable_reduce_loss_sum: bool = field( default=False, metadata={ diff --git a/tuning/config/peft_config.py b/tuning/config/peft_config.py index 6bf425159..48f594393 100644 --- a/tuning/config/peft_config.py +++ b/tuning/config/peft_config.py @@ -14,49 +14,152 @@ # Standard from dataclasses import dataclass, field -from typing import List +from enum import Enum +from typing import List, Optional + +# Third Party +from peft import LoraConfig as HFLoraConfig +from transformers.utils.quantization_config import Mxfp4Config as HfMxfp4Config + + +class QUANT_METHOD(Enum): + MXFP4 = "mxfp4" + + +class PEFT_METHOD(Enum): + PT = "pt" + LORA = "lora" + ALORA = "alora" + + +@dataclass +class Mxfp4Config: + dequantize: bool = True + + def to_hf_config(self): + return HfMxfp4Config(dequantize=self.dequantize) @dataclass -class LoraConfig: +class LoraConfig(HFLoraConfig): """ - This is the configuration class to store the configuration of a [`LoraModel`]. + This is the configuration class that extends peft.LoraConfig with a few defaults. Args: - r (`int`): - Lora attention dimension (the "rank"). - target_modules (List[str]]): - The names of the modules to apply the adapter to. \ - If this is specified, only the modules with the specified \ - names will be replaced. Please specify modules as per model architecture. \ - If the value is ["all-linear"], \ - then LORA selects all linear and Conv1D modules as per model architecture, \ - except for the output layer. lora_alpha (`int`): The alpha parameter for Lora scaling. lora_dropout (`float`): The dropout probability for Lora layers. - bias (`str`): - Bias type for LoRA. Can be 'none', 'all' or 'lora_only'. \ - If 'all' or 'lora_only', the corresponding biases will be updated during training. \ - Be aware that this means that, even when disabling the adapters, the model \ - will not produce the same output as the base model would have without adaptation. """ - r: int = 8 lora_alpha: int = 32 - target_modules: List[str] = field( + lora_dropout: float = 0.05 + + # HACK: The following list of arguments listed below + # is a fix which reduces the field annotation from + # Optional[List[str], str] type to Optional[List[str]] type + # This is done for compatibility with HFArgumentParser + # Please see: https://github.com/huggingface/peft/issues/2798 for further explanation! + target_modules: Optional[List[str]] = field( default=None, metadata={ - "help": "The names of the modules to apply LORA to. LORA selects modules which either \ - completely match or " - 'end with one of the strings. If the value is ["all-linear"], \ - then LORA selects all linear and Conv1D ' - "modules except for the output layer." + "help": ( + "List of module names or regex expression of the module names to replace with LoRA." + "For example, ['q', 'v'] or '.*decoder.*(SelfAttention|EncDecAttention).*(q|v)$'. " + "This can also be a wildcard 'all-linear' which matches all linear/Conv1D " + "(if the model is a PreTrainedModel, the output layer excluded). " + "If not specified, modules will be chosen according to the model architecture, " + "If the architecture is not known, an error will be raised -- " + "in this case, you should specify the target modules manually. " + "To avoid targeting any modules (because you want to apply `target_parameters`) " + ", set `target_modules=[]`." + ), }, ) - bias = "none" - lora_dropout: float = 0.05 + exclude_modules: Optional[List[str]] = field( + default=None, + metadata={ + "help": ( + "List of module names or regex expression of the module names to exclude from Lora." + ) + }, + ) + init_lora_weights: bool = field( + default=True, + metadata={ + "help": ( + "How to initialize the weights of the LoRA layers. " + "Passing True (default) results in the default initialization from " + "the reference implementation from " + "Microsoft, with the LoRA B weight being set to 0. " + "This means that without further training, " + "the LoRA adapter will be a no-op. " + "Setting the initialization to False leads to random initialization of " + "LoRA A and B, meaning that LoRA is not a no-op before training; " + "this setting is intended for debugging purposes." + ), + }, + ) + layers_to_transform: Optional[list[int]] = field( + default=None, + metadata={ + "help": ( + "The layer indexes to transform, is this argument is specified, " + "PEFT will transform only the layers indexes that are specified inside this list. " + "If a single integer is passed, PEFT will transform only the layer at this index. " + "This only works when target_modules is a list of str." + ) + }, + ) + layers_pattern: Optional[list[str]] = field( + default=None, + metadata={ + "help": ( + "The layer pattern name, used only if `layers_to_transform` is different to None " + "and if the layer pattern is not in the common layers pattern. " + "This only works when target_modules is a list of str. " + "This should target the `nn.ModuleList` of the " + "model, which is often called `'layers'` or `'h'`." + ) + }, + ) + trainable_token_indices: Optional[list[int]] = field( + default=None, + metadata={ + "help": ( + "Lets you specify which token indices to selectively fine-tune " + "without requiring to re-train the " + "whole embedding matrix using the `peft.TrainableTokensModel` method. " + "You can specify token indices in two ways. " + "Either you specify a list of indices which will then target the model's input " + "embedding layer (or, if not found, `embed_tokens`). " + "(Not supported yet) Alternatively, you can specify a dictionary " + "where the key is the name of the embedding module " + "and the values are the list of token indices, e.g. " + "`{'embed_tokens': [0, 1, ...]}`. Note that training " + "with FSDP requires `use_orig_params=True` to " + "avoid issues with non-uniform `requires_grad`." + ) + }, + ) + loftq_config: Optional[dict] = field( + default_factory=dict, + metadata={ + "help": ( + "The configuration of LoftQ. If this is passed, " + "then LoftQ will be used to quantize the backbone " + "weights and initialize Lora layers. Also set `init_lora_weights='loftq'` " + "in this case." + ) + }, + ) + + def __post_init__(self): + # If target_modules is a single-element list, convert it into a plain string + if self.target_modules == ["all-linear"]: + self.target_modules = "all-linear" + + super().__post_init__() @dataclass diff --git a/tuning/data/data_config.py b/tuning/data/data_config.py index 1c3e8bd61..2189912bc 100644 --- a/tuning/data/data_config.py +++ b/tuning/data/data_config.py @@ -20,6 +20,7 @@ import os # Local +from tuning.config.acceleration_configs.odm import ODM from tuning.data.utils import load_yaml_or_json logger = logging.getLogger(__name__) @@ -45,10 +46,12 @@ class DataSetConfig: class DataPreProcessorConfig: type: Optional[str] = "default" sampling_stopping_strategy: Optional[str] = "all_exhausted" - # Default seed is not none to ensure reproducability - seed: Optional[float] = 42 + # Default seed is not none to ensure reproducibility + seed: Optional[int] = 42 streaming: Optional[bool] = False chat_template: Optional[str] = None + chat_template_path: Optional[str] = None + odm: Optional[ODM] = None @dataclass @@ -129,6 +132,11 @@ def _validate_dataprocessor_config(dataprocessor_config) -> DataPreProcessorConf assert isinstance(kwargs, dict), "dataprocessor in data_config needs to be a dict" if "type" in kwargs: assert isinstance(kwargs["type"], str), "dataprocessor type must be a string" + if kwargs["type"] == "odm": + assert ( + "odm" in kwargs + ), "if dataprocessor type is odm, then odm config should be provided" + c.odm = kwargs["odm"] c.type = kwargs["type"] if "sampling_stopping_strategy" in kwargs: strategy = kwargs["sampling_stopping_strategy"] @@ -148,28 +156,94 @@ def _validate_dataprocessor_config(dataprocessor_config) -> DataPreProcessorConf streaming = kwargs["streaming"] assert isinstance(streaming, bool), f"streaming: {streaming} should be a bool" c.streaming = streaming - if "chat_template" in kwargs: + + is_chat_template_present = ( + "chat_template" in kwargs and kwargs["chat_template"] is not None + ) + is_chat_template_path_present = ( + "chat_template_path" in kwargs and kwargs["chat_template_path"] is not None + ) + is_chat_template_b64_present = ( + "chat_template_base64" in kwargs and kwargs["chat_template_base64"] is not None + ) + + if ( + sum( + [ + is_chat_template_present, + is_chat_template_path_present, + is_chat_template_b64_present, + ] + ) + > 1 + ): + raise ValueError( + "Only one of 'chat_template', 'chat_template_path', or 'chat_template_base64' " + "may be specified in dataprocessor config." + ) + + if is_chat_template_present: chat_template = kwargs["chat_template"] assert isinstance(chat_template, str), "chat_template should be a string" c.chat_template = chat_template - elif "chat_template_base64" in kwargs: + c.chat_template_path = None + return c + + if is_chat_template_path_present: + chat_template_path = kwargs["chat_template_path"] + assert isinstance( + chat_template_path, str + ), "chat_template_path should be a string path" + # Expand ~ and environment variables, then absolutize + expanded = os.path.expanduser(os.path.expandvars(chat_template_path)) + abs_path = os.path.abspath(expanded) + + if not os.path.isabs(chat_template_path) and os.path.exists(abs_path): + logger.warning( + " Provided chat_template_path %s is not absolute, changing it to %s", + chat_template_path, + abs_path, + ) + chat_template_path = abs_path + + if not os.path.exists(abs_path): + raise ValueError( + f"chat_template_path does not exist: {chat_template_path} (resolved to {abs_path})" + ) + if not os.path.isfile(abs_path): + raise ValueError( + f"chat_template_path is not a file: {chat_template_path} (resolved to {abs_path})" + ) + try: + with open(abs_path, "r", encoding="utf-8") as f: + c.chat_template = f.read() + c.chat_template_path = abs_path + except Exception as e: + raise ValueError( + f"Failed to read chat_template_path: {chat_template_path} (resolved to {abs_path})." + ) from e + return c + + if is_chat_template_b64_present: chat_template_base64 = kwargs["chat_template_base64"] assert isinstance( chat_template_base64, str ), "chat_template_base64 should be a string" logger.warning( "You are using the 'chat_template_base64' field. " - + "Please use the 'chat_template' field instead for better readability." + "Please prefer 'chat_template' or 'chat_template_path' for better readability." ) try: chat_template_bytes = b64decode(chat_template_base64) chat_template = chat_template_bytes.decode("utf-8") c.chat_template = chat_template + c.chat_template_path = None except Exception as e: raise ValueError( - "You passed the 'chat_template_base64' field which failed during decoding." - + "Please check it or use a decoded chat template with the 'chat_template' field." + "You passed the 'chat_template_base64' field which failed during decoding. " + "Please check it or use 'chat_template' or 'chat_template_path' instead." ) from e + return c @@ -188,11 +262,21 @@ def load_and_validate_data_config(data_config_file: str) -> DataConfig: assert isinstance( raw_data["datasets"], list ), "datasets should be provided as a list" + datasets = [] + dataprocessor = None + for d in raw_data["datasets"]: datasets.append(_validate_dataset_config(d)) if "dataprocessor" in raw_data: dataprocessor = _validate_dataprocessor_config(raw_data["dataprocessor"]) + if dataprocessor is None: + logging.info( + "`dataprocessor` field is absent from data config. Using default dataprocessor" + ) + dataprocessor = DataPreProcessorConfig() + logging.info("Default datapreprocessor is %s", str(dataprocessor)) + data_config = DataConfig(dataprocessor=dataprocessor, datasets=datasets) return data_config diff --git a/tuning/data/data_preprocessing_utils.py b/tuning/data/data_preprocessing_utils.py index 82f6c7f67..04d0d7a2d 100644 --- a/tuning/data/data_preprocessing_utils.py +++ b/tuning/data/data_preprocessing_utils.py @@ -92,16 +92,9 @@ def get_data_collator( ) if is_traindata_tokenized: - # Note that this automatically pads labels with -100 - # TODO check if this is sufficient for preprocessed - # TODO with the release of trl v0.17.0, DataCollatorForSeq2Seq - # was removed from tokenized data processing, should eventually - # be added back in with support directly in fms-hf-tuning, not - # dependent on trl. - # return DataCollatorForSeq2Seq( - # tokenizer=tokenizer, padding=True, max_length=max_seq_length - # ) - return None + return DataCollatorForSeq2Seq( + tokenizer=tokenizer, padding=True, max_length=max_seq_length + ) # TODO: near term - how response template ids are parsed out needs to be cleaned. # The [2:] here applies if response template has \n prefix, it is needed to strip \n, diff --git a/tuning/data/data_processors.py b/tuning/data/data_processors.py index 705347eea..20936f387 100644 --- a/tuning/data/data_processors.py +++ b/tuning/data/data_processors.py @@ -13,7 +13,7 @@ # limitations under the License. # Standard -from typing import Dict, List, Union +from typing import Dict, List, Tuple, Union import logging import os @@ -146,7 +146,7 @@ def _load_dataset( load_path = builder if builder else data_path try: - return datasets.load_dataset(path=load_path, **load_kwargs) + return datasets.load_dataset(load_path, **load_kwargs) except DatasetNotFoundError as e: # Reraise with a more context-specific message if needed raise e @@ -452,10 +452,9 @@ def split_dataset( ) return split_datasets - def _process_dataset_configs( + def _prepare_processed_datasets( self, dataset_configs: List[DataSetConfig] - ) -> Union[Dataset, IterableDataset]: - + ) -> List[Tuple[DataSetConfig, Union[IterableDataset, Dataset]]]: if not dataset_configs: raise ValueError( "No dataset configs provided. Provided Dataset configs is None." @@ -504,6 +503,34 @@ def _process_dataset_configs( # Append the processed datasets to the final dict processed_datasets.append((d, raw_datasets)) + return processed_datasets + + def _validate_sampling_ratios(self, sampling_ratios: List[float], train_datasets): + if len(sampling_ratios) > 0: + if len(sampling_ratios) < len(train_datasets): + raise ValueError( + "Sampling probability should be specified for all datasets with train split" + ) + if len(sampling_ratios) > len(train_datasets): + raise ValueError( + "Sampling probability should only be specified for datasets with train split" + ) + if sum(p for p in sampling_ratios) != 1: + raise ValueError( + "Sampling probabilities for train datasets don't sum to 1" + ) + return True + + def _process_dataset_configs( + self, dataset_configs: List[DataSetConfig] + ) -> Tuple[ + Union[Dataset, IterableDataset], + Union[Dataset, IterableDataset], + Dict[str, float], + ]: + train_split = "train" # default + eval_split = "test" + processed_datasets = self._prepare_processed_datasets(dataset_configs) train_datasets = [] train_sampling_probabilities = [] @@ -525,25 +552,9 @@ def _process_dataset_configs( ) # quick check to see if we are sampling and if we need to throw error. - if len(train_sampling_probabilities) > 0: - if len(train_sampling_probabilities) < len(train_datasets): - raise ValueError( - "Sampling probability should be specified for all datasets with train split" - ) - if len(train_sampling_probabilities) > len(train_datasets): - raise ValueError( - "Sampling probability should only be specified for datasets with train split" - ) - if sum(p for p in train_sampling_probabilities) != 1: - raise ValueError( - "Sampling probabilities for train datasets don't sum to 1" - ) - sample_datasets = True - logger.info( - "Sampling ratios are specified; only train datasets will be interleaved." - ) - else: - sample_datasets = False + sample_datasets = self._validate_sampling_ratios( + train_sampling_probabilities, train_datasets + ) # Ensure again datasets are aligned before interleaving or concatenating maybe_align_datasets(train_datasets) @@ -588,11 +599,15 @@ def _process_dataset_configs( if eval_dataset and isinstance(eval_dataset, IterableDataset): eval_dataset = resolve_iterable_dataset_features(eval_dataset) - return train_dataset, eval_dataset + return train_dataset, eval_dataset, None def process_dataset_configs( self, dataset_configs: List[DataSetConfig] - ) -> Union[Dataset, IterableDataset]: + ) -> Tuple[ + Union[Dataset, IterableDataset], + Union[Dataset, IterableDataset], + Dict[str, float], + ]: train_dataset = eval_dataset = None # Use partial state as recommended by HF documentation for process control @@ -605,12 +620,43 @@ def process_dataset_configs( # as we want to reuse HF cache and not redo computation on all nodes # For rationale see https://github.com/huggingface/trl/pull/3106 with state.main_process_first(): - train_dataset, eval_dataset = self._process_dataset_configs(dataset_configs) + ( + train_dataset, + eval_dataset, + sampling_weights, + ) = self._process_dataset_configs(dataset_configs) logger.info("Processed train dataset {}".format(train_dataset)) logger.info("Processed eval dataset {}".format(eval_dataset)) - return train_dataset, eval_dataset + return train_dataset, eval_dataset, sampling_weights + + +class ODMDataPreProcessor(DataPreProcessor): + def _process_dataset_configs( + self, dataset_configs: List[DataSetConfig] + ) -> Tuple[ + Dict[str, Union[Dataset, IterableDataset]], + Dict[str, Union[Dataset, IterableDataset]], + Dict[str, float], + ]: + processed_datasets = self._prepare_processed_datasets(dataset_configs) + train_split = "train" + eval_split = "test" + train_datasets_dict = {} + eval_datasets_dict = {} + sampling_weights_dict = {} + for d, raw in processed_datasets: + if d.sampling is not None and d.sampling > 0.0: + sampling_weights_dict[d.name] = d.sampling + if train_split in raw: + train_datasets_dict[d.name] = raw[train_split] + if eval_split in raw: + eval_datasets_dict[d.name] = raw[eval_split] + self._validate_sampling_ratios( + sampling_weights_dict.values(), train_datasets_dict.values() + ) + return train_datasets_dict, eval_datasets_dict, sampling_weights_dict def get_datapreprocessor( @@ -619,7 +665,10 @@ def get_datapreprocessor( processor: AutoProcessor = None, additional_data_handlers: Dict[str, DataHandler] = None, ) -> DataPreProcessor: - data_processor = DataPreProcessor( + data_processor_cls = DataPreProcessor + if processor_config.type == "odm": + data_processor_cls = ODMDataPreProcessor + data_processor = data_processor_cls( processor_config=processor_config, tokenizer=tokenizer, processor=processor, diff --git a/tuning/data/setup_dataprocessor.py b/tuning/data/setup_dataprocessor.py index 0dd1bd7d6..bc2f84315 100644 --- a/tuning/data/setup_dataprocessor.py +++ b/tuning/data/setup_dataprocessor.py @@ -14,7 +14,7 @@ # Standard from pathlib import Path -from typing import Dict, Union +from typing import Dict, List, Union import logging # Third Party @@ -24,6 +24,7 @@ from transformers import AutoProcessor, AutoTokenizer # Local +from tuning.config.acceleration_configs.odm import ODMConfig from tuning.config.configs import DataArguments, TrainingArguments from tuning.data.data_config import ( DataHandlerConfig, @@ -34,6 +35,7 @@ from tuning.data.data_handlers import DataHandler from tuning.data.data_preprocessing_utils import get_data_collator from tuning.data.data_processors import get_datapreprocessor +from tuning.utils.import_utils import is_fms_accelerate_available logger = logging.getLogger(__name__) @@ -87,11 +89,12 @@ def process_dataconfig_file( is_multipack: A bool representing is Multipack plugin is enabled. Defauts to False. Returns: - Tuple(Dataset, Dataset, str) + Tuple(Dataset, Dataset, str, Dict[str, float]) tuple containing train_dataset (Dataset/IterableDataset), eval_dataset (Dataset/IterableDataset), dataset_text_field (str), + sampling weights """ data_config = load_and_validate_data_config(data_args.data_config_path) @@ -151,15 +154,19 @@ def process_dataconfig_file( ) tokenizer.chat_template = data_processor.processor_config.chat_template - train_dataset, eval_dataset = data_processor.process_dataset_configs( - data_config.datasets - ) + ( + train_dataset, + eval_dataset, + sampling_weights, + ) = data_processor.process_dataset_configs(data_config.datasets) - return (train_dataset, eval_dataset, data_args.dataset_text_field) + return (train_dataset, eval_dataset, data_args.dataset_text_field, sampling_weights) # Data Format 1: Pretokenized Data -def _get_pretokenized_dataset_handlers(data_args, is_eval_tokenized): +def _get_pretokenized_dataset_handlers( + data_args: DataArguments, is_eval_present, is_eval_tokenized +): # if the provided train dataset is pretokenized # however user provides formatting flags, error out @@ -168,6 +175,7 @@ def _get_pretokenized_dataset_handlers(data_args, is_eval_tokenized): or data_args.data_formatter_template or data_args.dataset_text_field or data_args.instruction_template + or data_args.dataset_conversation_field ): raise ValueError( "fields response_template, data_formatter_template," @@ -177,7 +185,7 @@ def _get_pretokenized_dataset_handlers(data_args, is_eval_tokenized): # if the train dataset is pretokenized # ensure validation dataset is pretokenized otherwise error out - if is_eval_tokenized: + if is_eval_present and not is_eval_tokenized: raise ValueError( "validation data should be pretokenized to be used \ along with pretokenized train data" @@ -189,7 +197,9 @@ def _get_pretokenized_dataset_handlers(data_args, is_eval_tokenized): ### Data format 2 # pylint: disable=unused-argument -def _get_dataset_formatting_handlers(data_args, packing, is_padding_free=False): +def _get_dataset_formatting_handlers( + data_args: DataArguments, packing, is_padding_free=False +): if data_args.response_template is None: if packing is False: @@ -253,7 +263,7 @@ def _get_chat_dataset_handlers(data_args, tokenizer_kwargs): fn_kwargs["formatted_text_column_name"] = data_args.dataset_text_field fn_kwargs["tokenizer_kwargs"] = tokenizer_kwargs if data_args.dataset_conversation_field is not None: - fn_kwargs["conversation_column"] = data_args.dataset_conversation_field + fn_kwargs["conversation_column_name"] = data_args.dataset_conversation_field kwargs = {"fn_kwargs": fn_kwargs, "batched": False, "remove_columns": "all"} @@ -284,14 +294,14 @@ def _get_default_dataset_handlers(data_args, tokenizer_kwargs): ### Vsion Data Format -def _get_vision_dataset_handlers(data_args, processor_kwargs): +def _get_vision_dataset_handlers(data_args: DataArguments, processor_kwargs): handlers = [] # First data handler configuration handler_fn_kwargs1 = { - "dataset_text_field": data_args.dataset_text_field, - "conversation_column": data_args.dataset_text_field, + "formatted_text_column_name": data_args.dataset_text_field, + "conversation_column_name": data_args.dataset_conversation_field, } handler_kwargs1 = { "fn_kwargs": handler_fn_kwargs1, @@ -403,7 +413,7 @@ def _process_raw_data_args( if is_traindata_tokenized: # Data Format 1: Pretokenized Data handlers, dataset_text_field = _get_pretokenized_dataset_handlers( - data_args, (is_eval_dataset_present and not is_evaldata_tokenized) + data_args, is_eval_dataset_present, is_evaldata_tokenized ) elif processor and data_args.dataset_text_field and data_args.dataset_image_field: @@ -438,11 +448,13 @@ def _process_raw_data_args( if is_eval_dataset_present: dataset_configs.append(eval_dataset_config) - train_dataset, eval_dataset = data_processor.process_dataset_configs( - dataset_configs - ) + ( + train_dataset, + eval_dataset, + sampling_weights, + ) = data_processor.process_dataset_configs(dataset_configs) - return (train_dataset, eval_dataset, dataset_text_field) + return (train_dataset, eval_dataset, dataset_text_field, sampling_weights) def dump_dataset( @@ -486,6 +498,73 @@ def dump_dataset( raise RuntimeError(f"Failed to dump dataset due to error {e}") from e +def setup_train_dataset_for_odm( + data_args: DataArguments, + tokenizer: AutoTokenizer, + train_args: TrainingArguments, + is_padding_free: bool = False, + processor: AutoProcessor = None, + odm_config: ODMConfig = None, + train_dataset: Dict = None, + reward_dataset: Dict = None, # eval_dataset is used for reward computation + max_seq_length: str = None, + sampling_weights: List[float] = None, # cold start sampling weights for ODM +): + # pylint: disable=import-outside-toplevel + if not is_fms_accelerate_available(plugins="odm"): + raise ImportError( + "use of odm data config feature requires" + "installation of fms_acceleration_odm package" + ) + # Third Party + # pylint: disable=import-error + from fms_acceleration_odm import OnlineMixingDataset + + collators = {} + eval_collators = {} + for k, v in train_dataset.items(): + is_tokenized_dataset = is_pretokenized_dataset(v) + collators[k] = get_data_collator( + train_args.packing, + data_args.response_template, + tokenizer, + is_tokenized_dataset, + max_seq_length, + data_args.instruction_template, + is_padding_free=is_padding_free, + processor=processor, + ) + data_collator = collators[k] + for k, v in reward_dataset.items(): + is_tokenized_dataset = is_pretokenized_dataset(v) + eval_collators[k] = get_data_collator( + train_args.packing, + data_args.response_template, + tokenizer, + is_tokenized_dataset, + max_seq_length, + data_args.instruction_template, + is_padding_free=is_padding_free, + processor=processor, + ) + + train_dataset = OnlineMixingDataset( + train_dataset, + collators, + reward_dataset, + eval_collators, + sampling_weights, + gamma=odm_config.odm.gamma, + eta=odm_config.odm.eta, + output_dir=train_args.output_dir, + sampling_interval=odm_config.odm.sampling_interval, + eval_batch_size=train_args.per_device_eval_batch_size, + reward_type=odm_config.odm.reward_type, + ) + train_args.accelerator_config = {"split_batches": True} + return (True, train_dataset, data_collator) + + # If a data config file is provided, load it to get the training dataset. # - Assumes only the training dataset is specified in the config file. # - Expects a complete and valid data config file from the user. @@ -500,6 +579,7 @@ def process_dataargs( is_padding_free: bool = False, processor: AutoProcessor = None, is_multipack: bool = False, + odm_config: ODMConfig = None, ): """ Args: @@ -551,7 +631,12 @@ def process_dataargs( ) if data_args.data_config_path: - train_dataset, eval_dataset, dataset_text_field = process_dataconfig_file( + ( + train_dataset, + eval_dataset, + dataset_text_field, + sampling_weights, + ) = process_dataconfig_file( data_args, train_args, tokenizer, @@ -561,7 +646,12 @@ def process_dataargs( is_padding_free, ) else: - train_dataset, eval_dataset, dataset_text_field = _process_raw_data_args( + ( + train_dataset, + eval_dataset, + dataset_text_field, + sampling_weights, + ) = _process_raw_data_args( data_args, tokenizer, train_args.packing, @@ -605,23 +695,41 @@ def process_dataargs( ) return (train_dataset, eval_dataset, None, None, None, None) - # Note: This check should not be removed. - # Its important to recompute this post handling to - # check if we already tokenized the dataset or not. - is_tokenized_dataset = is_pretokenized_dataset(train_dataset or eval_dataset) - - data_collator = get_data_collator( - train_args.packing, - data_args.response_template, - tokenizer, - is_tokenized_dataset, - max_seq_length, - data_args.instruction_template, - is_padding_free=is_padding_free, - processor=processor, - ) - dataset_kwargs = {} + data_collator = None + if odm_config: + ( + dataset_kwargs["skip_prepare_dataset"], + train_dataset, + data_collator, + ) = setup_train_dataset_for_odm( + data_args, + tokenizer, + train_args, + is_padding_free, + processor, + odm_config, + train_dataset, + eval_dataset, + max_seq_length, + sampling_weights, + ) + else: + # Note: This check should not be removed. + # Its important to recompute this post handling to + # check if we already tokenized the dataset or not. + is_tokenized_dataset = is_pretokenized_dataset(train_dataset or eval_dataset) + data_collator = get_data_collator( + train_args.packing, + data_args.response_template, + tokenizer, + is_tokenized_dataset, + max_seq_length, + data_args.instruction_template, + is_padding_free=is_padding_free, + processor=processor, + ) + # For vision model tuning prepare_dataset is skipped. if processor is not None: dataset_kwargs["skip_prepare_dataset"] = True diff --git a/tuning/sft_trainer.py b/tuning/sft_trainer.py index 3a23d99e3..fd759229c 100644 --- a/tuning/sft_trainer.py +++ b/tuning/sft_trainer.py @@ -42,14 +42,17 @@ # Local from tuning.config import configs, peft_config from tuning.config.acceleration_configs import ( + ODM, AccelerationFrameworkConfig, AttentionAndDistributedPackingConfig, FastMoeConfig, FusedOpsAndKernelsConfig, + ODMConfig, QuantizedLoraConfig, get_additional_accel_framework_callbacks, ) from tuning.config.tracker_configs import TrackerConfigs +from tuning.data.data_config import load_and_validate_data_config from tuning.data.data_handlers import DataHandler from tuning.data.setup_dataprocessor import process_dataargs from tuning.data.tokenizer_utils import setup_tokenizer @@ -71,9 +74,10 @@ def train( data_args: configs.DataArguments, train_args: configs.TrainingArguments, peft_config: Optional[ # pylint: disable=redefined-outer-name - Union[peft_config.LoraConfig, LoraConfig, peft_config.PromptTuningConfig] + Union[LoraConfig, peft_config.PromptTuningConfig] ] = None, - trainer_controller_args: configs.TrainerControllerArguments = None, + quantization_config: Optional[peft_config.Mxfp4Config] = None, + trainer_controller_args: TrainerControllerCallback = None, tracker_configs: Optional[TrackerConfigs] = TrackerConfigs(), additional_callbacks: Optional[List[TrainerCallback]] = None, exp_metadata: Optional[Dict] = None, @@ -91,11 +95,11 @@ def train( model_args: tuning.config.configs.ModelArguments data_args: tuning.config.configs.DataArguments train_args: tuning.config.configs.TrainingArguments - peft_config: peft_config.LoraConfig for Lora tuning | \ - LoraConfig (peft.LoraConfig): for activated Lora (aLoRA) tuning | \ + peft_config: LoraConfig (peft.LoraConfig): for activated Lora (aLoRA) tuning | \ peft_config.PromptTuningConfig for prompt tuning | \ - None for fine tuning + None for full fine tuning The peft configuration to pass to trainer + peft_config.mxfp4config for working with MXFP4 quantized models \ trainer_control_args: configs.TrainerControllerArguments \ for controlling the training loop using policy rules tracker_configs: An instance of tuning.config.tracker_configs.TrackerConfigs \ @@ -108,7 +112,8 @@ def train( tracker with automatically be added. exp_metadata: Dict of key value pairs passed to train to be recoreded by the tracker. quantized_lora_config: tuning.config.acceleration_configs.QuantizedLoraConfig \ - Should be used in combination with peft_config.LoraConfig for Lora tuning \ + Should be used in combination with LoraConfig for Lora tuning \ + https://huggingface.co/docs/peft/en/package_reference/lora#peft.LoraConfig \ fusedops_kernels_config: tuning.config.acceleration_configs.FusedOpsAndKernelsConfig \ Should be used in combination with quantized_lora_config. Also currently fused_lora and fast_kernels must used together (may change in future). \ @@ -123,18 +128,38 @@ def train( logger, train_args.log_level = set_log_level( logger_name="sft_trainer_train", level=train_args.log_level ) - USE_ALORA = False - try: - # Third Party - from alora.config import aLoraConfig # pylint: disable=import-outside-toplevel - from alora.peft_model_alora import ( # pylint: disable=import-outside-toplevel - aLoRAPeftModelForCausalLM, + + resume_from_checkpoint = None + if train_args.output_dir: + os.makedirs(train_args.output_dir, exist_ok=True) + logger.info("using the output directory at %s", train_args.output_dir) + + # Check if resume flag is not passed (None), or if flag is true and + # output_dir has checkpoints then get last checkpoint from output_dir + if ( + train_args.resume_from_checkpoint is None + or train_args.resume_from_checkpoint.lower() == "true" + ): + resume_from_checkpoint = get_last_checkpoint(train_args.output_dir) + else: + # `train_args.resume_from_checkpoint` gives string values + # Check if flag is false OR flag has checkpoint value for resuming tuning + resume_from_checkpoint = ( + train_args.resume_from_checkpoint + if train_args.resume_from_checkpoint.lower() != "false" + else False ) - if isinstance(peft_config, aLoraConfig): - USE_ALORA = True - except ImportError: - pass + # TODO: use of load_and_validate_data_config here is not clean way + # rather we should move this logic to process_dataargs + odm_config = None + if data_args.data_config_path: + _dataconfig = load_and_validate_data_config(data_args.data_config_path) + if _dataconfig.dataprocessor.type == "odm": + _dataconfig.dataprocessor.odm[ + "resume_from_checkpoint" + ] = resume_from_checkpoint + odm_config = ODMConfig(odm=ODM(**_dataconfig.dataprocessor.odm)) # Validate parameters if (not isinstance(model_args.model_name_or_path, str)) or ( @@ -221,15 +246,6 @@ def train( trainer_callbacks.append(cb) trackers.append(t) - # Now add trainer controller callbacks if requested - if (trainer_controller_args is not None) and ( - trainer_controller_args.trainer_controller_config_file is not None - ): - tc_callback = TrainerControllerCallback( - trainer_controller_args.trainer_controller_config_file, - ) - trainer_callbacks.append(tc_callback) - # Add any extra callback if passed by users if additional_callbacks is not None: for cb in additional_callbacks: @@ -244,6 +260,7 @@ def train( attention_and_distributed_packing_config, quantized_lora_config, fusedops_kernels_config, + odm_config, ).get_framework() # option to set multimodal var here @@ -253,25 +270,31 @@ def train( model_load_time = time.time() try: - logger.info("Trying to load the model {}".format(model_args.model_name_or_path)) + model_kwargs = dict( # pylint: disable=use-dict-literal + cache_dir=train_args.cache_dir, + torch_dtype=get_torch_dtype(model_args.torch_dtype), + attn_implementation=model_args.flash_attn_implementation + if model_args.use_flash_attn + else None, + ) + if quantization_config is not None: + model_kwargs["quantization_config"] = quantization_config.to_hf_config() + + logger.info("Loading the model {} now".format(model_args.model_name_or_path)) try: + logger.info( + "Trying to load {} as vision model".format( + model_args.model_name_or_path + ) + ) # try to load model as a vision model - model_loader = AutoModelForVision2Seq.from_pretrained - - model = model_loader( - model_args.model_name_or_path, - cache_dir=train_args.cache_dir, - torch_dtype=get_torch_dtype(model_args.torch_dtype), - attn_implementation="flash_attention_2" - if model_args.use_flash_attn - else None, + model = AutoModelForVision2Seq.from_pretrained( + model_args.model_name_or_path, **model_kwargs ) try: if "use_cache" in model.language_model.config: # avoid warning that use_cache is incompatible with gradient checkpointing - model.language_model.config.use_cache = ( - not train_args.gradient_checkpointing - ) + model.language_model.config.use_cache = False except AttributeError as e: # When the model doesn't have the use_cache attribute logger.warning("Couldn't update use_cache for vision model: %s", e) @@ -282,13 +305,23 @@ def train( logger.info("Loaded vision model as {} ".format(model)) logger.info("Loaded vision model processor {} ".format(processor)) logger.info("Loaded model tokenizer {} ".format(tokenizer)) - except ValueError: + except Exception as e: # pylint: disable=broad-except + logger.info( + "Couldn't load model {} as a vision model due to {} ".format( + model_args.model_name_or_path, e + ) + ) model = None processor = None tokenizer = None # fallback on loading language model if model is None: + logger.info( + "Trying to load {} as language model".format( + model_args.model_name_or_path + ) + ) # find the correct model loader if framework is not None and framework.requires_custom_loading: model_loader = framework.model_loader @@ -296,14 +329,7 @@ def train( model_loader = AutoModelForCausalLM.from_pretrained model = model_loader( - model_args.model_name_or_path, - cache_dir=train_args.cache_dir, - torch_dtype=get_torch_dtype(model_args.torch_dtype), - attn_implementation="flash_attention_2" - if model_args.use_flash_attn - else None, - # avoid warning that use_cache is incompatible with gradient checkpointing - use_cache=(not train_args.gradient_checkpointing), + model_args.model_name_or_path, use_cache=False, **model_kwargs ) # TODO: Move these to a config as well @@ -327,6 +353,20 @@ def train( # Calculate and save additional metrics to track later. additional_metrics["model_load_time"] = time.time() - model_load_time + # Convert legacy aLoRA string → token IDs (PEFT-native aLoRA) + if peft_config is not None and hasattr(peft_config, "alora_invocation_string"): + inv_str = getattr(peft_config, "alora_invocation_string") + if not inv_str: + raise ValueError( + "`--alora_invocation_string` is required when using --peft_method alora." + ) + alora_tokens = tokenizer.encode(inv_str, add_special_tokens=False) + if not alora_tokens: + raise ValueError( + "`--alora_invocation_string` produced no tokens; check your tokenizer/template." + ) + setattr(peft_config, "alora_invocation_tokens", alora_tokens) + peft_config = get_hf_peft_config( task_type, peft_config, @@ -365,6 +405,7 @@ def train( is_padding_free=is_padding_free, processor=processor, is_multipack=is_multipack, + odm_config=odm_config, ) additional_metrics["data_preprocessing_time"] = ( time.time() - data_preprocessing_time @@ -374,7 +415,7 @@ def train( logger.info( "Only data processing was requested. Exiting Process.", ) - return None, None + return None, None, None if framework is not None and framework.requires_augmentation: model, (peft_config,) = framework.augmentation( @@ -414,21 +455,6 @@ def train( } training_args = SFTConfig(**transformer_kwargs, **additional_args) - # activated LoRA - if USE_ALORA: - response_token_ids = ( - tokenizer( - peft_config.invocation_string, - return_tensors="pt", - add_special_tokens=False, - ) - )["input_ids"] - model = aLoRAPeftModelForCausalLM( - model, peft_config, response_token_ids=response_token_ids - ) - - peft_config = None - if train_args.enable_reduce_loss_sum: TrainerClass = SumLossSFTTrainer else: @@ -465,6 +491,8 @@ def train( model ) + # Register fms-acceleration callbacks before Trainer Controller + # so that on_save() runs earlier for proper model unwrapping and checkpoint handling if framework is not None: accelerator = None if not is_accelerate_available() else trainer.accelerator @@ -479,22 +507,14 @@ def train( ): trainer.add_callback(clb) - resume_from_checkpoint = None - # Check if resume flag is not passed (None), or if flag is true and - # output_dir has checkpoints then get last checkpoint from output_dir - if ( - training_args.resume_from_checkpoint is None - or training_args.resume_from_checkpoint.lower() == "true" + if (trainer_controller_args is not None) and ( + trainer_controller_args.trainer_controller_config_file is not None ): - resume_from_checkpoint = get_last_checkpoint(training_args.output_dir) - else: - # `training_args.resume_from_checkpoint` gives string values - # Check if flag is false OR flag has checkpoint value for resuming tuning - resume_from_checkpoint = ( - training_args.resume_from_checkpoint - if training_args.resume_from_checkpoint.lower() != "false" - else False + tc_callback = TrainerControllerCallback( + trainer_controller_args.trainer_controller_config_file, ) + tc_callback.on_init_end(trainer.args, trainer.state, trainer.control) + trainer.add_callback(tc_callback) trainer.train(resume_from_checkpoint) additional_metadata = {} @@ -542,6 +562,7 @@ def get_parser(): configs.TrainerControllerArguments, peft_config.LoraConfig, peft_config.PromptTuningConfig, + peft_config.Mxfp4Config, QuantizedLoraConfig, FusedOpsAndKernelsConfig, AttentionAndDistributedPackingConfig, @@ -552,7 +573,13 @@ def get_parser(): parser.add_argument( "--peft_method", type=str.lower, - choices=["pt", "lora", "alora", None, "none"], + choices=[m.value for m in peft_config.PEFT_METHOD] + [None, "none"], + default="none", + ) + parser.add_argument( + "--quantization_method", + type=str.lower, + choices=[m.value for m in peft_config.QUANT_METHOD] + [None, "none"], default="none", ) parser.add_argument( @@ -563,7 +590,7 @@ def get_parser(): to the tuning run in the tracker. e.g. \'{"gpu":"A100-80G"}\'', ) parser.add_argument( - "--invocation_string", + "--alora_invocation_string", type=str, default=None, help="Pass a invocation string that will be used to activate the aLoRA.\ @@ -592,6 +619,8 @@ def parse_arguments(parser, json_config=None): Configuration for custom trainer controller such as early stopping or dynamic scaling. PromptTuningConfig/LoraConfig/aLoRAConfig/None Configuration for running PEFT, different depending on type of PEFT. + Mxfp4Config + Configuration for using Mxfp4Quantized models QuantizedLoraConfig Configuration for quantized LoRA (a form of PEFT). FusedOpsAndKernelsConfig @@ -614,6 +643,7 @@ def parse_arguments(parser, json_config=None): trainer_controller_args, lora_config, prompt_tuning_config, + mxfp4config, quantized_lora_config, fusedops_kernels_config, attention_and_distributed_packing_config, @@ -622,12 +652,8 @@ def parse_arguments(parser, json_config=None): ) = parser.parse_dict(json_config, allow_extra_keys=True) peft_method = json_config.get("peft_method") exp_metadata = json_config.get("exp_metadata") - invocation_string = json_config.get("invocation_string") - if peft_method == "alora": - if invocation_string is None: - raise ValueError( - "invocation_string is not passed required for aLoRA usage" - ) + quantization_method = json_config.get("quantization_method") + alora_invocation_string = json_config.get("alora_invocation_string") else: ( model_args, @@ -636,6 +662,7 @@ def parse_arguments(parser, json_config=None): trainer_controller_args, lora_config, prompt_tuning_config, + mxfp4config, quantized_lora_config, fusedops_kernels_config, attention_and_distributed_packing_config, @@ -647,40 +674,31 @@ def parse_arguments(parser, json_config=None): peft_method = additional.peft_method exp_metadata = additional.exp_metadata - invocation_string = additional.invocation_string - if peft_method == "alora": - if invocation_string is None: - raise ValueError( - "invocation_string is not passed required for aLoRA usage" - ) - if peft_method == "alora": - try: - # Third Party - from alora.config import ( # pylint: disable=import-outside-toplevel - aLoraConfig, - ) - except ImportError as exc: - raise ImportError( - "The alora package is required for this operation. " - "Please install it with pip install alora." - ) from exc - if peft_method == "lora": + quantization_method = additional.quantization_method + alora_invocation_string = additional.alora_invocation_string + + if peft_method == peft_config.PEFT_METHOD.ALORA.value: tune_config = lora_config - elif peft_method == "alora": - tune_config = aLoraConfig( - **vars(lora_config), invocation_string=invocation_string - ) - elif peft_method == "pt": + setattr(tune_config, "alora_invocation_string", alora_invocation_string) + elif peft_method == peft_config.PEFT_METHOD.LORA.value: + tune_config = lora_config + elif peft_method == peft_config.PEFT_METHOD.PT.value: tune_config = prompt_tuning_config else: tune_config = None + if quantization_method == peft_config.QUANT_METHOD.MXFP4.value: + quantization_config = mxfp4config + else: + quantization_config = None + return ( model_args, data_args, training_args, trainer_controller_args, tune_config, + quantization_config, quantized_lora_config, fusedops_kernels_config, attention_and_distributed_packing_config, @@ -702,6 +720,7 @@ def main(): training_args, trainer_controller_args, tune_config, + quantization_config, quantized_lora_config, fusedops_kernels_config, attention_and_distributed_packing_config, @@ -722,13 +741,14 @@ def main(): "Data Arguments": data_args, "Training Arguments": training_args, "Tune Config": tune_config, + "Quantization Config": quantization_config, "QLoRA Config": quantized_lora_config, - "Tracker Config": tracker_configs, "AADP (fms-acceleration) Config": attention_and_distributed_packing_config, "Fused Ops Kernels Config": fusedops_kernels_config, "Fast MoE Config": fast_moe_config, - "Trainer Controller Config": trainer_controller_args, + "Tracker Config": tracker_configs, "Extra Metadata": exp_metadata, + "Trainer Controller Config": trainer_controller_args, } ) logger.info(args_dump) @@ -755,15 +775,13 @@ def main(): "failed while parsing extra metadata. pass a valid json %s", repr(e) ) - if training_args.output_dir: - os.makedirs(training_args.output_dir, exist_ok=True) - logger.info("using the output directory at %s", training_args.output_dir) try: trainer, additional_train_info, tc_callback = train( model_args=model_args, data_args=data_args, train_args=training_args, peft_config=tune_config, + quantization_config=quantization_config, trainer_controller_args=trainer_controller_args, tracker_configs=tracker_configs, additional_callbacks=None, @@ -819,9 +837,7 @@ def main(): ) sys.exit(INTERNAL_ERROR_EXIT_CODE) - if isinstance( - tune_config, (peft_config.LoraConfig, LoraConfig) - ): # aLoraConfig subclasses LoraConfig + if isinstance(tune_config, LoraConfig): try: if training_args.save_model_dir: # Write number of added tokens to artifacts diff --git a/tuning/trainercontroller/callback.py b/tuning/trainercontroller/callback.py index b0c286251..89ab4df93 100644 --- a/tuning/trainercontroller/callback.py +++ b/tuning/trainercontroller/callback.py @@ -585,6 +585,15 @@ def on_save( kwargs["path"] = f"{args.output_dir}/checkpoint-{state.global_step}" if "is_final" not in kwargs: kwargs["is_final"] = False + + base_path = kwargs["path"] + hf_converted_path = os.path.join(base_path, "hf_converted_checkpoint") + + if os.path.isdir(hf_converted_path): + kwargs["hf_path"] = hf_converted_path + else: + kwargs["hf_path"] = base_path + self._actions_on_event(event_name="on_save", **kwargs) def on_step_begin( diff --git a/tuning/trainercontroller/controllermetrics/per_process_state.py b/tuning/trainercontroller/controllermetrics/per_process_state.py index 58a96de37..1ceb24710 100644 --- a/tuning/trainercontroller/controllermetrics/per_process_state.py +++ b/tuning/trainercontroller/controllermetrics/per_process_state.py @@ -74,4 +74,4 @@ def compute(self, _: TrainerState = None, **kwargs) -> Any: """ if torch.distributed.is_available() and torch.distributed.is_initialized(): return {"rank": torch.distributed.get_rank()} - return {"rank": None} + return {"rank": 0} diff --git a/tuning/utils/config_utils.py b/tuning/utils/config_utils.py index 8bf02d0bf..806e593dc 100644 --- a/tuning/utils/config_utils.py +++ b/tuning/utils/config_utils.py @@ -20,7 +20,7 @@ import pickle # Third Party -from peft import LoraConfig, PromptTuningConfig +from peft import PromptTuningConfig as HFPromptTuningConfig # Local from tuning.config import peft_config @@ -41,7 +41,7 @@ def update_config(config, **kwargs): if hasattr(config, param_name): setattr(config, param_name, v) else: - # In case of specialized config we can warm user + # In case of specialized config we can warn user print(f"Warning: {config_name} does not accept parameter: {k}") @@ -50,7 +50,7 @@ def create_tuning_config(peft_method, **kwargs): Args: peft_method: str lora, pt or None - kawrgs: parameters to initialize library configs with + kwargs: parameters to initialize library configs with Return: peft_config.LoraConfig | peft_config.PromptTuningConfig | None """ @@ -61,22 +61,10 @@ def create_tuning_config(peft_method, **kwargs): "pt", "None", ], f"peft config {peft_method} not defined in peft.py" - if peft_method == "alora": - try: - # Third Party - from alora.config import ( # pylint: disable=import-outside-toplevel - aLoraConfig, - ) - - tune_config = aLoraConfig() - update_config(tune_config, **kwargs) - except ImportError as exc: - raise ImportError( - "alora package is required for this operation. " - "Please install it with pip install alora." - ) from exc - - elif peft_method == "lora": + if peft_method in ( + peft_config.PEFT_METHOD.ALORA.value, + peft_config.PEFT_METHOD.LORA.value, + ): tune_config = peft_config.LoraConfig() update_config(tune_config, **kwargs) elif peft_method == "pt": @@ -95,28 +83,24 @@ def get_hf_peft_config(task_type, tuning_config, tokenizer_name_or_path): tokenizer_name_or_path: str Return: HF PEFT config or None """ - USE_ALORA = False - try: - # Third Party - from alora.config import aLoraConfig # pylint: disable=import-outside-toplevel - - if isinstance(tuning_config, aLoraConfig): - USE_ALORA = True - except ImportError: - pass - if USE_ALORA: - alora_config = tuning_config - if alora_config.target_modules == ["all-linear"]: - alora_config.target_modules = "all-linear" - alora_config.task_type = task_type - hf_peft_config = alora_config - elif isinstance(tuning_config, peft_config.LoraConfig): - lora_config = asdict(tuning_config) - if lora_config["target_modules"] == ["all-linear"]: - lora_config["target_modules"] = "all-linear" - hf_peft_config = LoraConfig(task_type=task_type, **lora_config) - elif isinstance(tuning_config, peft_config.PromptTuningConfig): - hf_peft_config = PromptTuningConfig( + if isinstance(tuning_config, peft_config.LoraConfig): + if getattr(tuning_config, "target_modules", None) == ["all-linear"]: + tuning_config.target_modules = "all-linear" + + if getattr(tuning_config, "task_type", None) in (None, ""): + tuning_config.task_type = task_type + + if getattr(tuning_config, "alora_invocation_tokens", None): + if not tuning_config.alora_invocation_tokens: + raise ValueError("alora_invocation_tokens is set but empty.") + tuning_config.task_type = "CAUSAL_LM" + + if hasattr(tuning_config, "alora_invocation_string"): + delattr(tuning_config, "alora_invocation_string") + return tuning_config + + if isinstance(tuning_config, peft_config.PromptTuningConfig): + hf_peft_config = HFPromptTuningConfig( task_type=task_type, tokenizer_name_or_path=tokenizer_name_or_path, **asdict(tuning_config), diff --git a/tuning/utils/data_type_utils.py b/tuning/utils/data_type_utils.py index 52bae6d77..4d68832d0 100644 --- a/tuning/utils/data_type_utils.py +++ b/tuning/utils/data_type_utils.py @@ -52,6 +52,8 @@ def get_torch_dtype(dtype: Union[str, torch.dtype]) -> torch.dtype: # If a Torch dtype is passed, nothing to do if isinstance(dtype, torch.dtype): return dtype + if dtype == "auto": + return dtype # TODO - If None/empty str was provided, read it from model config? # Otherwise convert it from a string return str_to_torch_dtype(dtype) diff --git a/tuning/utils/import_utils.py b/tuning/utils/import_utils.py index e01e55630..36dd606c6 100644 --- a/tuning/utils/import_utils.py +++ b/tuning/utils/import_utils.py @@ -32,11 +32,3 @@ def is_fms_accelerate_available( if not _is_package_available(n): return False return True - - -def is_alora_available(package_name: str = "alora"): - names = [package_name] - for n in names: - if not _is_package_available(n): - return False - return True