text stringlengths 7 324k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 463 |
|---|---|---|---|
# 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/src/transformers/models/swinv2/configuration_swinv2.py/0 | {
"file_path": "transformers/src/transformers/models/swinv2/configuration_swinv2.py",
"repo_id": "transformers",
"token_count": 2994
} | 363 |
# coding=utf-8
# Copyright 2020 T5 Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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
#
# ... | transformers/src/transformers/models/t5/modeling_tf_t5.py/0 | {
"file_path": "transformers/src/transformers/models/t5/modeling_tf_t5.py",
"repo_id": "transformers",
"token_count": 33777
} | 364 |
# 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/src/transformers/models/univnet/modeling_univnet.py/0 | {
"file_path": "transformers/src/transformers/models/univnet/modeling_univnet.py",
"repo_id": "transformers",
"token_count": 11259
} | 365 |
# 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/src/transformers/models/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py/0 | {
"file_path": "transformers/src/transformers/models/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py",
"repo_id": "transformers",
"token_count": 9976
} | 366 |
# 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/src/transformers/models/vit_hybrid/configuration_vit_hybrid.py/0 | {
"file_path": "transformers/src/transformers/models/vit_hybrid/configuration_vit_hybrid.py",
"repo_id": "transformers",
"token_count": 3255
} | 367 |
# coding=utf-8
# Copyright 2022 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/src/transformers/models/wav2vec2_conformer/convert_wav2vec2_conformer_original_pytorch_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/wav2vec2_conformer/convert_wav2vec2_conformer_original_pytorch_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 6286
} | 368 |
# coding=utf-8
# Copyright 2021 The Fairseq Authors 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/LICE... | transformers/src/transformers/models/xglm/modeling_tf_xglm.py/0 | {
"file_path": "transformers/src/transformers/models/xglm/modeling_tf_xglm.py",
"repo_id": "transformers",
"token_count": 20055
} | 369 |
# 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... | transformers/src/transformers/onnx/config.py/0 | {
"file_path": "transformers/src/transformers/onnx/config.py",
"repo_id": "transformers",
"token_count": 13946
} | 370 |
from typing import List, Union
import numpy as np
from ..utils import (
ExplicitEnum,
add_end_docstrings,
is_tf_available,
is_torch_available,
is_vision_available,
logging,
requires_backends,
)
from .base import Pipeline, build_pipeline_init_args
if is_vision_available():
from PIL im... | transformers/src/transformers/pipelines/image_classification.py/0 | {
"file_path": "transformers/src/transformers/pipelines/image_classification.py",
"repo_id": "transformers",
"token_count": 3392
} | 371 |
from typing import Union
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging
from .base import Pipeline, build_pipeline_init_args
if is_vision_available():
from PIL import Image
from ..image_utils import load_image
if is_torch_available():
from ..models.auto.modelin... | transformers/src/transformers/pipelines/visual_question_answering.py/0 | {
"file_path": "transformers/src/transformers/pipelines/visual_question_answering.py",
"repo_id": "transformers",
"token_count": 2748
} | 372 |
import json
import uuid
from typing import Optional
import requests
from huggingface_hub import Discussion, HfApi, get_repo_discussions
from .utils import cached_file, logging
logger = logging.get_logger(__name__)
def previous_pr(api: HfApi, model_id: str, pr_title: str, token: str) -> Optional["Discussion"]:
... | transformers/src/transformers/safetensors_conversion.py/0 | {
"file_path": "transformers/src/transformers/safetensors_conversion.py",
"repo_id": "transformers",
"token_count": 1821
} | 373 |
#!/usr/bin/env python
# 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/L... | transformers/src/transformers/tools/image_captioning.py/0 | {
"file_path": "transformers/src/transformers/tools/image_captioning.py",
"repo_id": "transformers",
"token_count": 564
} | 374 |
# 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/src/transformers/training_args.py/0 | {
"file_path": "transformers/src/transformers/training_args.py",
"repo_id": "transformers",
"token_count": 60204
} | 375 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class ASTFeatureExtractor(metaclass=DummyObject):
_backends = ["speech"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["speech"])
class Speech2TextFeatureEx... | transformers/src/transformers/utils/dummy_speech_objects.py/0 | {
"file_path": "transformers/src/transformers/utils/dummy_speech_objects.py",
"repo_id": "transformers",
"token_count": 166
} | 376 |
# 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/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_flax_{{cookiecutter.lowercase_modelname}}.py/0 | {
"file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_flax_{{cookiecutter.lowercase_modelname}}.py",
"repo_id": "transformers",
"token_count": 12273
} | 377 |
{
"modelname": "TemplateTF",
"uppercase_modelname": "TEMPLATE_TF",
"lowercase_modelname": "template_tf",
"camelcase_modelname": "TemplateTf",
"authors": "The HuggingFace Team",
"checkpoint_identifier": "brand-new-bert-base-cased",
"tokenizer_type": "Based on BERT",
"generate_tensorflow_pytorch_and_flax"... | transformers/templates/adding_a_new_model/tests/tf-encoder-bert-tokenizer.json/0 | {
"file_path": "transformers/templates/adding_a_new_model/tests/tf-encoder-bert-tokenizer.json",
"repo_id": "transformers",
"token_count": 148
} | 378 |
{
"feature_extractor_type": "Wav2Vec2FeatureExtractor",
"processor_class": "Wav2Vec2Processor"
}
| transformers/tests/fixtures/dummy_feature_extractor_config.json/0 | {
"file_path": "transformers/tests/fixtures/dummy_feature_extractor_config.json",
"repo_id": "transformers",
"token_count": 42
} | 379 |
# coding=utf-8
# Copyright 2020 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/generation/test_stopping_criteria.py/0 | {
"file_path": "transformers/tests/generation/test_stopping_criteria.py",
"repo_id": "transformers",
"token_count": 1456
} | 380 |
# 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/bark/test_modeling_bark.py/0 | {
"file_path": "transformers/tests/models/bark/test_modeling_bark.py",
"repo_id": "transformers",
"token_count": 23288
} | 381 |
# 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/bert/test_modeling_bert.py/0 | {
"file_path": "transformers/tests/models/bert/test_modeling_bert.py",
"repo_id": "transformers",
"token_count": 12412
} | 382 |
#!/usr/bin/env python3
# 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/LICENS... | transformers/tests/models/blenderbot_small/test_tokenization_blenderbot_small.py/0 | {
"file_path": "transformers/tests/models/blenderbot_small/test_tokenization_blenderbot_small.py",
"repo_id": "transformers",
"token_count": 1514
} | 383 |
# coding=utf-8
# Copyright 2023 The Intel Labs Team Authors, The Microsoft Research Team Authors and 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 a... | transformers/tests/models/bridgetower/test_image_processing_bridgetower.py/0 | {
"file_path": "transformers/tests/models/bridgetower/test_image_processing_bridgetower.py",
"repo_id": "transformers",
"token_count": 2508
} | 384 |
# 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... | transformers/tests/models/chinese_clip/test_processor_chinese_clip.py/0 | {
"file_path": "transformers/tests/models/chinese_clip/test_processor_chinese_clip.py",
"repo_id": "transformers",
"token_count": 3436
} | 385 |
# 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/clvp/test_feature_extraction_clvp.py/0 | {
"file_path": "transformers/tests/models/clvp/test_feature_extraction_clvp.py",
"repo_id": "transformers",
"token_count": 4543
} | 386 |
# 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/cvt/test_modeling_cvt.py/0 | {
"file_path": "transformers/tests/models/cvt/test_modeling_cvt.py",
"repo_id": "transformers",
"token_count": 4333
} | 387 |
# 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/decision_transformer/test_modeling_decision_transformer.py/0 | {
"file_path": "transformers/tests/models/decision_transformer/test_modeling_decision_transformer.py",
"repo_id": "transformers",
"token_count": 4241
} | 388 |
# 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_dpr.py/0 | {
"file_path": "transformers/tests/models/dpr/test_modeling_dpr.py",
"repo_id": "transformers",
"token_count": 5466
} | 389 |
# 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/electra/test_modeling_electra.py/0 | {
"file_path": "transformers/tests/models/electra/test_modeling_electra.py",
"repo_id": "transformers",
"token_count": 8357
} | 390 |
# Copyright 2022 Meta Platforms authors and 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
#
# U... | transformers/tests/models/flava/test_processor_flava.py/0 | {
"file_path": "transformers/tests/models/flava/test_processor_flava.py",
"repo_id": "transformers",
"token_count": 4041
} | 391 |
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from transformers import AutoConfig, TFGPT2LMHeadModel, is_keras_nlp_available, is_tf_available
from transformers.models.gpt2.tokenization_gpt2 import GPT2Tokenizer
from transformers.testing_utils import require_keras_nlp, require_tf, slo... | transformers/tests/models/gpt2/test_tokenization_gpt2_tf.py/0 | {
"file_path": "transformers/tests/models/gpt2/test_tokenization_gpt2_tf.py",
"repo_id": "transformers",
"token_count": 2530
} | 392 |
# 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/gptj/test_modeling_tf_gptj.py/0 | {
"file_path": "transformers/tests/models/gptj/test_modeling_tf_gptj.py",
"repo_id": "transformers",
"token_count": 8856
} | 393 |
# coding=utf-8
# Copyright 2023 Microsoft Research and 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/L... | transformers/tests/models/kosmos2/test_modeling_kosmos2.py/0 | {
"file_path": "transformers/tests/models/kosmos2/test_modeling_kosmos2.py",
"repo_id": "transformers",
"token_count": 15852
} | 394 |
# coding=utf-8
# Copyright 2018 LXMERT Authors, 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 b... | transformers/tests/models/lxmert/test_tokenization_lxmert.py/0 | {
"file_path": "transformers/tests/models/lxmert/test_tokenization_lxmert.py",
"repo_id": "transformers",
"token_count": 1313
} | 395 |
# 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/mobilebert/test_modeling_mobilebert.py/0 | {
"file_path": "transformers/tests/models/mobilebert/test_modeling_mobilebert.py",
"repo_id": "transformers",
"token_count": 7069
} | 396 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team, Microsoft Corporation.
#
# 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... | transformers/tests/models/mpnet/test_modeling_mpnet.py/0 | {
"file_path": "transformers/tests/models/mpnet/test_modeling_mpnet.py",
"repo_id": "transformers",
"token_count": 4626
} | 397 |
# 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/oneformer/test_modeling_oneformer.py/0 | {
"file_path": "transformers/tests/models/oneformer/test_modeling_oneformer.py",
"repo_id": "transformers",
"token_count": 10046
} | 398 |
# 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/models/owlvit/test_processor_owlvit.py/0 | {
"file_path": "transformers/tests/models/owlvit/test_processor_owlvit.py",
"repo_id": "transformers",
"token_count": 4354
} | 399 |
# 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/persimmon/test_modeling_persimmon.py/0 | {
"file_path": "transformers/tests/models/persimmon/test_modeling_persimmon.py",
"repo_id": "transformers",
"token_count": 8403
} | 400 |
# 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/pop2piano/test_feature_extraction_pop2piano.py/0 | {
"file_path": "transformers/tests/models/pop2piano/test_feature_extraction_pop2piano.py",
"repo_id": "transformers",
"token_count": 4962
} | 401 |
# 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/regnet/test_modeling_tf_regnet.py/0 | {
"file_path": "transformers/tests/models/regnet/test_modeling_tf_regnet.py",
"repo_id": "transformers",
"token_count": 4911
} | 402 |
# 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/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py/0 | {
"file_path": "transformers/tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py",
"repo_id": "transformers",
"token_count": 10713
} | 403 |
# 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/tvlt/test_feature_extraction_tvlt.py/0 | {
"file_path": "transformers/tests/models/tvlt/test_feature_extraction_tvlt.py",
"repo_id": "transformers",
"token_count": 3058
} | 404 |
# 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/unispeech_sat/test_modeling_unispeech_sat.py/0 | {
"file_path": "transformers/tests/models/unispeech_sat/test_modeling_unispeech_sat.py",
"repo_id": "transformers",
"token_count": 17114
} | 405 |
# coding=utf-8
# Copyright 2022 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... | transformers/tests/models/vision_encoder_decoder/test_modeling_tf_vision_encoder_decoder.py/0 | {
"file_path": "transformers/tests/models/vision_encoder_decoder/test_modeling_tf_vision_encoder_decoder.py",
"repo_id": "transformers",
"token_count": 18532
} | 406 |
# 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": 14404
} | 407 |
# 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_text2text_generation.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_text2text_generation.py",
"repo_id": "transformers",
"token_count": 2111
} | 408 |
# Testing mixed int8 quantization

