> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/gym/llms-full.txt.

# nemo_gym.hf_utils

## Module Contents

### Functions

| Name                                                                              | Description                                                |
| --------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [`check_jsonl_format`](#nemo_gym-hf_utils-check_jsonl_format)                     | Check for the presence of the expected keys in the dataset |
| [`create_huggingface_client`](#nemo_gym-hf_utils-create_huggingface_client)       | -                                                          |
| [`download_hf_dataset_as_jsonl`](#nemo_gym-hf_utils-download_hf_dataset_as_jsonl) | Download a HF dataset and save as JSONL.                   |
| [`upload_jsonl_dataset`](#nemo_gym-hf_utils-upload_jsonl_dataset)                 | -                                                          |

### API

<Anchor id="nemo_gym-hf_utils-check_jsonl_format">
  <CodeBlock showLineNumbers={false} wordWrap={true}>
    ```python
    nemo_gym.hf_utils.check_jsonl_format(
        file_path: str
    ) -> bool
    ```
  </CodeBlock>
</Anchor>

<Indent>
  Check for the presence of the expected keys in the dataset
</Indent>

<Anchor id="nemo_gym-hf_utils-create_huggingface_client">
  <CodeBlock showLineNumbers={false} wordWrap={true}>
    ```python
    nemo_gym.hf_utils.create_huggingface_client(
        token: str
    ) -> huggingface_hub.HfApi
    ```
  </CodeBlock>
</Anchor>

<Indent />

<Anchor id="nemo_gym-hf_utils-download_hf_dataset_as_jsonl">
  <CodeBlock links={{"nemo_gym.config_types.DownloadJsonlDatasetHuggingFaceConfig":"/nemo-gym/nemo_gym/config_types#nemo_gym-config_types-DownloadJsonlDatasetHuggingFaceConfig"}} showLineNumbers={false} wordWrap={true}>
    ```python
    nemo_gym.hf_utils.download_hf_dataset_as_jsonl(
        config: nemo_gym.config_types.DownloadJsonlDatasetHuggingFaceConfig
    ) -> None
    ```
  </CodeBlock>
</Anchor>

<Indent>
  Download a HF dataset and save as JSONL.
  If `artifact_fpath` is provided, downloads that specific file using `hf_hub_download`.
  Otherwise, uses datasets.load\_dataset() to handle structured datasets.
</Indent>

<Anchor id="nemo_gym-hf_utils-upload_jsonl_dataset">
  <CodeBlock links={{"nemo_gym.config_types.UploadJsonlDatasetHuggingFaceConfig":"/nemo-gym/nemo_gym/config_types#nemo_gym-config_types-UploadJsonlDatasetHuggingFaceConfig"}} showLineNumbers={false} wordWrap={true}>
    ```python
    nemo_gym.hf_utils.upload_jsonl_dataset(
        config: nemo_gym.config_types.UploadJsonlDatasetHuggingFaceConfig
    ) -> None
    ```
  </CodeBlock>
</Anchor>

<Indent />