text stringlengths 7 324k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 463 |
|---|---|---|---|
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# 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 requir... | transformers/tests/models/megatron_gpt2/test_modeling_megatron_gpt2.py/0 | {
"file_path": "transformers/tests/models/megatron_gpt2/test_modeling_megatron_gpt2.py",
"repo_id": "transformers",
"token_count": 1284
} | 384 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# 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 requir... | transformers/tests/models/openai/test_modeling_openai.py/0 | {
"file_path": "transformers/tests/models/openai/test_modeling_openai.py",
"repo_id": "transformers",
"token_count": 5455
} | 385 |
# coding=utf-8
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 requir... | transformers/tests/models/pop2piano/test_tokenization_pop2piano.py/0 | {
"file_path": "transformers/tests/models/pop2piano/test_tokenization_pop2piano.py",
"repo_id": "transformers",
"token_count": 7905
} | 386 |
from __future__ import annotations
import json
import os
import shutil
import tempfile
import unittest
from unittest.mock import patch
import numpy as np
from transformers import BartTokenizer
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES as DPR_VOCAB_FILES_NAMES
from transformers.models.d... | transformers/tests/models/rag/test_modeling_tf_rag.py/0 | {
"file_path": "transformers/tests/models/rag/test_modeling_tf_rag.py",
"repo_id": "transformers",
"token_count": 19806
} | 387 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# 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 r... | transformers/tests/models/rembert/test_modeling_tf_rembert.py/0 | {
"file_path": "transformers/tests/models/rembert/test_modeling_tf_rembert.py",
"repo_id": "transformers",
"token_count": 12938
} | 388 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# 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 r... | transformers/tests/models/roc_bert/test_modeling_roc_bert.py/0 | {
"file_path": "transformers/tests/models/roc_bert/test_modeling_roc_bert.py",
"repo_id": "transformers",
"token_count": 13598
} | 389 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | transformers/tests/models/seamless_m4t/test_processor_seamless_m4t.py/0 | {
"file_path": "transformers/tests/models/seamless_m4t/test_processor_seamless_m4t.py",
"repo_id": "transformers",
"token_count": 2078
} | 390 |
# coding=utf-8
# Copyright 2021-2023 HuggingFace Inc.
#
# 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 ... | transformers/tests/models/speecht5/test_feature_extraction_speecht5.py/0 | {
"file_path": "transformers/tests/models/speecht5/test_feature_extraction_speecht5.py",
"repo_id": "transformers",
"token_count": 8423
} | 391 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# 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 r... | transformers/tests/models/swin/test_modeling_swin.py/0 | {
"file_path": "transformers/tests/models/swin/test_modeling_swin.py",
"repo_id": "transformers",
"token_count": 8752
} | 392 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | transformers/tests/models/tvlt/test_processor_tvlt.py/0 | {
"file_path": "transformers/tests/models/tvlt/test_processor_tvlt.py",
"repo_id": "transformers",
"token_count": 1552
} | 393 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | transformers/tests/models/univnet/test_modeling_univnet.py/0 | {
"file_path": "transformers/tests/models/univnet/test_modeling_univnet.py",
"repo_id": "transformers",
"token_count": 5905
} | 394 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# 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 r... | transformers/tests/models/vision_text_dual_encoder/test_modeling_flax_vision_text_dual_encoder.py/0 | {
"file_path": "transformers/tests/models/vision_text_dual_encoder/test_modeling_flax_vision_text_dual_encoder.py",
"repo_id": "transformers",
"token_count": 6782
} | 395 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# 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 r... | transformers/tests/models/wav2vec2/test_modeling_tf_wav2vec2.py/0 | {
"file_path": "transformers/tests/models/wav2vec2/test_modeling_tf_wav2vec2.py",
"repo_id": "transformers",
"token_count": 17501
} | 396 |
# coding=utf-8
# Copyright 2022 HuggingFace Inc.
#
# 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 ag... | transformers/tests/models/whisper/test_feature_extraction_whisper.py/0 | {
"file_path": "transformers/tests/models/whisper/test_feature_extraction_whisper.py",
"repo_id": "transformers",
"token_count": 5032
} | 397 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# 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 requir... | transformers/tests/models/xlm/test_tokenization_xlm.py/0 | {
"file_path": "transformers/tests/models/xlm/test_tokenization_xlm.py",
"repo_id": "transformers",
"token_count": 1536
} | 398 |
# coding=utf-8
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 requir... | transformers/tests/models/xmod/test_modeling_xmod.py/0 | {
"file_path": "transformers/tests/models/xmod/test_modeling_xmod.py",
"repo_id": "transformers",
"token_count": 13214
} | 399 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | transformers/tests/pipelines/test_pipelines_document_question_answering.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_document_question_answering.py",
"repo_id": "transformers",
"token_count": 6554
} | 400 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | transformers/tests/pipelines/test_pipelines_text_to_audio.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_text_to_audio.py",
"repo_id": "transformers",
"token_count": 3815
} | 401 |
# coding=utf-8
# Copyright 2022 The HuggingFace Team Inc.
#
# 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/tests/quantization/bnb/test_mixed_int8.py/0 | {
"file_path": "transformers/tests/quantization/bnb/test_mixed_int8.py",
"repo_id": "transformers",
"token_count": 15675
} | 402 |
import argparse
import logging
import os
import sys
import time
import tensorflow as tf
from datasets import load_dataset
from tqdm import tqdm
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
from transformers.modeling_tf_utils import keras
from transformers.utils import is_sagemaker_dp_e... | transformers/tests/sagemaker/scripts/tensorflow/run_tf_dist.py/0 | {
"file_path": "transformers/tests/sagemaker/scripts/tensorflow/run_tf_dist.py",
"repo_id": "transformers",
"token_count": 3191
} | 403 |
# coding=utf-8
# Copyright 2019 HuggingFace Inc.
#
# 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 ag... | transformers/tests/test_modeling_tf_common.py/0 | {
"file_path": "transformers/tests/test_modeling_tf_common.py",
"repo_id": "transformers",
"token_count": 43519
} | 404 |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... | transformers/tests/tools/test_image_segmentation.py/0 | {
"file_path": "transformers/tests/tools/test_image_segmentation.py",
"repo_id": "transformers",
"token_count": 742
} | 405 |
# coding=utf-8
# Copyright 2018 the HuggingFace Inc. team.
#
# 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... | transformers/tests/trainer/test_trainer_utils.py/0 | {
"file_path": "transformers/tests/trainer/test_trainer_utils.py",
"repo_id": "transformers",
"token_count": 9624
} | 406 |
# coding=utf-8
# Copyright 2021 HuggingFace Inc.
#
# 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 ag... | transformers/tests/utils/test_image_utils.py/0 | {
"file_path": "transformers/tests/utils/test_image_utils.py",
"repo_id": "transformers",
"token_count": 13075
} | 407 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... | transformers/utils/check_doctest_list.py/0 | {
"file_path": "transformers/utils/check_doctest_list.py",
"repo_id": "transformers",
"token_count": 1179
} | 408 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... | transformers/utils/get_modified_files.py/0 | {
"file_path": "transformers/utils/get_modified_files.py",
"repo_id": "transformers",
"token_count": 448
} | 409 |
import torch
from transformers import PreTrainedModel
from .custom_configuration import CustomConfig, NoSuperInitConfig
class CustomModel(PreTrainedModel):
config_class = CustomConfig
def __init__(self, config):
super().__init__(config)
self.linear = torch.nn.Linear(config.hidden_size, conf... | transformers/utils/test_module/custom_modeling.py/0 | {
"file_path": "transformers/utils/test_module/custom_modeling.py",
"repo_id": "transformers",
"token_count": 289
} | 410 |
import json
import os
from ghapi.all import GhApi
FOLDER_STRING = os.environ.get("FOLDER_STRING", "")
folder = f"benchmark/trl/{FOLDER_STRING}"
host_url = f"https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/benchmark/{FOLDER_STRING}"
# Create a GitHub API instance
github_contex... | trl/benchmark/post_github_comment.py/0 | {
"file_path": "trl/benchmark/post_github_comment.py",
"repo_id": "trl",
"token_count": 358
} | 411 |
# Trainer
At TRL we support PPO (Proximal Policy Optimisation) with an implementation that largely follows the structure introduced in the paper "Fine-Tuning Language Models from Human Preferences" by D. Ziegler et al. [[paper](https://arxiv.org/pdf/1909.08593.pdf), [code](https://github.com/openai/lm-human-preferenc... | trl/docs/source/trainer.mdx/0 | {
"file_path": "trl/docs/source/trainer.mdx",
"repo_id": "trl",
"token_count": 322
} | 412 |
<jupyter_start><jupyter_text>Tune GPT2 to generate positive reviews> Optimise GPT2 to produce positive IMDB movie reviews using a BERT sentiment classifier as a reward function. Figure: Experiment setup to tune GPT2. The yellow arrows are outside the scope of this notebook, but the trained models are available through... | trl/examples/notebooks/gpt2-sentiment.ipynb/0 | {
"file_path": "trl/examples/notebooks/gpt2-sentiment.ipynb",
"repo_id": "trl",
"token_count": 3578
} | 413 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# 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 appl... | trl/examples/research_projects/toxicity/scripts/gpt-j-6b-toxicity.py/0 | {
"file_path": "trl/examples/research_projects/toxicity/scripts/gpt-j-6b-toxicity.py",
"repo_id": "trl",
"token_count": 3133
} | 414 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | trl/tests/test_peft_models.py/0 | {
"file_path": "trl/tests/test_peft_models.py",
"repo_id": "trl",
"token_count": 3832
} | 415 |
# Copyright 2023 DDPO-pytorch authors (Kevin Black), The HuggingFace Team, metric-space. All rights reserved.
#
# 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/lic... | trl/trl/models/modeling_sd_base.py/0 | {
"file_path": "trl/trl/models/modeling_sd_base.py",
"repo_id": "trl",
"token_count": 11407
} | 416 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | trl/trl/trainer/reward_trainer.py/0 | {
"file_path": "trl/trl/trainer/reward_trainer.py",
"repo_id": "trl",
"token_count": 5938
} | 417 |
# Big model inference benchmarks
Running inference with Accelerate on big models.
## Setup
These benchmarks use the `transformers` library:
```bash
pip install transformers
```
To reproduce or test a new setup, run
```py
python inference_acc.py model_name
```
This script supports `gpt-j-6b`, `gpt-neox`, `opt` (3... | accelerate/benchmarks/README.md/0 | {
"file_path": "accelerate/benchmarks/README.md",
"repo_id": "accelerate",
"token_count": 702
} | 0 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
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... | accelerate/docs/source/concept_guides/big_model_inference.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/big_model_inference.md",
"repo_id": "accelerate",
"token_count": 4832
} | 1 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
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... | accelerate/docs/source/usage_guides/ipex.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/ipex.md",
"repo_id": "accelerate",
"token_count": 2636
} | 2 |
# Distributed inference examples with PiPPy
This repo contains a variety of tutorials for using the [PiPPy](https://github.com/PyTorch/PiPPy) pipeline parallelism library with accelerate. You will find examples covering:
1. How to trace the model using `accelerate.prepare_pippy`
2. How to specify inputs based on what... | accelerate/examples/inference/README.md/0 | {
"file_path": "accelerate/examples/inference/README.md",
"repo_id": "accelerate",
"token_count": 646
} | 3 |
[tool.ruff]
line-length = 119
target-version = "py38"
[tool.ruff.lint]
preview = true
ignore-init-module-imports = true
extend-select = [
"B009", # static getattr
"B010", # static setattr
"CPY", # Copyright
"E", # PEP8 errors
"F", # PEP8 formatting
"I", # Import sorting
"TID251", # Banned A... | accelerate/pyproject.toml/0 | {
"file_path": "accelerate/pyproject.toml",
"repo_id": "accelerate",
"token_count": 427
} | 4 |
#!/usr/bin/env python
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# 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
#
# Unles... | accelerate/src/accelerate/commands/env.py/0 | {
"file_path": "accelerate/src/accelerate/commands/env.py",
"repo_id": "accelerate",
"token_count": 1090
} | 5 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | accelerate/src/accelerate/local_sgd.py/0 | {
"file_path": "accelerate/src/accelerate/local_sgd.py",
"repo_id": "accelerate",
"token_count": 1508
} | 6 |
#!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# 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
#
# Unles... | accelerate/src/accelerate/test_utils/scripts/test_distributed_data_loop.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_distributed_data_loop.py",
"repo_id": "accelerate",
"token_count": 3115
} | 7 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | accelerate/src/accelerate/utils/launch.py/0 | {
"file_path": "accelerate/src/accelerate/utils/launch.py",
"repo_id": "accelerate",
"token_count": 11592
} | 8 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | accelerate/tests/fsdp/test_fsdp.py/0 | {
"file_path": "accelerate/tests/fsdp/test_fsdp.py",
"repo_id": "accelerate",
"token_count": 7367
} | 9 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | accelerate/tests/test_memory_utils.py/0 | {
"file_path": "accelerate/tests/test_memory_utils.py",
"repo_id": "accelerate",
"token_count": 1740
} | 10 |
# Language Adaptation through Continued Pretraining
This directory shows a base example of how to use continued pretraining and further tuning to adapt a language model to new data (e.g. a new language or domain).
Three steps are needed: continued pretraining (`cpt`), supervised finetuning (`sft`), and direct prefere... | alignment-handbook/recipes/gpt2-nl/README.md/0 | {
"file_path": "alignment-handbook/recipes/gpt2-nl/README.md",
"repo_id": "alignment-handbook",
"token_count": 754
} | 11 |
# Model arguments
model_name_or_path: mistralai/Mistral-7B-v0.1
model_revision: main
torch_dtype: float16
# LoRA arguments
load_in_4bit: true
use_peft: true
lora_r: 16
lora_alpha: 16
lora_dropout: 0.05
lora_target_modules:
- q_proj
- k_proj
- v_proj
- o_proj
- gate_proj
- up_proj
- down_proj
# Data training arguments... | alignment-handbook/recipes/zephyr-7b-beta/sft/config_qlora.yaml/0 | {
"file_path": "alignment-handbook/recipes/zephyr-7b-beta/sft/config_qlora.yaml",
"repo_id": "alignment-handbook",
"token_count": 646
} | 12 |
# Porting a custom kernel
| candle/candle-book/src/cuda/porting.md/0 | {
"file_path": "candle/candle-book/src/cuda/porting.md",
"repo_id": "candle",
"token_count": 7
} | 13 |
# Simplified
## How its works
This program implements a neural network to predict the winner of the second round of elections based on the results of the first round.
Basic moments:
1. A multilayer perceptron with two hidden layers is used. The first hidden layer has 4 neurons, the second has 2 neurons.
2. The inpu... | candle/candle-book/src/training/simplified.md/0 | {
"file_path": "candle/candle-book/src/training/simplified.md",
"repo_id": "candle",
"token_count": 530
} | 14 |
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{CpuStorage, DType, Layout, Result, Shape};
pub trait BackendStorage: Sized {
type Device: BackendDevice;
fn try_clone(&self, _: &Layout) -> Result<Self>;
fn dtype(&self) -> DType;
fn device(&self) -> &Self::Device;
// Maybe this... | candle/candle-core/src/backend.rs/0 | {
"file_path": "candle/candle-core/src/backend.rs",
"repo_id": "candle",
"token_count": 1732
} | 15 |
#![allow(dead_code)]
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{CpuStorage, DType, Error, Layout, Result, Shape};
#[derive(Debug, Clone)]
pub struct CudaDevice;
#[derive(Debug)]
pub struct CudaStorage;
macro_rules! fail {
() => {
unimplemented!("cuda support has not been enabled, ... | candle/candle-core/src/dummy_cuda_backend.rs/0 | {
"file_path": "candle/candle-core/src/dummy_cuda_backend.rs",
"repo_id": "candle",
"token_count": 2634
} | 16 |
//! Support for the GGUF file format.
//!
//! Spec: https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md
use super::{GgmlDType, QTensor};
use crate::{Device, Result};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use std::collections::HashMap;
pub const DEFAULT_ALIGNMENT: u64 = 32;
#[derive(Debu... | candle/candle-core/src/quantized/gguf_file.rs/0 | {
"file_path": "candle/candle-core/src/quantized/gguf_file.rs",
"repo_id": "candle",
"token_count": 9397
} | 17 |
use anyhow::Result;
use candle_core::{test_device, test_utils, Device, IndexOp, Tensor};
/* This test is based on the following script.
import torch
torch.manual_seed(4242)
t = torch.randn((1, 4, 5))
w = torch.randn((2, 4, 3))
print(t.flatten())
print(w.flatten())
res = torch.nn.functional.conv1d(t, w)
print(res.flat... | candle/candle-core/tests/conv_tests.rs/0 | {
"file_path": "candle/candle-core/tests/conv_tests.rs",
"repo_id": "candle",
"token_count": 15015
} | 18 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::models::bert::{BertModel, Config, HiddenAct, DTYPE};
use anyhow::{Error as E, Result};
use candle::Tensor;
use candle_nn::VarBuilder;
use clap::Parser;
use hf_hub::{api::sync::Api, ... | candle/candle-examples/examples/bert/main.rs/0 | {
"file_path": "candle/candle-examples/examples/bert/main.rs",
"repo_id": "candle",
"token_count": 3527
} | 19 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::models::distilbert::{Config, DistilBertModel, DTYPE};
use anyhow::{Error as E, Result};
use candle::{Device, Tensor};
use candle_nn::VarBuilder;
use clap::Parser;
use hf_hub::{api::... | candle/candle-examples/examples/distilbert/main.rs/0 | {
"file_path": "candle/candle-examples/examples/distilbert/main.rs",
"repo_id": "candle",
"token_count": 1939
} | 20 |
// An implementation of LLaMA https://github.com/facebookresearch/llama
//
// This is based on nanoGPT in a similar way to:
// https://github.com/Lightning-AI/lit-llama/blob/main/lit_llama/model.py
//
// The tokenizer config can be retrieved from:
// https://huggingface.co/hf-internal-testing/llama-tokenizer/raw/main/t... | candle/candle-examples/examples/llama_multiprocess/main.rs/0 | {
"file_path": "candle/candle-examples/examples/llama_multiprocess/main.rs",
"repo_id": "candle",
"token_count": 3470
} | 21 |
// This should reach 91.5% accuracy.
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::{Parser, ValueEnum};
use rand::prelude::*;
use candle::{DType, Result, Tensor, D};
use candle_nn::{loss, ops, Conv2d, Linear, Module, ModuleT, Optimizer, VarB... | candle/candle-examples/examples/mnist-training/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mnist-training/main.rs",
"repo_id": "candle",
"token_count": 4094
} | 22 |
# candle-reinforcement-learning
Reinforcement Learning examples for candle.
This has been tested with `gymnasium` version `0.29.1`. You can install the
Python package with:
```bash
pip install "gymnasium[accept-rom-license]"
```
In order to run the examples, use the following commands. Note the additional
`--package... | candle/candle-examples/examples/reinforcement-learning/README.md/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/README.md",
"repo_id": "candle",
"token_count": 198
} | 23 |
# candle-segformer
- [HuggingFace Segformer Model Card][segformer]
- [`mit-b0` - An encoder only pretrained model][encoder]
- [`segformer-b0-finetuned-ade-512-512` - A fine tuned model for segmentation][ade512]
## How to run the example
If you want you can use the example images from this [pull request][pr], downloa... | candle/candle-examples/examples/segformer/README.md/0 | {
"file_path": "candle/candle-examples/examples/segformer/README.md",
"repo_id": "candle",
"token_count": 357
} | 24 |
use candle::{IndexOp, Result, Tensor, D};
use tokenizers::Tokenizer;
const LANGUAGES: [(&str, &str); 99] = [
("en", "english"),
("zh", "chinese"),
("de", "german"),
("es", "spanish"),
("ru", "russian"),
("ko", "korean"),
("fr", "french"),
("ja", "japanese"),
("pt", "portuguese"),
... | candle/candle-examples/examples/whisper/multilingual.rs/0 | {
"file_path": "candle/candle-examples/examples/whisper/multilingual.rs",
"repo_id": "candle",
"token_count": 1846
} | 25 |
// Copyright (c) 2023, Tri Dao.
// Splitting the different head dimensions to different files to speed up compilation.
// This file is auto-generated. See "generate_kernels.py"
#include "flash_fwd_launch_template.h"
template<>
void run_mha_fwd_<cutlass::half_t, 128>(Flash_fwd_params ¶ms, cudaStream_t stream) {
... | candle/candle-flash-attn/kernels/flash_fwd_hdim128_fp16_sm80.cu/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash_fwd_hdim128_fp16_sm80.cu",
"repo_id": "candle",
"token_count": 135
} | 26 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
#include "static_switch.h"
#include "flash.h"
#include "flash_fwd_kernel.h"
template<typename Kernel_traits, bo... | candle/candle-flash-attn/kernels/flash_fwd_launch_template.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash_fwd_launch_template.h",
"repo_id": "candle",
"token_count": 7583
} | 27 |
#include "cuda_utils.cuh"
#include<stdint.h>
template <typename S, typename T>
__device__ void cast_(
const size_t numel,
const size_t num_dims,
const size_t *info,
const S *inp,
T *out
) {
const size_t *dims = info;
const size_t *strides = info + num_dims;
if (is_contiguous(num_dims, d... | candle/candle-kernels/src/cast.cu/0 | {
"file_path": "candle/candle-kernels/src/cast.cu",
"repo_id": "candle",
"token_count": 2161
} | 28 |
template <typename T>
METAL_FUNC void im2col(
constant size_t &dst_numel,
constant size_t &h_out,
constant size_t &w_out,
constant size_t &h_k,
constant size_t &w_k,
constant size_t &stride,
constant size_t &padding,
constant size_t &dilation,
constant size_t *src_dims,
constant ... | candle/candle-metal-kernels/src/conv.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/conv.metal",
"repo_id": "candle",
"token_count": 3054
} | 29 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{DType, Device, Result, Tensor};
use candle_nn::{linear, AdamW, Linear, Module, Optimizer, ParamsAdamW, VarBuilder, VarMap};
fn gen_data() -> Result<(Tensor, Tensor)> {
// Generate some sam... | candle/candle-nn/examples/basic_optimizer.rs/0 | {
"file_path": "candle/candle-nn/examples/basic_optimizer.rs",
"repo_id": "candle",
"token_count": 595
} | 30 |
//! Recurrent Neural Networks
use candle::{DType, Device, IndexOp, Result, Tensor};
/// Trait for Recurrent Neural Networks.
#[allow(clippy::upper_case_acronyms)]
pub trait RNN {
type State: Clone;
/// A zero state from which the recurrent network is usually initialized.
fn zero_state(&self, batch_dim: us... | candle/candle-nn/src/rnn.rs/0 | {
"file_path": "candle/candle-nn/src/rnn.rs",
"repo_id": "candle",
"token_count": 4874
} | 31 |
use candle::Result;
use prost::Message;
pub mod onnx {
include!(concat!(env!("OUT_DIR"), "/onnx.rs"));
}
pub mod eval;
pub use eval::{dtype, simple_eval};
pub fn read_file<P: AsRef<std::path::Path>>(p: P) -> Result<onnx::ModelProto> {
let buf = std::fs::read(p)?;
onnx::ModelProto::decode(buf.as_slice()).... | candle/candle-onnx/src/lib.rs/0 | {
"file_path": "candle/candle-onnx/src/lib.rs",
"repo_id": "candle",
"token_count": 154
} | 32 |
from .module import Module
from .container import Sequential, ModuleList, ModuleDict
from .sparse import Embedding
from .normalization import LayerNorm
from .linear import Linear
| candle/candle-pyo3/py_src/candle/nn/__init__.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/__init__.py",
"repo_id": "candle",
"token_count": 43
} | 33 |
use ::candle::Tensor;
use pyo3::prelude::*;
#[derive(Clone, Debug)]
/// Represents an absolute shape e.g. (1, 2, 3)
pub struct PyShape(Vec<usize>);
impl<'source> pyo3::FromPyObject<'source> for PyShape {
fn extract(ob: &'source PyAny) -> PyResult<Self> {
if ob.is_none() {
return Err(PyErr::new... | candle/candle-pyo3/src/shape.rs/0 | {
"file_path": "candle/candle-pyo3/src/shape.rs",
"repo_id": "candle",
"token_count": 1646
} | 34 |
use super::with_tracing::{layer_norm, linear, LayerNorm, Linear};
use candle::{DType, Device, Result, Tensor};
use candle_nn::{embedding, Embedding, Module, VarBuilder};
use serde::Deserialize;
pub const DTYPE: DType = DType::F32;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "lowerca... | candle/candle-transformers/src/models/bert.rs/0 | {
"file_path": "candle/candle-transformers/src/models/bert.rs",
"repo_id": "candle",
"token_count": 7941
} | 35 |
use candle::{DType, Device, IndexOp, Result, Tensor, D};
use candle_nn::linear_no_bias as linear;
use candle_nn::{embedding, rms_norm, Embedding, Linear, Module, RmsNorm, VarBuilder};
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Config {
pub dim: usize, // transformer dimension
pub ... | candle/candle-transformers/src/models/llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llama2_c.rs",
"repo_id": "candle",
"token_count": 6423
} | 36 |
use super::llama2_c::{Cache, Config};
use crate::quantized_nn::{linear_no_bias as linear, Embedding, Linear, RmsNorm};
pub use crate::quantized_var_builder::VarBuilder;
use candle::{DType, IndexOp, Module, Result, Tensor, D};
fn silu(xs: &Tensor) -> Result<Tensor> {
xs / (xs.neg()?.exp()? + 1.0)?
}
#[derive(Debug... | candle/candle-transformers/src/models/quantized_llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_llama2_c.rs",
"repo_id": "candle",
"token_count": 4375
} | 37 |
use candle::{IndexOp, Result, Tensor};
use candle_nn::{Module, VarBuilder};
use super::transformer::TwoWayTransformer;
#[derive(Debug)]
struct MlpMaskDecoder {
layers: Vec<super::Linear>,
sigmoid_output: bool,
span: tracing::Span,
}
impl MlpMaskDecoder {
fn new(
input_dim: usize,
hidd... | candle/candle-transformers/src/models/segment_anything/mask_decoder.rs/0 | {
"file_path": "candle/candle-transformers/src/models/segment_anything/mask_decoder.rs",
"repo_id": "candle",
"token_count": 4213
} | 38 |
//! 2D UNet Building Blocks
//!
use super::attention::{
AttentionBlock, AttentionBlockConfig, SpatialTransformer, SpatialTransformerConfig,
};
use super::resnet::{ResnetBlock2D, ResnetBlock2DConfig};
use crate::models::with_tracing::{conv2d, Conv2d};
use candle::{Module, Result, Tensor, D};
use candle_nn as nn;
#[... | candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs",
"repo_id": "candle",
"token_count": 13815
} | 39 |
use candle::{Result, Tensor};
#[derive(Debug, Clone)]
pub struct DDPMWSchedulerConfig {
scaler: f64,
s: f64,
}
impl Default for DDPMWSchedulerConfig {
fn default() -> Self {
Self {
scaler: 1f64,
s: 0.008f64,
}
}
}
pub struct DDPMWScheduler {
init_alpha_cump... | candle/candle-transformers/src/models/wuerstchen/ddpm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/wuerstchen/ddpm.rs",
"repo_id": "candle",
"token_count": 1537
} | 40 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to Candle!</title>
<link data-trunk rel="copy-file" href="tokenizer.json" />
<link data-trunk rel="copy-file" href="model.bin" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
<l... | candle/candle-wasm-examples/llama2-c/index.html/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/index.html",
"repo_id": "candle",
"token_count": 315
} | 41 |
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
pub fn log(s: &str);
}
#[macro_export]
macro_rules! console_log {
// Note that this is using the `log` function impor... | candle/candle-wasm-examples/phi/src/lib.rs/0 | {
"file_path": "candle/candle-wasm-examples/phi/src/lib.rs",
"repo_id": "candle",
"token_count": 183
} | 42 |
//load the candle Whisper decoder wasm module
import init, { Decoder } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "whisper-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await ca... | candle/candle-wasm-examples/whisper/whisperWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/whisper/whisperWorker.js",
"repo_id": "candle",
"token_count": 1215
} | 43 |
Run the tests with:
```bash
RUST_LOG=wasm_bindgen_test_runner wasm-pack test --chrome --headless
```
Or:
```bash
wasm-pack test --chrome
```
If you get an "invalid session id" failure in headless mode, check that logs and
it may well be that your ChromeDriver is not at the same version as your
browser.
| candle/candle-wasm-tests/README.md/0 | {
"file_path": "candle/candle-wasm-tests/README.md",
"repo_id": "candle",
"token_count": 98
} | 44 |
ARG INCLUDE_DB=false
FROM mongo:latest as mongo
FROM node:20-slim as local_db_false
FROM node:20-slim as local_db_true
RUN apt-get update
RUN apt-get install gnupg curl -y
COPY --from=mongo /usr/bin/mongo* /usr/bin/
FROM local_db_${INCLUDE_DB} as final
ARG INCLUDE_DB=false
ENV INCLUDE_DB=${INCLUDE_DB}
WORKDIR /ap... | chat-ui/Dockerfile.local/0 | {
"file_path": "chat-ui/Dockerfile.local",
"repo_id": "chat-ui",
"token_count": 278
} | 45 |
export function clickOutside(element: HTMLDialogElement, callbackFunction: () => void) {
function onClick(event: MouseEvent) {
if (!element.contains(event.target as Node)) {
callbackFunction();
}
}
document.body.addEventListener("click", onClick);
return {
update(newCallbackFunction: () => void) {
cal... | chat-ui/src/lib/actions/clickOutside.ts/0 | {
"file_path": "chat-ui/src/lib/actions/clickOutside.ts",
"repo_id": "chat-ui",
"token_count": 143
} | 46 |
<script lang="ts">
import type { WebSearchUpdate } from "$lib/types/MessageUpdate";
import CarbonError from "~icons/carbon/error-filled";
import EosIconsLoading from "~icons/eos-icons/loading";
import IconInternet from "./icons/IconInternet.svelte";
export let classNames = "";
export let webSearchMessages: WebS... | chat-ui/src/lib/components/OpenWebSearchResults.svelte/0 | {
"file_path": "chat-ui/src/lib/components/OpenWebSearchResults.svelte",
"repo_id": "chat-ui",
"token_count": 1726
} | 47 |
<script lang="ts">
import { marked } from "marked";
import markedKatex from "marked-katex-extension";
import type { Message } from "$lib/types/Message";
import { afterUpdate, createEventDispatcher, tick } from "svelte";
import { deepestChild } from "$lib/utils/deepestChild";
import { page } from "$app/stores";
... | chat-ui/src/lib/components/chat/ChatMessage.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatMessage.svelte",
"repo_id": "chat-ui",
"token_count": 6667
} | 48 |
import type { MongoClient, ObjectId } from "mongodb";
import updateSearchAssistant from "./01-update-search-assistants";
export interface Migration {
_id: ObjectId;
name: string;
up: (client: MongoClient) => Promise<boolean>;
down?: (client: MongoClient) => Promise<boolean>;
runForFreshInstall?: "only" | "never"... | chat-ui/src/lib/migrations/routines/index.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/index.ts",
"repo_id": "chat-ui",
"token_count": 149
} | 49 |
import { HF_ACCESS_TOKEN, HF_TOKEN } from "$env/static/private";
import { buildPrompt } from "$lib/buildPrompt";
import { textGenerationStream } from "@huggingface/inference";
import type { Endpoint } from "../endpoints";
import { z } from "zod";
export const endpointTgiParametersSchema = z.object({
weight: z.number(... | chat-ui/src/lib/server/endpoints/tgi/endpointTgi.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/tgi/endpointTgi.ts",
"repo_id": "chat-ui",
"token_count": 526
} | 50 |
import type { Message } from "$lib/types/Message";
import { getContext, setContext } from "svelte";
import { writable, type Writable } from "svelte/store";
// used to store the id of the message that is the currently displayed leaf of the conversation tree
// (that is the last message in the current branch of the conv... | chat-ui/src/lib/stores/convTree.ts/0 | {
"file_path": "chat-ui/src/lib/stores/convTree.ts",
"repo_id": "chat-ui",
"token_count": 216
} | 51 |
import type { ObjectId } from "mongodb";
export interface MigrationResult {
_id: ObjectId;
name: string;
status: "success" | "failure" | "ongoing";
}
| chat-ui/src/lib/types/MigrationResult.ts/0 | {
"file_path": "chat-ui/src/lib/types/MigrationResult.ts",
"repo_id": "chat-ui",
"token_count": 53
} | 52 |
/**
* A debounce function that works in both browser and Nodejs.
* For pure Nodejs work, prefer the `Debouncer` class.
*/
export function debounce<T extends unknown[]>(
callback: (...rest: T) => unknown,
limit: number
): (...rest: T) => void {
let timer: ReturnType<typeof setTimeout>;
return function (...rest) ... | chat-ui/src/lib/utils/debounce.ts/0 | {
"file_path": "chat-ui/src/lib/utils/debounce.ts",
"repo_id": "chat-ui",
"token_count": 138
} | 53 |
export function sum(nums: number[]): number {
return nums.reduce((a, b) => a + b, 0);
}
| chat-ui/src/lib/utils/sum.ts/0 | {
"file_path": "chat-ui/src/lib/utils/sum.ts",
"repo_id": "chat-ui",
"token_count": 35
} | 54 |
<script lang="ts">
import "../styles/main.css";
import { onDestroy } from "svelte";
import { goto, invalidate } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/stores";
import { browser } from "$app/environment";
import {
PUBLIC_APP_DESCRIPTION,
PUBLIC_ORIGIN,
PUBLIC... | chat-ui/src/routes/+layout.svelte/0 | {
"file_path": "chat-ui/src/routes/+layout.svelte",
"repo_id": "chat-ui",
"token_count": 2668
} | 55 |
<script lang="ts">
import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
import { pendingMessage } from "$lib/stores/pendingMessage";
import { isAborted } from "$lib/stores/isAborted";
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto, invalidateAll } from "$app/naviga... | chat-ui/src/routes/conversation/[id]/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/conversation/[id]/+page.svelte",
"repo_id": "chat-ui",
"token_count": 5239
} | 56 |
import ModelThumbnail from "./ModelThumbnail.svelte";
import { redirect, type RequestHandler } from "@sveltejs/kit";
import type { SvelteComponent } from "svelte";
import { Resvg } from "@resvg/resvg-js";
import satori from "satori";
import { html } from "satori-html";
import InterRegular from "../../../../../static/... | chat-ui/src/routes/models/[...model]/thumbnail.png/+server.ts/0 | {
"file_path": "chat-ui/src/routes/models/[...model]/thumbnail.png/+server.ts",
"repo_id": "chat-ui",
"token_count": 526
} | 57 |
import { base } from "$app/paths";
import { authCondition, requiresUser } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import { fail, type Actions, redirect } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
import { z } from "zod";
import { sha256 } from "$lib/utils/sha256";
i... | chat-ui/src/routes/settings/(nav)/assistants/new/+page.server.ts/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/new/+page.server.ts",
"repo_id": "chat-ui",
"token_count": 1380
} | 58 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
<path
fill="#FFD21E"
d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z"
/>
<path
fill="#32343D"
d="M19.63 12.48c.37.14.52.9.9.7.71-.38.98-1.27.6-1.98a1.46 1.46 0 0 0-1.98-.61 1.4... | chat-ui/static/huggingchat/logo.svg/0 | {
"file_path": "chat-ui/static/huggingchat/logo.svg",
"repo_id": "chat-ui",
"token_count": 523
} | 59 |
# Security Policy
## Supported Versions
<!--
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_... | datasets/SECURITY.md/0 | {
"file_path": "datasets/SECURITY.md",
"repo_id": "datasets",
"token_count": 306
} | 60 |
# docstyle-ignore
INSTALL_CONTENT = """
# Datasets installation
! pip install datasets transformers
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/datasets.git
"""
notebook_first_cells = [{"type": "code... | datasets/docs/source/_config.py/0 | {
"file_path": "datasets/docs/source/_config.py",
"repo_id": "datasets",
"token_count": 118
} | 61 |
# Create a dataset
Sometimes, you may need to create a dataset if you're working with your own data. Creating a dataset with 🤗 Datasets confers all the advantages of the library to your dataset: fast loading and processing, [stream enormous datasets](stream), [memory-mapping](https://huggingface.co/course/chapter5/4?... | datasets/docs/source/create_dataset.mdx/0 | {
"file_path": "datasets/docs/source/create_dataset.mdx",
"repo_id": "datasets",
"token_count": 2167
} | 62 |
# Load a dataset from the Hub
Finding high-quality datasets that are reproducible and accessible can be difficult. One of 🤗 Datasets main goals is to provide a simple way to load a dataset of any format or type. The easiest way to get started is to discover an existing dataset on the [Hugging Face Hub](https://huggin... | datasets/docs/source/load_hub.mdx/0 | {
"file_path": "datasets/docs/source/load_hub.mdx",
"repo_id": "datasets",
"token_count": 1685
} | 63 |
# Share a dataset using the CLI
At Hugging Face, we are on a mission to democratize good Machine Learning and we believe in the value of open source. That's why we designed 🤗 Datasets so that anyone can share a dataset with the greater ML community. There are currently thousands of datasets in over 100 languages in t... | datasets/docs/source/share.mdx/0 | {
"file_path": "datasets/docs/source/share.mdx",
"repo_id": "datasets",
"token_count": 2930
} | 64 |
# Metric Card for BLEU
## Metric Description
BLEU (Bilingual Evaluation Understudy) is an algorithm for evaluating the quality of text which has been machine-translated from one natural language to another. Quality is considered to be the correspondence between a machine's output and that of a human: "the closer a ma... | datasets/metrics/bleu/README.md/0 | {
"file_path": "datasets/metrics/bleu/README.md",
"repo_id": "datasets",
"token_count": 1990
} | 65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.