The following is the recipe on how to effectively debug `bitsandbytes` integration on Hugging Face `transformers`.
## Library requirements
+ `transformers>=4.22.... | transformers/tests/quantization/bnb/README.md/0 | {
"file_path": "transformers/tests/quantization/bnb/README.md",
"repo_id": "transformers",
"token_count": 1405
} | 409 |
#!/usr/bin/env python
# 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/LI... | transformers/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py/0 | {
"file_path": "transformers/tests/sagemaker/scripts/pytorch/run_glue_model_parallelism.py",
"repo_id": "transformers",
"token_count": 9571
} | 410 |
# 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_common.py/0 | {
"file_path": "transformers/tests/test_modeling_common.py",
"repo_id": "transformers",
"token_count": 96822
} | 411 |
# 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_document_question_answering.py/0 | {
"file_path": "transformers/tests/tools/test_document_question_answering.py",
"repo_id": "transformers",
"token_count": 756
} | 412 |
# 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/trainer/test_trainer_distributed.py/0 | {
"file_path": "transformers/tests/trainer/test_trainer_distributed.py",
"repo_id": "transformers",
"token_count": 4112
} | 413 |
# 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_hf_argparser.py/0 | {
"file_path": "transformers/tests/utils/test_hf_argparser.py",
"repo_id": "transformers",
"token_count": 6348
} | 414 |
# 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/check_copies.py/0 | {
"file_path": "transformers/utils/check_copies.py",
"repo_id": "transformers",
"token_count": 21805
} | 415 |
import argparse
import json
import os
import time
import zipfile
from get_ci_error_statistics import download_artifact, get_artifacts_links
from transformers import logging
logger = logging.get_logger(__name__)
def extract_warnings_from_single_artifact(artifact_path, targets):
"""Extract warnings from a downl... | transformers/utils/extract_warnings.py/0 | {
"file_path": "transformers/utils/extract_warnings.py",
"repo_id": "transformers",
"token_count": 2110
} | 416 |
from transformers import PretrainedConfig
class CustomConfig(PretrainedConfig):
model_type = "custom"
def __init__(self, attribute=1, **kwargs):
self.attribute = attribute
super().__init__(**kwargs)
class NoSuperInitConfig(PretrainedConfig):
model_type = "custom"
def __init__(self,... | transformers/utils/test_module/custom_configuration.py/0 | {
"file_path": "transformers/utils/test_module/custom_configuration.py",
"repo_id": "transformers",
"token_count": 136
} | 417 |
# pip install openrlbenchmark==0.2.1a5
# see https://github.com/openrlbenchmark/openrlbenchmark#get-started for documentation
echo "we deal with $TAGS_STRING"
python -m openrlbenchmark.rlops_multi_metrics \
--filters '?we=huggingface&wpn=trl&xaxis=_step&ceik=trl_ppo_trainer_config.value.reward_model&cen=trl_ppo_tr... | trl/benchmark/benchmark_level2_plot.sh/0 | {
"file_path": "trl/benchmark/benchmark_level2_plot.sh",
"repo_id": "trl",
"token_count": 632
} | 418 |
# Detoxifying a Language Model using PPO
Language models (LMs) are known to sometimes generate toxic outputs. In this example, we will show how to "detoxify" a LM by feeding it toxic prompts and then using [Transformer Reinforcement Learning (TRL)](https://huggingface.co/docs/trl/index) and Proximal Policy Optimizatio... | trl/docs/source/detoxifying_a_lm.mdx/0 | {
"file_path": "trl/docs/source/detoxifying_a_lm.mdx",
"repo_id": "trl",
"token_count": 3783
} | 419 |
# Sentiment Tuning Examples
The notebooks and scripts in this examples show how to fine-tune a model with a sentiment classifier (such as `lvwerra/distilbert-imdb`).
Here's an overview of the notebooks and scripts in the [trl repository](https://github.com/huggingface/trl/tree/main/examples):
| File ... | trl/docs/source/sentiment_tuning.mdx/0 | {
"file_path": "trl/docs/source/sentiment_tuning.mdx",
"repo_id": "trl",
"token_count": 2400
} | 420 |
# 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/tools/triviaqa.py/0 | {
"file_path": "trl/examples/research_projects/tools/triviaqa.py",
"repo_id": "trl",
"token_count": 2555
} | 421 |
[metadata]
license_file = LICENSE
| trl/setup.cfg/0 | {
"file_path": "trl/setup.cfg",
"repo_id": "trl",
"token_count": 11
} | 422 |
# 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/tests/test_kto_trainer.py/0 | {
"file_path": "trl/tests/test_kto_trainer.py",
"repo_id": "trl",
"token_count": 6401
} | 423 |
# 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... | trl/trl/import_utils.py/0 | {
"file_path": "trl/trl/import_utils.py",
"repo_id": "trl",
"token_count": 1207
} | 424 |
# 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... | trl/trl/trainer/ppo_config.py/0 | {
"file_path": "trl/trl/trainer/ppo_config.py",
"repo_id": "trl",
"token_count": 2849
} | 425 |
# 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/benchmarks/big_model_inference.py/0 | {
"file_path": "accelerate/benchmarks/big_model_inference.py",
"repo_id": "accelerate",
"token_count": 2241
} | 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/deferring_execution.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/deferring_execution.md",
"repo_id": "accelerate",
"token_count": 1350
} | 1 |
<!--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 applicable law or agreed... | accelerate/docs/source/usage_guides/local_sgd.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/local_sgd.md",
"repo_id": "accelerate",
"token_count": 1491
} | 2 |
# 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": 7850
} | 3 |
# 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 required by appl... | accelerate/examples/inference/bert.py/0 | {
"file_path": "accelerate/examples/inference/bert.py",
"repo_id": "accelerate",
"token_count": 762
} | 4 |
# 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/setup.py/0 | {
"file_path": "accelerate/setup.py",
"repo_id": "accelerate",
"token_count": 1649
} | 5 |
#!/usr/bin/env python
# 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
#
# Unles... | accelerate/src/accelerate/commands/estimate.py/0 | {
"file_path": "accelerate/src/accelerate/commands/estimate.py",
"repo_id": "accelerate",
"token_count": 4241
} | 6 |
# 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/logging.py/0 | {
"file_path": "accelerate/src/accelerate/logging.py",
"repo_id": "accelerate",
"token_count": 1789
} | 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/test_utils/scripts/test_notebook.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_notebook.py",
"repo_id": "accelerate",
"token_count": 502
} | 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/megatron_lm.py/0 | {
"file_path": "accelerate/src/accelerate/utils/megatron_lm.py",
"repo_id": "accelerate",
"token_count": 26949
} | 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_accelerator.py/0 | {
"file_path": "accelerate/tests/test_accelerator.py",
"repo_id": "accelerate",
"token_count": 7862
} | 10 |
# 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": 693
} | 11 |
# 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
} | 12 |
# Model arguments
model_name_or_path: gpt2
model_revision: main
torch_dtype: bfloat16
# Data training arguments
dataset_mixer:
yhavinga/mc4_nl_cleaned: 1.0
dataset_splits:
- train
dataset_configs:
- tiny
preprocessing_num_workers: 12
# SFT trainer config
bf16: true
do_eval: False
evaluation_strategy: "no"
gradi... | alignment-handbook/recipes/gpt2-nl/cpt/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/gpt2-nl/cpt/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 370
} | 13 |
# Instructions to Replicate Zephyr 7B Gemma
Similar to how we trained Zephyr 7B Beta in our [technical report](https://huggingface.co/papers/2310.16944), training this model proceeds in two steps:
1. Apply SFT to fine-tune Gemma 7B on the Deita 10k dataset ([link](https://huggingface.co/datasets/HuggingFaceH4/deita-... | alignment-handbook/recipes/zephyr-7b-gemma/README.md/0 | {
"file_path": "alignment-handbook/recipes/zephyr-7b-gemma/README.md",
"repo_id": "alignment-handbook",
"token_count": 505
} | 14 |
# Model arguments
model_name_or_path: alignment-handbook/zephyr-7b-sft-full
# Data training arguments
# For definitions, see: src/h4/training/config.py
dataset_mixer:
HuggingFaceH4/ultrafeedback_binarized: 1.0
dataset_splits:
- train_prefs
- test_prefs
preprocessing_num_workers: 12
# DPOTrainer arguments
bf16: true... | alignment-handbook/tests/fixtures/config_dpo_full.yaml/0 | {
"file_path": "alignment-handbook/tests/fixtures/config_dpo_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 329
} | 15 |
# Writing a custom kernel
| candle/candle-book/src/cuda/writing.md/0 | {
"file_path": "candle/candle-book/src/cuda/writing.md",
"repo_id": "candle",
"token_count": 6
} | 16 |
# Training
Training starts with data. We're going to use the huggingface hub and
start with the Hello world dataset of machine learning, MNIST.
Let's start with downloading `MNIST` from [huggingface](https://huggingface.co/datasets/mnist).
This requires [`hf-hub`](https://github.com/huggingface/hf-hub).
```bash
ca... | candle/candle-book/src/training/training.md/0 | {
"file_path": "candle/candle-book/src/training/training.md",
"repo_id": "candle",
"token_count": 361
} | 17 |
use crate::op::{BinaryOp, Op, ReduceOp, UnaryOp};
use crate::{Error, Result, Tensor, TensorId};
use std::collections::HashMap;
// arg has been reduced to node via reduce_dims, expand it back to arg.
// This has to handle keepdims.
fn broadcast_back(arg: &Tensor, node: &Tensor, reduced_dims: &[usize]) -> Result<Tensor>... | candle/candle-core/src/backprop.rs/0 | {
"file_path": "candle/candle-core/src/backprop.rs",
"repo_id": "candle",
"token_count": 23335
} | 18 |
#![allow(dead_code)]
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{CpuStorage, DType, Error, Layout, Result, Shape};
#[derive(Debug, Clone)]
pub struct MetalDevice;
#[derive(Debug)]
pub struct MetalStorage;
#[derive(thiserror::Error, Debug)]
pub enum MetalError {
#[error("{0}")]
Message(... | candle/candle-core/src/dummy_metal_backend.rs/0 | {
"file_path": "candle/candle-core/src/dummy_metal_backend.rs",
"repo_id": "candle",
"token_count": 2690
} | 19 |
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
} | 20 |
use candle_core::backend::BackendStorage;
use candle_core::cpu_backend;
use candle_core::test_utils::to_vec1_round;
use candle_core::{CpuStorage, CustomOp1, DType, Device, Error, Layout, Result, Shape, Tensor};
fn fwd<T: num_traits::Float>(v: T, alpha: f64) -> T {
if v.is_sign_positive() {
v
} else {
... | candle/candle-core/tests/custom_op_tests.rs/0 | {
"file_path": "candle/candle-core/tests/custom_op_tests.rs",
"repo_id": "candle",
"token_count": 1542
} | 21 |
# candle-starcoder: code generation model
[StarCoder/BigCode](https://huggingface.co/bigcode/starcoderbase-1b) is a LLM
model specialized to code generation. The initial model was trained on 80
programming languages.
## Running some example
```bash
cargo run --example bigcode --release -- --prompt "fn fact(n: u64) -... | candle/candle-examples/examples/bigcode/README.md/0 | {
"file_path": "candle/candle-examples/examples/bigcode/README.md",
"repo_id": "candle",
"token_count": 180
} | 22 |
//! EfficientNet implementation.
//!
//! https://arxiv.org/abs/1905.11946
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{DType, IndexOp, D};
use candle_nn::{Module, VarBuilder};
use candle_transformers::models::efficientnet::{EfficientNet,... | candle/candle-examples/examples/efficientnet/main.rs/0 | {
"file_path": "candle/candle-examples/examples/efficientnet/main.rs",
"repo_id": "candle",
"token_count": 1414
} | 23 |
use candle::backend::BackendStorage;
use candle::{CpuStorage, CustomOp1, DType, Device, IndexOp, Layout, Result, Shape, Tensor, D};
use candle_nn::{Embedding, Linear, Module, RmsNorm};
use cudarc::nccl::safe::{Comm, ReduceOp};
use half::f16;
use serde::Deserialize;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use sup... | candle/candle-examples/examples/llama_multiprocess/model.rs/0 | {
"file_path": "candle/candle-examples/examples/llama_multiprocess/model.rs",
"repo_id": "candle",
"token_count": 7542
} | 24 |
# candle-mobileone
[MobileOne: An Improved One millisecond Mobile Backbone](https://arxiv.org/abs/2206.04040).
This candle implementation uses a pre-trained MobileOne network for inference. The
classification head has been trained on the ImageNet dataset and returns the
probabilities for the top-5 classes.
## Runnin... | candle/candle-examples/examples/mobileone/README.md/0 | {
"file_path": "candle/candle-examples/examples/mobileone/README.md",
"repo_id": "candle",
"token_count": 254
} | 25 |
import gymnasium as gym
import numpy as np
from collections import deque
from PIL import Image
from multiprocessing import Process, Pipe
# atari_wrappers.py
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset.
No... | candle/candle-examples/examples/reinforcement-learning/atari_wrappers.py/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/atari_wrappers.py",
"repo_id": "candle",
"token_count": 4740
} | 26 |
[
{
"index": 1,
"color": "#787878",
"label": "wall"
},
{
"index": 2,
"color": "#B47878",
"label": "building;edifice"
},
{
"index": 3,
"color": "#06E6E6",
"label": "sky"
},
{
"index": 4,
"color": "#503232",
"label": "floor;flooring"
},
{
"index": 5,
... | candle/candle-examples/examples/segformer/assets/labels.json/0 | {
"file_path": "candle/candle-examples/examples/segformer/assets/labels.json",
"repo_id": "candle",
"token_count": 6397
} | 27 |
use symphonia::core::audio::{AudioBufferRef, Signal};
use symphonia::core::codecs::{DecoderOptions, CODEC_TYPE_NULL};
use symphonia::core::conv::FromSample;
fn conv<T>(samples: &mut Vec<f32>, data: std::borrow::Cow<symphonia::core::audio::AudioBuffer<T>>)
where
T: symphonia::core::sample::Sample,
f32: symphoni... | candle/candle-examples/examples/whisper/pcm_decode.rs/0 | {
"file_path": "candle/candle-examples/examples/whisper/pcm_decode.rs",
"repo_id": "candle",
"token_count": 1267
} | 28 |
use candle::{Result, Tensor};
// https://github.com/facebookresearch/audiocraft/blob/69fea8b290ad1b4b40d28f92d1dfc0ab01dbab85/audiocraft/data/audio_utils.py#L57
pub fn normalize_loudness(
wav: &Tensor,
sample_rate: u32,
loudness_compressor: bool,
) -> Result<Tensor> {
let energy = wav.sqr()?.mean_all()... | candle/candle-examples/src/audio.rs/0 | {
"file_path": "candle/candle-examples/src/audio.rs",
"repo_id": "candle",
"token_count": 458
} | 29 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
#include "cute/algorithm/copy.hpp"
#include "cutlass/cutlass.h"
#include "cutlass/layout/layout.h"
#include <cu... | candle/candle-flash-attn/kernels/kernel_traits.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/kernel_traits.h",
"repo_id": "candle",
"token_count": 9290
} | 30 |
#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
} | 31 |
#include <metal_stdlib>
using namespace metal;
template<typename TYPENAME, typename INDEX_TYPENAME>
METAL_FUNC void index(
constant size_t &dst_size,
constant size_t &left_size,
constant size_t &src_dim_size,
constant size_t &right_size,
constant size_t &ids_size,
const device TYPENAME *i... | candle/candle-metal-kernels/src/indexing.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/indexing.metal",
"repo_id": "candle",
"token_count": 3203
} | 32 |
/// This example contains some simple benchmarks so that it's easy to run them in perf etc.
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::quantized::GgmlType;
use candle::{CpuStorage, Device, Layout, Module, Result, Shape, Tensor, D};
use c... | candle/candle-nn/examples/cpu_benchmarks.rs/0 | {
"file_path": "candle/candle-nn/examples/cpu_benchmarks.rs",
"repo_id": "candle",
"token_count": 5283
} | 33 |
//! A sequential layer used to chain multiple layers and closures.
use candle::{Module, Result, Tensor};
/// A sequential layer combining multiple other layers.
pub struct Sequential {
layers: Vec<Box<dyn Module>>,
}
/// Creates a new empty sequential layer.
pub fn seq() -> Sequential {
Sequential { layers: v... | candle/candle-nn/src/sequential.rs/0 | {
"file_path": "candle/candle-nn/src/sequential.rs",
"repo_id": "candle",
"token_count": 705
} | 34 |
//
// WARNING: This file is automatically generated! Please edit onnx.in.proto.
//
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package onnx;
// Overview
//
// ONNX is an open specification that is comprised of the following components:
//
// 1) A definition of an extensible computation graph model... | candle/candle-onnx/src/onnx.proto3/0 | {
"file_path": "candle/candle-onnx/src/onnx.proto3",
"repo_id": "candle",
"token_count": 10183
} | 35 |
# see https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/container.py
from .module import Module
from typing import (
Any,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
overload,
Tuple,
TypeVar,
Union,
)
from collections import OrderedDict, abc as container_abcs
import ... | candle/candle-pyo3/py_src/candle/nn/container.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/container.py",
"repo_id": "candle",
"token_count": 7602
} | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.