text
stringlengths
7
1.24M
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
519
# coding=utf-8 # Copyright 2021 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 law o...
transformers/tests/models/bartpho/test_tokenization_bartpho.py/0
{ "file_path": "transformers/tests/models/bartpho/test_tokenization_bartpho.py", "repo_id": "transformers", "token_count": 1082 }
399
# 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/blenderbot/test_modeling_tf_blenderbot.py/0
{ "file_path": "transformers/tests/models/blenderbot/test_modeling_tf_blenderbot.py", "repo_id": "transformers", "token_count": 3908 }
400
# coding=utf-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 requir...
transformers/tests/models/codegen/test_modeling_codegen.py/0
{ "file_path": "transformers/tests/models/codegen/test_modeling_codegen.py", "repo_id": "transformers", "token_count": 10584 }
401
# coding=utf-8 # Copyright 2024 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/dac/test_modeling_dac.py/0
{ "file_path": "transformers/tests/models/dac/test_modeling_dac.py", "repo_id": "transformers", "token_count": 14481 }
402
# coding=utf-8 # Copyright 2020 Huggingface # # 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 ...
transformers/tests/models/dpr/test_modeling_tf_dpr.py/0
{ "file_path": "transformers/tests/models/dpr/test_modeling_tf_dpr.py", "repo_id": "transformers", "token_count": 4394 }
403
# 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/focalnet/test_modeling_focalnet.py/0
{ "file_path": "transformers/tests/models/focalnet/test_modeling_focalnet.py", "repo_id": "transformers", "token_count": 7399 }
404
# 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/lxmert/test_modeling_tf_lxmert.py/0
{ "file_path": "transformers/tests/models/lxmert/test_modeling_tf_lxmert.py", "repo_id": "transformers", "token_count": 10961 }
405
# coding=utf-8 # Copyright 2022 The Hugging Face 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 law...
transformers/tests/models/markuplm/test_modeling_markuplm.py/0
{ "file_path": "transformers/tests/models/markuplm/test_modeling_markuplm.py", "repo_id": "transformers", "token_count": 6144 }
406
# coding=utf-8 # 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 # # Unless requir...
transformers/tests/models/mluke/test_tokenization_mluke.py/0
{ "file_path": "transformers/tests/models/mluke/test_tokenization_mluke.py", "repo_id": "transformers", "token_count": 14692 }
407
# coding=utf-8 # 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 r...
transformers/tests/models/mobilevitv2/test_modeling_mobilevitv2.py/0
{ "file_path": "transformers/tests/models/mobilevitv2/test_modeling_mobilevitv2.py", "repo_id": "transformers", "token_count": 6189 }
408
# 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/models/pix2struct/test_image_processing_pix2struct.py/0
{ "file_path": "transformers/tests/models/pix2struct/test_image_processing_pix2struct.py", "repo_id": "transformers", "token_count": 6161 }
409
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team, The Microsoft Research 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 # # ...
transformers/tests/models/prophetnet/test_tokenization_prophetnet.py/0
{ "file_path": "transformers/tests/models/prophetnet/test_tokenization_prophetnet.py", "repo_id": "transformers", "token_count": 3468 }
410
# coding=utf-8 # Copyright 2024 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/qwen2_vl/test_modeling_qwen2_vl.py/0
{ "file_path": "transformers/tests/models/qwen2_vl/test_modeling_qwen2_vl.py", "repo_id": "transformers", "token_count": 8112 }
411
# 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_rembert.py/0
{ "file_path": "transformers/tests/models/rembert/test_modeling_rembert.py", "repo_id": "transformers", "token_count": 9236 }
412
# coding=utf-8 # 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 r...
transformers/tests/models/sam/test_modeling_tf_sam.py/0
{ "file_path": "transformers/tests/models/sam/test_modeling_tf_sam.py", "repo_id": "transformers", "token_count": 11717 }
413
# Copyright 2024 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/superpoint/test_image_processing_superpoint.py/0
{ "file_path": "transformers/tests/models/superpoint/test_image_processing_superpoint.py", "repo_id": "transformers", "token_count": 1623 }
414
# coding=utf-8 # Copyright 2021 Google T5 Authors and 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 requ...
transformers/tests/models/t5/test_modeling_flax_t5.py/0
{ "file_path": "transformers/tests/models/t5/test_modeling_flax_t5.py", "repo_id": "transformers", "token_count": 23924 }
415
# 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_feature_extraction_univnet.py/0
{ "file_path": "transformers/tests/models/univnet/test_feature_extraction_univnet.py", "repo_id": "transformers", "token_count": 7246 }
416
# 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": 13172 }
417
# 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 required by applicabl...
transformers/tests/pipelines/test_pipelines_common.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_common.py", "repo_id": "transformers", "token_count": 16992 }
418
# 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 required by applicabl...
transformers/tests/pipelines/test_pipelines_text_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_text_classification.py", "repo_id": "transformers", "token_count": 4112 }
419
# 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 required by applicabl...
transformers/tests/repo_utils/test_check_copies.py/0
{ "file_path": "transformers/tests/repo_utils/test_check_copies.py", "repo_id": "transformers", "token_count": 7781 }
420
# coding=utf-8 # Copyright 2019-present, 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 a...
transformers/tests/utils/test_cli.py/0
{ "file_path": "transformers/tests/utils/test_cli.py", "repo_id": "transformers", "token_count": 1250 }
421
# 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 required by applicabl...
transformers/tests/utils/test_modeling_flax_utils.py/0
{ "file_path": "transformers/tests/utils/test_modeling_flax_utils.py", "repo_id": "transformers", "token_count": 7835 }
422
# 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_docstrings.py/0
{ "file_path": "transformers/utils/check_docstrings.py", "repo_id": "transformers", "token_count": 14441 }
423
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def get_jobs(workflow_run_id, token=None): """Extract jobs in a GitHub Actions workflow run""" headers = None if token is not None: headers = {"Accept": "...
transformers/utils/get_ci_error_statistics.py/0
{ "file_path": "transformers/utils/get_ci_error_statistics.py", "repo_id": "transformers", "token_count": 4815 }
424
"""A simple script to set flexibly CUDA_VISIBLE_DEVICES in GitHub Actions CI workflow files.""" import argparse import os if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "--test_folder", type=str, default=None, help="The test folder name of t...
transformers/utils/set_cuda_devices_for_ci.py/0
{ "file_path": "transformers/utils/set_cuda_devices_for_ci.py", "repo_id": "transformers", "token_count": 338 }
425
# coding=utf-8 # Copyright 2021 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/update_metadata.py/0
{ "file_path": "transformers/utils/update_metadata.py", "repo_id": "transformers", "token_count": 6399 }
426
include settings.ini include LICENSE include CONTRIBUTING.md include README.md recursive-exclude * __pycache__
trl/MANIFEST.in/0
{ "file_path": "trl/MANIFEST.in", "repo_id": "trl", "token_count": 33 }
427
#!/bin/bash # This script runs an SFT example end-to-end on a tiny model using different possible configurations # but defaults to QLoRA + PEFT OUTPUT_DIR="test_dpo/" MODEL_NAME="trl-internal-testing/tiny-random-LlamaForCausalLM" DATASET_NAME="trl-internal-testing/hh-rlhf-helpful-base-trl-style" MAX_STEPS=5 BATCH_SIZE=...
trl/commands/run_dpo.sh/0
{ "file_path": "trl/commands/run_dpo.sh", "repo_id": "trl", "token_count": 645 }
428
# Reward Modeling TRL supports custom reward modeling for anyone to perform reward modeling on their dataset and model. Check out a complete flexible example at [`examples/scripts/reward_modeling.py`](https://github.com/huggingface/trl/tree/main/examples/scripts/reward_modeling.py). ## Expected dataset format The [...
trl/docs/source/reward_trainer.mdx/0
{ "file_path": "trl/docs/source/reward_trainer.mdx", "repo_id": "trl", "token_count": 1145 }
429
import sys from dataclasses import dataclass, field from typing import Optional from datasets import load_dataset from huggingface_hub import HfApi from huggingface_hub.repocard import RepoCard from transformers import HfArgumentParser """ # debug python -i examples/datasets/anthropic_hh.py --debug --push_to_hub # a...
trl/examples/datasets/anthropic_hh.py/0
{ "file_path": "trl/examples/datasets/anthropic_hh.py", "repo_id": "trl", "token_count": 1798 }
430
# 0. imports import os from dataclasses import dataclass, field from typing import Dict, Optional import torch from accelerate import Accelerator from datasets import Dataset, load_dataset from peft import LoraConfig from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, set_seed from trl imp...
trl/examples/research_projects/stack_llama_2/scripts/dpo_llama2.py/0
{ "file_path": "trl/examples/research_projects/stack_llama_2/scripts/dpo_llama2.py", "repo_id": "trl", "token_count": 3921 }
431
# flake8: noqa # Copyright 2024 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...
trl/examples/scripts/dpo_online.py/0
{ "file_path": "trl/examples/scripts/dpo_online.py", "repo_id": "trl", "token_count": 1589 }
432
# Copyright 2024 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/scripts/log_example_reports.py/0
{ "file_path": "trl/scripts/log_example_reports.py", "repo_id": "trl", "token_count": 2269 }
433
# 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_data_collator_completion_only.py/0
{ "file_path": "trl/tests/test_data_collator_completion_only.py", "repo_id": "trl", "token_count": 2884 }
434
# 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_reward_trainer.py/0
{ "file_path": "trl/tests/test_reward_trainer.py", "repo_id": "trl", "token_count": 8137 }
435
# BCO Authors: Seungjae Jung, Gunsoo Han, Daniel Wontae Nam and Kyoung-Woon On # Copyright 2024 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 # # ...
trl/trl/trainer/bco_trainer.py/0
{ "file_path": "trl/trl/trainer/bco_trainer.py", "repo_id": "trl", "token_count": 30850 }
436
# ORPO Authors: Jiwoo Hong, Noah Lee, and James Thorne # Official code: https://github.com/xfactlab/orpo # Copyright 2024 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 c...
trl/trl/trainer/orpo_trainer.py/0
{ "file_path": "trl/trl/trainer/orpo_trainer.py", "repo_id": "trl", "token_count": 20909 }
437
# 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/big_model_inference/README.md/0
{ "file_path": "accelerate/benchmarks/big_model_inference/README.md", "repo_id": "accelerate", "token_count": 702 }
0
- sections: - local: index title: 🤗 Accelerate - local: basic_tutorials/install title: Installation - local: quicktour title: Quicktour title: Getting started - sections: - local: basic_tutorials/overview title: Overview - local: basic_tutorials/migration title: Add Accelerate to your c...
accelerate/docs/source/_toctree.yml/0
{ "file_path": "accelerate/docs/source/_toctree.yml", "repo_id": "accelerate", "token_count": 1394 }
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/concept_guides/training_tpu.md/0
{ "file_path": "accelerate/docs/source/concept_guides/training_tpu.md", "repo_id": "accelerate", "token_count": 2214 }
2
<!--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/megatron_lm.md/0
{ "file_path": "accelerate/docs/source/usage_guides/megatron_lm.md", "repo_id": "accelerate", "token_count": 9583 }
3
# 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 required by appl...
accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py/0
{ "file_path": "accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py", "repo_id": "accelerate", "token_count": 7835 }
4
# This config template is for a multi-node setup. This assumes DDP, but can be interop'd with the other configs in this folder # Generally it's recommended to look at the SLURM config template for a more robust multi-node setup distributed_type: MULTI_GPU # We need to specify the current machine's rank machine_rank: 0 ...
accelerate/examples/config_yaml_templates/multi_node.yaml/0
{ "file_path": "accelerate/examples/config_yaml_templates/multi_node.yaml", "repo_id": "accelerate", "token_count": 216 }
5
#!/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/commands/config/cluster.py/0
{ "file_path": "accelerate/src/accelerate/commands/config/cluster.py", "repo_id": "accelerate", "token_count": 18908 }
6
#!/usr/bin/env python # Copyright 2024 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/merge.py/0
{ "file_path": "accelerate/src/accelerate/commands/merge.py", "repo_id": "accelerate", "token_count": 776 }
7
# 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 # # Unless required by applicabl...
accelerate/src/accelerate/test_utils/testing.py/0
{ "file_path": "accelerate/src/accelerate/test_utils/testing.py", "repo_id": "accelerate", "token_count": 8346 }
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/src/accelerate/utils/operations.py/0
{ "file_path": "accelerate/src/accelerate/utils/operations.py", "repo_id": "accelerate", "token_count": 12879 }
9
# 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 # # Unless required by applicabl...
accelerate/tests/test_metrics.py/0
{ "file_path": "accelerate/tests/test_metrics.py", "repo_id": "accelerate", "token_count": 744 }
10
# 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/utils/log_reports.py/0
{ "file_path": "accelerate/utils/log_reports.py", "repo_id": "accelerate", "token_count": 3046 }
11
# Model arguments model_name_or_path: mistral-community/Mixtral-8x22B-v0.1 model_revision: main torch_dtype: bfloat16 attn_implementation: flash_attention_2 # Data training arguments chat_template: "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n...
alignment-handbook/recipes/zephyr-141b-A35b/orpo/config_full.yaml/0
{ "file_path": "alignment-handbook/recipes/zephyr-141b-A35b/orpo/config_full.yaml", "repo_id": "alignment-handbook", "token_count": 521 }
12
__version__ = "0.3.0.dev0" from .configs import DataArguments, DPOConfig, H4ArgumentParser, ModelArguments, SFTConfig from .data import apply_chat_template, get_datasets from .decontaminate import decontaminate_humaneval from .model_utils import ( get_checkpoint, get_kbit_device_map, get_peft_config, g...
alignment-handbook/src/alignment/__init__.py/0
{ "file_path": "alignment-handbook/src/alignment/__init__.py", "repo_id": "alignment-handbook", "token_count": 309 }
13
# Creating apps
candle/candle-book/src/apps/README.md/0
{ "file_path": "candle/candle-book/src/apps/README.md", "repo_id": "candle", "token_count": 4 }
14
# Running a model In order to run an existing model, you will need to download and use existing weights. Most models are already available on https://huggingface.co/ in [`safetensors`](https://github.com/huggingface/safetensors) format. Let's get started by running an old model : `bert-base-uncased`.
candle/candle-book/src/inference/inference.md/0
{ "file_path": "candle/candle-book/src/inference/inference.md", "repo_id": "candle", "token_count": 88 }
15
use crate::benchmarks::{BenchDevice, BenchDeviceHandler}; use candle_core::{ quantized::{self, GgmlDType, QMatMul}, Device, Module, Tensor, }; use criterion::{black_box, criterion_group, Criterion, Throughput}; use std::time::Instant; fn run(matmul: &QMatMul, x: &Tensor) { matmul.forward(x).unwrap(); } fn...
candle/candle-core/benches/benchmarks/qmatmul.rs/0
{ "file_path": "candle/candle-core/benches/benchmarks/qmatmul.rs", "repo_id": "candle", "token_count": 1085 }
16
pub mod erf; pub mod kernels; #[allow(unused)] trait Cpu<const ARR: usize> { type Unit; type Array; const STEP: usize; const EPR: usize; fn n() -> usize; unsafe fn zero() -> Self::Unit; unsafe fn zero_array() -> Self::Array; unsafe fn load(mem_addr: *const f32) -> Self::Unit; unsaf...
candle/candle-core/src/cpu/mod.rs/0
{ "file_path": "candle/candle-core/src/cpu/mod.rs", "repo_id": "candle", "token_count": 2432 }
17
use crate::{DType, DeviceLocation, Layout, MetalError, Shape}; #[derive(Debug, Clone)] pub struct MatMulUnexpectedStriding { pub lhs_l: Layout, pub rhs_l: Layout, pub bmnk: (usize, usize, usize, usize), pub msg: &'static str, } /// Main library error type. #[derive(thiserror::Error, Debug)] pub enum E...
candle/candle-core/src/error.rs/0
{ "file_path": "candle/candle-core/src/error.rs", "repo_id": "candle", "token_count": 3297 }
18
use super::utils::{ get_scale_min_k4, group_for_dequantization, group_for_quantization, make_q3_quants, make_qkx1_quants, make_qx_quants, nearest_int, }; use super::GgmlDType; use crate::Result; use byteorder::{ByteOrder, LittleEndian}; use half::f16; use rayon::prelude::*; // Default to QK_K 256 rather than 6...
candle/candle-core/src/quantized/k_quants.rs/0
{ "file_path": "candle/candle-core/src/quantized/k_quants.rs", "repo_id": "candle", "token_count": 42652 }
19
use std::str::FromStr; pub fn get_num_threads() -> usize { // Respond to the same environment variable as rayon. match std::env::var("RAYON_NUM_THREADS") .ok() .and_then(|s| usize::from_str(&s).ok()) { Some(x) if x > 0 => x, Some(_) | None => num_cpus::get(), } } pub fn...
candle/candle-core/src/utils.rs/0
{ "file_path": "candle/candle-core/src/utils.rs", "repo_id": "candle", "token_count": 389 }
20
use candle_core::{test_device, test_utils, DType, Device, IndexOp, Result, Tensor, D}; fn zeros(device: &Device) -> Result<()> { let tensor = Tensor::zeros((5, 2), DType::F32, device)?; let (dim1, dim2) = tensor.dims2()?; assert_eq!(dim1, 5); assert_eq!(dim2, 2); Ok(()) } fn ones(device: &Device) ...
candle/candle-core/tests/tensor_tests.rs/0
{ "file_path": "candle/candle-core/tests/tensor_tests.rs", "repo_id": "candle", "token_count": 26107 }
21
# candle-examples
candle/candle-examples/README.md/0
{ "file_path": "candle/candle-examples/README.md", "repo_id": "candle", "token_count": 6 }
22
use candle_transformers::models::codegeex4_9b::*; use clap::Parser; use candle::{DType, Device, Tensor}; use candle_nn::VarBuilder; use candle_transformers::generation::LogitsProcessor; use hf_hub::{Repo, RepoType}; use tokenizers::Tokenizer; struct TextGeneration { model: Model, device: Device, tokenizer...
candle/candle-examples/examples/codegeex4-9b/main.rs/0
{ "file_path": "candle/candle-examples/examples/codegeex4-9b/main.rs", "repo_id": "candle", "token_count": 3748 }
23
#[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 }
24
#[cfg(feature = "accelerate")] extern crate accelerate_src; #[cfg(feature = "mkl")] extern crate intel_mkl_src; use candle_transformers::models::{clip, flux, t5}; use anyhow::{Error as E, Result}; use candle::{IndexOp, Module, Tensor}; use candle_nn::VarBuilder; use clap::Parser; use tokenizers::Tokenizer; #[derive...
candle/candle-examples/examples/flux/main.rs/0
{ "file_path": "candle/candle-examples/examples/flux/main.rs", "repo_id": "candle", "token_count": 4147 }
25
use candle::backend::BackendStorage; use candle::{CpuStorage, CustomOp1, DType, Device, IndexOp, Layout, Result, Shape, Tensor, D}; use candle_nn::var_builder::ShardedVarBuilder as VarBuilder; use candle_nn::{Embedding, Linear, Module, RmsNorm}; use cudarc::nccl::safe::{Comm, ReduceOp}; use std::rc::Rc; use std::sync::...
candle/candle-examples/examples/llama_multiprocess/model.rs/0
{ "file_path": "candle/candle-examples/examples/llama_multiprocess/model.rs", "repo_id": "candle", "token_count": 7294 }
26
# candle-mistral: 7b LLM with Apache 2.0 licensed weights Mistral-7B-v0.1 is a pretrained generative LLM with 7 billion parameters. It outperforms all the publicly available 13b models as of 2023-09-28. Weights (and the original Python model code) are released under the permissive Apache 2.0 license. - [Blog post](ht...
candle/candle-examples/examples/mistral/README.md/0
{ "file_path": "candle/candle-examples/examples/mistral/README.md", "repo_id": "candle", "token_count": 829 }
27
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::{Error as E, Result}; use clap::{Parser, ValueEnum}; use candle_transformers::models::olmo::{Config, Model as OLMo}; use candle::{DType, Device, Tensor}; use candle_examples::token_output_stre...
candle/candle-examples/examples/olmo/main.rs/0
{ "file_path": "candle/candle-examples/examples/olmo/main.rs", "repo_id": "candle", "token_count": 4042 }
28
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use std::io::Write; use tokenizers::Tokenizer; use candle::quantized::{ggml_file, gguf_file}; use candle::Tensor; use candle_transformers::generation::{LogitsProcessor, Sampl...
candle/candle-examples/examples/quantized/main.rs/0
{ "file_path": "candle/candle-examples/examples/quantized/main.rs", "repo_id": "candle", "token_count": 12719 }
29
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::repvgg; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { A0, ...
candle/candle-examples/examples/repvgg/main.rs/0
{ "file_path": "candle/candle-examples/examples/repvgg/main.rs", "repo_id": "candle", "token_count": 1525 }
30
# candle-stable-diffusion: A Diffusers API in Rust/Candle ![rusty robot holding a candle](./assets/stable-diffusion-xl.jpg) _A rusty robot holding a fire torch in its hand_, generated by Stable Diffusion XL using Rust and [candle](https://github.com/huggingface/candle). The `stable-diffusion` example is a conversion...
candle/candle-examples/examples/stable-diffusion/README.md/0
{ "file_path": "candle/candle-examples/examples/stable-diffusion/README.md", "repo_id": "candle", "token_count": 935 }
31
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::Parser; use candle::{DType, IndexOp, D}; use candle_nn::VarBuilder; use candle_transformers::models::vit; #[derive(Parser)] struct Args { #[arg(long)] model: Option<String>, #[arg(l...
candle/candle-examples/examples/vit/main.rs/0
{ "file_path": "candle/candle-examples/examples/vit/main.rs", "repo_id": "candle", "token_count": 762 }
32
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle_transformers::object_detection::{non_maximum_suppression, Bbox}; mod darknet; use anyhow::Result; use candle::{DType, Device, Tensor}; use candle_nn::{Module, VarBuilder}; use clap::Parser; use ...
candle/candle-examples/examples/yolo-v3/main.rs/0
{ "file_path": "candle/candle-examples/examples/yolo-v3/main.rs", "repo_id": "candle", "token_count": 3179 }
33
use std::io::prelude::*; pub trait Sample { fn to_i16(&self) -> i16; } impl Sample for f32 { fn to_i16(&self) -> i16 { (self.clamp(-1.0, 1.0) * 32767.0) as i16 } } impl Sample for f64 { fn to_i16(&self) -> i16 { (self.clamp(-1.0, 1.0) * 32767.0) as i16 } } impl Sample for i16 { ...
candle/candle-examples/src/wav.rs/0
{ "file_path": "candle/candle-examples/src/wav.rs", "repo_id": "candle", "token_count": 729 }
34
/****************************************************************************** * Copyright (c) 2024, Tri Dao. ******************************************************************************/ #pragma once #include <cute/tensor.hpp> namespace flash { using namespace cute; template <typename Engine, typename Layout...
candle/candle-flash-attn/kernels/mask.h/0
{ "file_path": "candle/candle-flash-attn/kernels/mask.h", "repo_id": "candle", "token_count": 6255 }
35
#include "cuda_fp16.h" #include "cuda_bf16.h" // Table showing which features are supported on which compute capability // https://docs.nvidia.com/cuda/cuda-c-programming-guide/#features-and-technical-specifications // FIXME: the minimum compute capabilities are just guesses since the table is not specific enough #i...
candle/candle-kernels/src/compatibility.cuh/0
{ "file_path": "candle/candle-kernels/src/compatibility.cuh", "repo_id": "candle", "token_count": 2734 }
36
#include <metal_stdlib> using namespace metal; #define MAX(x, y) ((x) > (y) ? (x) : (y)) 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 ...
candle/candle-metal-kernels/src/conv.metal/0
{ "file_path": "candle/candle-metal-kernels/src/conv.metal", "repo_id": "candle", "token_count": 8944 }
37
[package] name = "candle-nn" version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true keywords.workspace = true categories.workspace = true license.workspace = true readme = "README.md" [dependencies] accelerate-src = { workspace = true, optional = true } candle = { wo...
candle/candle-nn/Cargo.toml/0
{ "file_path": "candle/candle-nn/Cargo.toml", "repo_id": "candle", "token_count": 359 }
38
use candle::{Result, Tensor}; #[derive(Debug, Clone)] pub struct Cache { // all_data is an option on a Tensor, this makes it possible to only create the actual tensor // on the first call where the batch size is easily known. // Also this makes it safe to clone a KvCache that has been reseted (as in it wil...
candle/candle-nn/src/kv_cache.rs/0
{ "file_path": "candle/candle-nn/src/kv_cache.rs", "repo_id": "candle", "token_count": 1987 }
39
use candle::{Result, Shape, Tensor}; use candle_nn::encoding::one_hot; #[test] fn test_i64_one_hot() -> Result<()> { let device = candle::Device::Cpu; let indices = Tensor::new(vec![vec![0i64, 2], vec![1, -1]], &device)?; let depth = 4; let on_value = 1.0; let off_value = 0.0; let one_hot = ...
candle/candle-nn/tests/one_hot.rs/0
{ "file_path": "candle/candle-nn/tests/one_hot.rs", "repo_id": "candle", "token_count": 1592 }
40
fn main() { pyo3_build_config::add_extension_module_link_args(); }
candle/candle-pyo3/build.rs/0
{ "file_path": "candle/candle-pyo3/build.rs", "repo_id": "candle", "token_count": 30 }
41
# Generated content DO NOT EDIT from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence from os import PathLike from candle.typing import _ArrayLike, Device, Scalar, Index, Shape from candle import Tensor, DType, QTensor class ONNXModel: """ A wrapper around an ONNX model. """ d...
candle/candle-pyo3/py_src/candle/onnx/__init__.pyi/0
{ "file_path": "candle/candle-pyo3/py_src/candle/onnx/__init__.pyi", "repo_id": "candle", "token_count": 939 }
42
import candle from candle import Tensor, QTensor from candle.nn import Module, Linear from candle.utils import cuda_is_available import pytest def test_module_can_be_constructed(): class A(Module): pass a = A() assert a is not None assert len(list(a.buffers())) == 0 def test_module_registe...
candle/candle-pyo3/tests/bindings/test_module.py/0
{ "file_path": "candle/candle-pyo3/tests/bindings/test_module.py", "repo_id": "candle", "token_count": 1853 }
43
//! Contrastive Language-Image Pre-Training //! //! Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on //! pairs of images with related texts. //! //! https://github.com/openai/CLIP //! https://github.com/huggingface/transformers/tree/f6fa0f0bf0796ac66f201f23bdb8585de1609add/src/transformers/m...
candle/candle-transformers/src/models/clip/mod.rs/0
{ "file_path": "candle/candle-transformers/src/models/clip/mod.rs", "repo_id": "candle", "token_count": 2184 }
44
//! FastViT inference implementation based on timm //! //! See "FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization" //! https://arxiv.org/pdf/2303.14189 //! //! https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/fastvit.py use candle::{DType, Result, Tensor, D}; use ca...
candle/candle-transformers/src/models/fastvit.rs/0
{ "file_path": "candle/candle-transformers/src/models/fastvit.rs", "repo_id": "candle", "token_count": 7980 }
45
/// A fast implementation of mamba for inference only. /// This is based on: https://github.com/LaurentMazare/mamba.rs use crate::models::with_tracing::{linear, linear_no_bias, Linear}; use candle::{DType, Device, IndexOp, Module, Result, Tensor, D}; use candle_nn::{RmsNorm, VarBuilder}; const D_CONV: usize = 4; const...
candle/candle-transformers/src/models/mamba.rs/0
{ "file_path": "candle/candle-transformers/src/models/mamba.rs", "repo_id": "candle", "token_count": 3846 }
46
use crate::models::with_tracing::{linear_no_bias, Embedding, Linear}; /// MPT model used by replit-code-v1_5-3b /// https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/modeling_mpt.py use candle::{DType, Device, IndexOp, Module, Result, Tensor, D}; use candle_nn::{layer_norm, LayerNorm, VarBuilder}; // https:/...
candle/candle-transformers/src/models/mpt.rs/0
{ "file_path": "candle/candle-transformers/src/models/mpt.rs", "repo_id": "candle", "token_count": 5214 }
47
use crate::quantized_nn::{layer_norm_no_bias, linear_no_bias, Embedding, Linear}; pub use crate::quantized_var_builder::VarBuilder; /// MPT model used by replit-code-v1_5-3b /// https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/modeling_mpt.py use candle::{IndexOp, Module, Result, Tensor, D}; use candle_nn::L...
candle/candle-transformers/src/models/quantized_mpt.rs/0
{ "file_path": "candle/candle-transformers/src/models/quantized_mpt.rs", "repo_id": "candle", "token_count": 3726 }
48
use crate::models::with_tracing::{conv2d, linear, Conv2d, Linear}; use candle::{Module, ModuleT, Result, Tensor, D}; use candle_nn::{conv2d_no_bias, layer_norm, Activation, Conv2dConfig, VarBuilder}; use serde::Deserialize; use std::collections::HashMap; // https://github.com/huggingface/transformers/blob/main/src/tra...
candle/candle-transformers/src/models/segformer.rs/0
{ "file_path": "candle/candle-transformers/src/models/segformer.rs", "repo_id": "candle", "token_count": 11365 }
49
#![allow(dead_code)] //! # Diffusion pipelines and models //! //! Noise schedulers can be used to set the trade-off between //! inference speed and quality. use candle::{Result, Tensor}; pub trait SchedulerConfig: std::fmt::Debug + Send + Sync { fn build(&self, inference_steps: usize) -> Result<Box<dyn Scheduler>>...
candle/candle-transformers/src/models/stable_diffusion/schedulers.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/schedulers.rs", "repo_id": "candle", "token_count": 934 }
50
use candle::{Module, Result, Tensor}; use candle_nn::{linear, Linear, VarBuilder}; // A simplified version of: // https://github.com/huggingface/diffusers/blob/119ad2c3dc8a8fb8446a83f4bf6f20929487b47f/src/diffusers/models/attention_processor.py#L38 #[derive(Debug)] pub struct Attention { to_q: Linear, to_k: Li...
candle/candle-transformers/src/models/wuerstchen/attention_processor.rs/0
{ "file_path": "candle/candle-transformers/src/models/wuerstchen/attention_processor.rs", "repo_id": "candle", "token_count": 2076 }
51
[package] name = "candle-wasm-example-bert" version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true keywords.workspace = true categories.workspace = true license.workspace = true [dependencies] candle = { workspace = true } candle-nn = { workspace = true } candle-tran...
candle/candle-wasm-examples/bert/Cargo.toml/0
{ "file_path": "candle/candle-wasm-examples/bert/Cargo.toml", "repo_id": "candle", "token_count": 304 }
52
import snarkdown from "https://cdn.skypack.dev/snarkdown"; import hljs from "https://cdn.skypack.dev/highlight.js"; // models base url const MODELS = { moondream2_q4k: { base_url: "https://huggingface.co/santiagomed/candle-moondream/resolve/main/", model: "model-q4_0.gguf", tokenizer: "tokenizer.jso...
candle/candle-wasm-examples/moondream/code.js/0
{ "file_path": "candle/candle-wasm-examples/moondream/code.js", "repo_id": "candle", "token_count": 2873 }
53
//load the candle SAM Model wasm module import init, { Model } from "./build/m.js"; async function fetchArrayBuffer(url, cacheModel = true) { if (!cacheModel) return new Uint8Array(await (await fetch(url)).arrayBuffer()); const cacheName = "sam-candle-cache"; const cache = await caches.open(cacheName); con...
candle/candle-wasm-examples/segment-anything/samWorker.js/0
{ "file_path": "candle/candle-wasm-examples/segment-anything/samWorker.js", "repo_id": "candle", "token_count": 1747 }
54
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Welcome to Candle!</title> <link data-trunk rel="copy-file" href="mel_filters.safetensors" /> <!-- samples --> <link data-trunk rel="copy-dir" href="audios" /> <!-- tiny.en --> <link data-trunk rel="copy-dir" href="whi...
candle/candle-wasm-examples/whisper/index.html/0
{ "file_path": "candle/candle-wasm-examples/whisper/index.html", "repo_id": "candle", "token_count": 523 }
55
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle YOLOv8 Rust/WASM</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <style> ...
candle/candle-wasm-examples/yolo/lib-example.html/0
{ "file_path": "candle/candle-wasm-examples/yolo/lib-example.html", "repo_id": "candle", "token_count": 9649 }
56
use candle::quantized::{gguf_file, GgmlDType, QTensor}; use candle::{Device, Result}; use clap::{Parser, Subcommand, ValueEnum}; use rayon::prelude::*; #[derive(ValueEnum, Debug, Clone)] enum QuantizationMode { /// The default quantization includes all 2d tensors, except the output tensor which always /// uses...
candle/tensor-tools/src/main.rs/0
{ "file_path": "candle/tensor-tools/src/main.rs", "repo_id": "candle", "token_count": 8827 }
57
engine-strict=true
chat-ui/.npmrc/0
{ "file_path": "chat-ui/.npmrc", "repo_id": "chat-ui", "token_count": 7 }
58
{{- if $.Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }} labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: {{ if $.Values.ingress.clas...
chat-ui/chart/templates/ingress.yaml/0
{ "file_path": "chat-ui/chart/templates/ingress.yaml", "repo_id": "chat-ui", "token_count": 400 }
59
# LangServe | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | LangChain applications that are deployed using LangServe can be called with the following config: ```ini MODELS=`[ { "name"...
chat-ui/docs/source/configuration/models/providers/langserve.md/0
{ "file_path": "chat-ui/docs/source/configuration/models/providers/langserve.md", "repo_id": "chat-ui", "token_count": 220 }
60