text stringlengths 7 328k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 471 |
|---|---|---|---|
# coding=utf-8
# Copyright 2020 Google Research and 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 re... | transformers/src/transformers/models/tapas/modeling_tapas.py/0 | {
"file_path": "transformers/src/transformers/models/tapas/modeling_tapas.py",
"repo_id": "transformers",
"token_count": 45608
} | 363 |
# coding=utf-8
# Copyright 2024 Microsoft Research 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 req... | transformers/src/transformers/models/udop/modeling_udop.py/0 | {
"file_path": "transformers/src/transformers/models/udop/modeling_udop.py",
"repo_id": "transformers",
"token_count": 40201
} | 364 |
# coding=utf-8
# Copyright 2021 The Fairseq Authors 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/... | transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py/0 | {
"file_path": "transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py",
"repo_id": "transformers",
"token_count": 36838
} | 365 |
# coding=utf-8
# Copyright 2022 Multimedia Computing Group, Nanjing University 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... | transformers/src/transformers/models/videomae/modeling_videomae.py/0 | {
"file_path": "transformers/src/transformers/models/videomae/modeling_videomae.py",
"repo_id": "transformers",
"token_count": 20369
} | 366 |
# 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/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py/0 | {
"file_path": "transformers/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py",
"repo_id": "transformers",
"token_count": 14360
} | 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/vit_msn/convert_msn_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/vit_msn/convert_msn_to_pytorch.py",
"repo_id": "transformers",
"token_count": 4263
} | 368 |
# coding=utf-8
# Copyright 2024 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_bert/convert_wav2vec2_seamless_checkpoint.py/0 | {
"file_path": "transformers/src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py",
"repo_id": "transformers",
"token_count": 3156
} | 369 |
# 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/src/transformers/models/whisper/__init__.py/0 | {
"file_path": "transformers/src/transformers/models/whisper/__init__.py",
"repo_id": "transformers",
"token_count": 1768
} | 370 |
# coding=utf-8
# Copyright 2020 The Microsoft Authors and 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
#
# Unl... | transformers/src/transformers/models/xlm_prophetnet/configuration_xlm_prophetnet.py/0 | {
"file_path": "transformers/src/transformers/models/xlm_prophetnet/configuration_xlm_prophetnet.py",
"repo_id": "transformers",
"token_count": 3498
} | 371 |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/xlnet/convert_xlnet_original_tf_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/xlnet/convert_xlnet_original_tf_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 1468
} | 372 |
# 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/yoso/configuration_yoso.py/0 | {
"file_path": "transformers/src/transformers/models/yoso/configuration_yoso.py",
"repo_id": "transformers",
"token_count": 2581
} | 373 |
import uuid
import warnings
from typing import Any, Dict, List, Union
from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
from .base import Pipeline, build_pipeline_init_args
if is_tf_available():
import tensorflow as tf
if is_torch_available():
import torch
logger = loggi... | transformers/src/transformers/pipelines/conversational.py/0 | {
"file_path": "transformers/src/transformers/pipelines/conversational.py",
"repo_id": "transformers",
"token_count": 5581
} | 374 |
import inspect
import warnings
from typing import Dict
import numpy as np
from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
from .base import GenericTensor, Pipeline, build_pipeline_init_args
if is_tf_available():
from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SE... | transformers/src/transformers/pipelines/text_classification.py/0 | {
"file_path": "transformers/src/transformers/pipelines/text_classification.py",
"repo_id": "transformers",
"token_count": 4187
} | 375 |
# 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... | transformers/src/transformers/quantizers/quantizer_awq.py/0 | {
"file_path": "transformers/src/transformers/quantizers/quantizer_awq.py",
"repo_id": "transformers",
"token_count": 1938
} | 376 |
#!/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/__init__.py/0 | {
"file_path": "transformers/src/transformers/tools/__init__.py",
"repo_id": "transformers",
"token_count": 984
} | 377 |
#!/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/translation.py/0 | {
"file_path": "transformers/src/transformers/tools/translation.py",
"repo_id": "transformers",
"token_count": 4126
} | 378 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class FlaxForcedBOSTokenLogitsProcessor(metaclass=DummyObject):
_backends = ["flax"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["flax"])
class FlaxForced... | transformers/src/transformers/utils/dummy_flax_objects.py/0 | {
"file_path": "transformers/src/transformers/utils/dummy_flax_objects.py",
"repo_id": "transformers",
"token_count": 14053
} | 379 |
# 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/src/transformers/utils/import_utils.py/0 | {
"file_path": "transformers/src/transformers/utils/import_utils.py",
"repo_id": "transformers",
"token_count": 19475
} | 380 |
<!---
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 applicable law or ... | transformers/templates/adding_a_new_model/README.md/0 | {
"file_path": "transformers/templates/adding_a_new_model/README.md",
"repo_id": "transformers",
"token_count": 2800
} | 381 |
Currently the following model proposals are available:
- <s>[BigBird (Google)](./ADD_BIG_BIRD.md)</s>
| transformers/templates/adding_a_new_model/open_model_proposals/README.md/0 | {
"file_path": "transformers/templates/adding_a_new_model/open_model_proposals/README.md",
"repo_id": "transformers",
"token_count": 34
} | 382 |
# 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/models/auto/test_modeling_flax_auto.py/0 | {
"file_path": "transformers/tests/models/auto/test_modeling_flax_auto.py",
"repo_id": "transformers",
"token_count": 1758
} | 383 |
# coding=utf-8
# Copyright 2020 Ecole Polytechnique 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 re... | transformers/tests/models/barthez/test_tokenization_barthez.py/0 | {
"file_path": "transformers/tests/models/barthez/test_tokenization_barthez.py",
"repo_id": "transformers",
"token_count": 2416
} | 384 |
# 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 ... | transformers/tests/models/blenderbot/test_modeling_blenderbot.py/0 | {
"file_path": "transformers/tests/models/blenderbot/test_modeling_blenderbot.py",
"repo_id": "transformers",
"token_count": 10024
} | 385 |
# 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/camembert/test_modeling_tf_camembert.py/0 | {
"file_path": "transformers/tests/models/camembert/test_modeling_tf_camembert.py",
"repo_id": "transformers",
"token_count": 783
} | 386 |
import inspect
import tempfile
import unittest
import numpy as np
import transformers
from transformers import CLIPConfig, CLIPTextConfig, CLIPVisionConfig, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow
from ...test_modeling_flax_common import ... | transformers/tests/models/clip/test_modeling_flax_clip.py/0 | {
"file_path": "transformers/tests/models/clip/test_modeling_flax_clip.py",
"repo_id": "transformers",
"token_count": 11160
} | 387 |
# 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_tokenization_codegen.py/0 | {
"file_path": "transformers/tests/models/codegen/test_tokenization_codegen.py",
"repo_id": "transformers",
"token_count": 4929
} | 388 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/data2vec/test_modeling_data2vec_vision.py/0 | {
"file_path": "transformers/tests/models/data2vec/test_modeling_data2vec_vision.py",
"repo_id": "transformers",
"token_count": 5869
} | 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/distilbert/test_modeling_distilbert.py/0 | {
"file_path": "transformers/tests/models/distilbert/test_modeling_distilbert.py",
"repo_id": "transformers",
"token_count": 8110
} | 390 |
# 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/dpt/test_modeling_dpt.py/0 | {
"file_path": "transformers/tests/models/dpt/test_modeling_dpt.py",
"repo_id": "transformers",
"token_count": 6067
} | 391 |
# coding=utf-8
# Copyright 2021-2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | transformers/tests/models/encodec/test_feature_extraction_encodec.py/0 | {
"file_path": "transformers/tests/models/encodec/test_feature_extraction_encodec.py",
"repo_id": "transformers",
"token_count": 4914
} | 392 |
# 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": 7503
} | 393 |
# 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/gpt_neo/test_modeling_gpt_neo.py/0 | {
"file_path": "transformers/tests/models/gpt_neo/test_modeling_gpt_neo.py",
"repo_id": "transformers",
"token_count": 11461
} | 394 |
# 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/graphormer/test_modeling_graphormer.py/0 | {
"file_path": "transformers/tests/models/graphormer/test_modeling_graphormer.py",
"repo_id": "transformers",
"token_count": 45701
} | 395 |
# coding=utf-8
# Copyright 2021 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/imagegpt/test_image_processing_imagegpt.py/0 | {
"file_path": "transformers/tests/models/imagegpt/test_image_processing_imagegpt.py",
"repo_id": "transformers",
"token_count": 4306
} | 396 |
# coding=utf-8
# Copyright 2018 The Microsoft Research Asia LayoutLM Team 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/license... | transformers/tests/models/layoutlm/test_tokenization_layoutlm.py/0 | {
"file_path": "transformers/tests/models/layoutlm/test_tokenization_layoutlm.py",
"repo_id": "transformers",
"token_count": 1080
} | 397 |
# 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/llava_next/test_modeling_llava_next.py/0 | {
"file_path": "transformers/tests/models/llava_next/test_modeling_llava_next.py",
"repo_id": "transformers",
"token_count": 9004
} | 398 |
# 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/m2m_100/test_modeling_m2m_100.py/0 | {
"file_path": "transformers/tests/models/m2m_100/test_modeling_m2m_100.py",
"repo_id": "transformers",
"token_count": 7707
} | 399 |
# 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/mask2former/test_modeling_mask2former.py/0 | {
"file_path": "transformers/tests/models/mask2former/test_modeling_mask2former.py",
"repo_id": "transformers",
"token_count": 7761
} | 400 |
# 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/poolformer/test_modeling_poolformer.py/0 | {
"file_path": "transformers/tests/models/poolformer/test_modeling_poolformer.py",
"repo_id": "transformers",
"token_count": 3617
} | 401 |
# 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/models/reformer/test_tokenization_reformer.py/0 | {
"file_path": "transformers/tests/models/reformer/test_tokenization_reformer.py",
"repo_id": "transformers",
"token_count": 6399
} | 402 |
# 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/roberta/test_modeling_tf_roberta.py/0 | {
"file_path": "transformers/tests/models/roberta/test_modeling_tf_roberta.py",
"repo_id": "transformers",
"token_count": 12677
} | 403 |
# coding=utf-8
# Copyright 2024 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/seggpt/test_image_processing_seggpt.py/0 | {
"file_path": "transformers/tests/models/seggpt/test_image_processing_seggpt.py",
"repo_id": "transformers",
"token_count": 4116
} | 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/speech_to_text/test_modeling_tf_speech_to_text.py/0 | {
"file_path": "transformers/tests/models/speech_to_text/test_modeling_tf_speech_to_text.py",
"repo_id": "transformers",
"token_count": 11904
} | 405 |
# 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/swinv2/test_modeling_swinv2.py/0 | {
"file_path": "transformers/tests/models/swinv2/test_modeling_swinv2.py",
"repo_id": "transformers",
"token_count": 8696
} | 406 |
# 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/vitmatte/test_modeling_vitmatte.py/0 | {
"file_path": "transformers/tests/models/vitmatte/test_modeling_vitmatte.py",
"repo_id": "transformers",
"token_count": 4062
} | 407 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/xlm_roberta/test_modeling_tf_xlm_roberta.py/0 | {
"file_path": "transformers/tests/models/xlm_roberta/test_modeling_tf_xlm_roberta.py",
"repo_id": "transformers",
"token_count": 850
} | 408 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/pipelines/test_pipelines_image_to_image.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_image_to_image.py",
"repo_id": "transformers",
"token_count": 1057
} | 409 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/pipelines/test_pipelines_zero_shot_audio_classification.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_zero_shot_audio_classification.py",
"repo_id": "transformers",
"token_count": 1482
} | 410 |
# 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/repo_utils/test_check_docstrings.py/0 | {
"file_path": "transformers/tests/repo_utils/test_check_docstrings.py",
"repo_id": "transformers",
"token_count": 1935
} | 411 |
# 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/test_backbone_common.py/0 | {
"file_path": "transformers/tests/test_backbone_common.py",
"repo_id": "transformers",
"token_count": 4375
} | 412 |
# 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/test_processing_common.py/0 | {
"file_path": "transformers/tests/test_processing_common.py",
"repo_id": "transformers",
"token_count": 1720
} | 413 |
# 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_text_question_answering.py/0 | {
"file_path": "transformers/tests/tools/test_text_question_answering.py",
"repo_id": "transformers",
"token_count": 742
} | 414 |
# 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/utils/test_add_new_model_like.py/0 | {
"file_path": "transformers/tests/utils/test_add_new_model_like.py",
"repo_id": "transformers",
"token_count": 25003
} | 415 |
# 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/utils/test_modeling_tf_core.py/0 | {
"file_path": "transformers/tests/utils/test_modeling_tf_core.py",
"repo_id": "transformers",
"token_count": 9190
} | 416 |
# 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_repo.py/0 | {
"file_path": "transformers/utils/check_repo.py",
"repo_id": "transformers",
"token_count": 19409
} | 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/utils/notification_service.py/0 | {
"file_path": "transformers/utils/notification_service.py",
"repo_id": "transformers",
"token_count": 22303
} | 418 |
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class CustomTokenizerFast(BertTokenizerFast):
slow_tokenizer_class = CustomTokenizer
pass
| transformers/utils/test_module/custom_tokenization_fast.py/0 | {
"file_path": "transformers/utils/test_module/custom_tokenization_fast.py",
"repo_id": "transformers",
"token_count": 54
} | 419 |
<div style="text-align: center">
<img src="https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/trl_banner_dark.png">
</div>
# TRL - Transformer Reinforcement Learning
> Full stack library to fine-tune and align large language models.
<p align="center">
<a href="https://github.c... | trl/README.md/0 | {
"file_path": "trl/README.md",
"repo_id": "trl",
"token_count": 3014
} | 420 |
# Builds GPU docker image of PyTorch
# Uses multi-staged approach to reduce size
# Stage 1
# Use base conda image to reduce time
FROM continuumio/miniconda3:latest AS compile-image
# Specify py version
ENV PYTHON_VERSION=3.10
# Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/ac... | trl/docker/trl-latest-gpu/Dockerfile/0 | {
"file_path": "trl/docker/trl-latest-gpu/Dockerfile",
"repo_id": "trl",
"token_count": 774
} | 421 |
# Learning Tools (Experimental 🧪)
Using Large Language Models (LLMs) with tools has been a popular topic recently with awesome works such as [ToolFormer](https://arxiv.org/abs/2302.04761) and [ToolBench](https://arxiv.org/pdf/2305.16504.pdf). In TRL, we provide a simple example of how to teach LLM to use tools with r... | trl/docs/source/learning_tools.mdx/0 | {
"file_path": "trl/docs/source/learning_tools.mdx",
"repo_id": "trl",
"token_count": 3876
} | 422 |
# Examples
Please check out https://huggingface.co/docs/trl/example_overview for documentation on our examples. | trl/examples/README.md/0 | {
"file_path": "trl/examples/README.md",
"repo_id": "trl",
"token_count": 30
} | 423 |
from dataclasses import dataclass, field
from typing import Optional
import torch
from peft import PeftConfig, PeftModel
from transformers import AutoModelForCausalLM, AutoModelForSequenceClassification, AutoTokenizer, HfArgumentParser
@dataclass
class ScriptArguments:
"""
The input names representing the Ad... | trl/examples/research_projects/stack_llama/scripts/merge_peft_adapter.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/merge_peft_adapter.py",
"repo_id": "trl",
"token_count": 657
} | 424 |
# 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... | trl/examples/scripts/cpo.py/0 | {
"file_path": "trl/examples/scripts/cpo.py",
"repo_id": "trl",
"token_count": 1560
} | 425 |
# 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": 8054
} | 426 |
# flake8: noqa
from typing import TYPE_CHECKING
from ..import_utils import _LazyModule
_import_structure = {
"base_environment": ["TextEnvironment", "TextHistory"],
}
if TYPE_CHECKING:
from .base_environment import TextEnvironment, TextHistory
else:
import sys
sys.modules[__name__] = _LazyModule(__na... | trl/trl/environment/__init__.py/0 | {
"file_path": "trl/trl/environment/__init__.py",
"repo_id": "trl",
"token_count": 131
} | 427 |
import os
import sys
import warnings
from dataclasses import dataclass, field
from typing import Literal, Optional
from ..core import flatten_dict
from ..import_utils import is_bitsandbytes_available, is_torchvision_available
@dataclass
class DDPOConfig:
"""
Configuration class for DDPOTrainer
"""
#... | trl/trl/trainer/ddpo_config.py/0 | {
"file_path": "trl/trl/trainer/ddpo_config.py",
"repo_id": "trl",
"token_count": 1776
} | 428 |
<!--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 applicable law or agreed... | accelerate/docs/source/basic_tutorials/execution.md/0 | {
"file_path": "accelerate/docs/source/basic_tutorials/execution.md",
"repo_id": "accelerate",
"token_count": 1307
} | 0 |
<!--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 applicable law or agreed... | accelerate/docs/source/quicktour.md/0 | {
"file_path": "accelerate/docs/source/quicktour.md",
"repo_id": "accelerate",
"token_count": 2725
} | 1 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/usage_guides/tracking.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/tracking.md",
"repo_id": "accelerate",
"token_count": 2703
} | 2 |
#!/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/accelerate_cli.py/0 | {
"file_path": "accelerate/src/accelerate/commands/accelerate_cli.py",
"repo_id": "accelerate",
"token_count": 558
} | 3 |
# Copyright 2022 The HuggingFace Team and Brian Chao. 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... | accelerate/src/accelerate/commands/menu/keymap.py/0 | {
"file_path": "accelerate/src/accelerate/commands/menu/keymap.py",
"repo_id": "accelerate",
"token_count": 2054
} | 4 |
#!/usr/bin/env python
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | accelerate/src/accelerate/test_utils/examples.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/examples.py",
"repo_id": "accelerate",
"token_count": 2735
} | 5 |
# 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/training.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/training.py",
"repo_id": "accelerate",
"token_count": 1572
} | 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/utils/other.py/0 | {
"file_path": "accelerate/src/accelerate/utils/other.py",
"repo_id": "accelerate",
"token_count": 4704
} | 7 |
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: MULTI_CPU
downcast_bf16: 'no'
ipex_config:
ipex: true
machine_rank: 0
main_process_ip: 127.0.0.1
main_process_port: 29500
main_training_function: main
mixed_precision: 'no'
mpirun_config:
mpirun_ccl: '1'
mpirun_hostfile: /home/user/hostfile
num_mac... | accelerate/tests/test_configs/0_28_0_mpi.yaml/0 | {
"file_path": "accelerate/tests/test_configs/0_28_0_mpi.yaml",
"repo_id": "accelerate",
"token_count": 193
} | 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 required by applicabl... | accelerate/tests/test_quantization.py/0 | {
"file_path": "accelerate/tests/test_quantization.py",
"repo_id": "accelerate",
"token_count": 17682
} | 9 |
# Model arguments
model_name_or_path: alignment-handbook/zephyr-7b-sft-full
torch_dtype: null
# Data training arguments
dataset_mixer:
HuggingFaceH4/ultrafeedback_binarized: 1.0
dataset_splits:
- train_prefs
- test_prefs
preprocessing_num_workers: 12
# Training arguments with sensible defaults
bf16: true
beta: 0.01... | alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml/0 | {
"file_path": "alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml",
"repo_id": "alignment-handbook",
"token_count": 359
} | 10 |
#!/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/LI... | alignment-handbook/scripts/run_sft.py/0 | {
"file_path": "alignment-handbook/scripts/run_sft.py",
"repo_id": "alignment-handbook",
"token_count": 3181
} | 11 |
[build]
rustflags = ["-C", "target-cpu=native"]
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+simd128"]
[target.x86_64-apple-darwin]
rustflags = ["-C", "target-feature=-avx,-avx2"] | candle/.cargo/config.toml/0 | {
"file_path": "candle/.cargo/config.toml",
"repo_id": "candle",
"token_count": 84
} | 12 |
# Summary
[Introduction](README.md)
# User Guide
- [Installation](guide/installation.md)
- [Hello World - MNIST](guide/hello_world.md)
- [PyTorch cheatsheet](guide/cheatsheet.md)
# Reference Guide
- [Running a model](inference/inference.md)
- [Using the hub](inference/hub.md)
- [Error management](error_manage.... | candle/candle-book/src/SUMMARY.md/0 | {
"file_path": "candle/candle-book/src/SUMMARY.md",
"repo_id": "candle",
"token_count": 274
} | 13 |
# Writing a custom kernel
| candle/candle-book/src/inference/cuda/writing.md/0 | {
"file_path": "candle/candle-book/src/inference/cuda/writing.md",
"repo_id": "candle",
"token_count": 6
} | 14 |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle_core::{DType, Device, Tensor};
use criterion::{black_box, criterion_group, Criterion, Throughput};
use std::time::Instant;
fn run(a: &Tensor, b: &Tensor) {
a.matmul(&b.t().unwrap()).unwrap();
}
fn run_bench(c: &mut Criterion, device: &Device) {
... | candle/candle-core/benches/benchmarks/matmul.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/matmul.rs",
"repo_id": "candle",
"token_count": 551
} | 15 |
use super::Cpu;
#[cfg(target_arch = "arm")]
use core::arch::arm::*;
#[cfg(target_arch = "aarch64")]
use core::arch::aarch64::*;
pub struct CurrentCpu {}
const STEP: usize = 16;
const EPR: usize = 4;
const ARR: usize = STEP / EPR;
impl CurrentCpu {
#[cfg(target_arch = "aarch64")]
unsafe fn reduce_one(x: floa... | candle/candle-core/src/cpu/neon.rs/0 | {
"file_path": "candle/candle-core/src/cpu/neon.rs",
"repo_id": "candle",
"token_count": 897
} | 16 |
use crate::{Error, Tensor};
use std::ops::{
Bound, Range, RangeBounds, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
};
impl Tensor {
/// Intended to be use by the trait `.i()`
///
/// ```
/// # use candle_core::{Tensor, DType, Device, IndexOp};
/// let a = Tensor::zeros((2, ... | candle/candle-core/src/indexer.rs/0 | {
"file_path": "candle/candle-core/src/indexer.rs",
"repo_id": "candle",
"token_count": 2652
} | 17 |
use super::{GgmlDType, QStorage};
use crate::backend::BackendStorage;
use crate::{DType, MetalDevice, MetalStorage, Result, Shape};
use metal::Buffer;
use std::sync::Arc;
pub struct QMetalStorage {
dtype: GgmlDType,
device: MetalDevice,
buffer: Arc<Buffer>,
}
impl QMetalStorage {
pub fn zeros(device: ... | candle/candle-core/src/quantized/metal.rs/0 | {
"file_path": "candle/candle-core/src/quantized/metal.rs",
"repo_id": "candle",
"token_count": 4553
} | 18 |
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": 2102
} | 19 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::models::bert::{BertModel, Config, HiddenAct, DTYPE};
use anyhow::{Error as E, Result};
use candle::Tensor;
use candle_nn::VarBuilder;
use clap::Parser;
use hf_hub::{api::sync::Api, ... | candle/candle-examples/examples/bert/main.rs/0 | {
"file_path": "candle/candle-examples/examples/bert/main.rs",
"repo_id": "candle",
"token_count": 3527
} | 20 |
// An implementation of LLaMA https://github.com/facebookresearch/llama
//
// This is based on nanoGPT in a similar way to:
// https://github.com/Lightning-AI/lit-llama/blob/main/lit_llama/model.py
//
// The tokenizer config can be retrieved from:
// https://huggingface.co/hf-internal-testing/llama-tokenizer/raw/main/t... | candle/candle-examples/examples/llama/main.rs/0 | {
"file_path": "candle/candle-examples/examples/llama/main.rs",
"repo_id": "candle",
"token_count": 3061
} | 21 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::Parser;
use candle_transformers::models::mistral::{Config, Model as Mistral};
use candle_transformers::models::quantized_mistral::Model as QMistral;
use candle:... | candle/candle-examples/examples/mistral/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mistral/main.rs",
"repo_id": "candle",
"token_count": 5208
} | 22 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use std::io::Write;
use std::path::PathBuf;
use candle_transformers::models::quantized_t5 as t5;
use anyhow::{Error as E, Result};
use candle::{Device, Tensor};
use candle_transformers::generation::LogitsP... | candle/candle-examples/examples/quantized-t5/main.rs/0 | {
"file_path": "candle/candle-examples/examples/quantized-t5/main.rs",
"repo_id": "candle",
"token_count": 3631
} | 23 |
# candle-repvgg
[RepVGG: Making VGG-style ConvNets Great Again](https://arxiv.org/abs/2101.03697).
This candle implementation uses a pre-trained RepVGG network for inference. The
classification head has been trained on the ImageNet dataset and returns the
probabilities for the top-5 classes.
## Running an example
`... | candle/candle-examples/examples/repvgg/README.md/0 | {
"file_path": "candle/candle-examples/examples/repvgg/README.md",
"repo_id": "candle",
"token_count": 254
} | 24 |
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use anyhow::{Error as E, Result};
use candle::{Device, IndexOp, Tensor};
use candle_nn::{ops::softmax, VarBuilder};
use clap::{Parser, ValueEnum};
use hf_hub::{api::sync::Api, Repo, RepoType};
use rand::{di... | candle/candle-examples/examples/whisper-microphone/main.rs/0 | {
"file_path": "candle/candle-examples/examples/whisper-microphone/main.rs",
"repo_id": "candle",
"token_count": 12127
} | 25 |
[net]
# Testing
batch=1
subdivisions=1
# Training
# batch=64
# subdivisions=16
width= 416
height = 416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1
learning_rate=0.001
burn_in=1000
max_batches = 500200
policy=steps
steps=400000,450000
scales=.1,.1
[convolutional]
batch_normaliz... | candle/candle-examples/examples/yolo-v3/yolo-v3.cfg/0 | {
"file_path": "candle/candle-examples/examples/yolo-v3/yolo-v3.cfg",
"repo_id": "candle",
"token_count": 3586
} | 26 |
# candle-flash-attn
| candle/candle-flash-attn/README.md/0 | {
"file_path": "candle/candle-flash-attn/README.md",
"repo_id": "candle",
"token_count": 8
} | 27 |
use anyhow::Result;
use candle::{DType, Device, IndexOp, Tensor, D};
fn to_vec3_round(t: Tensor, digits: i32) -> Result<Vec<Vec<Vec<f32>>>> {
let b = 10f32.powi(digits);
let t = t.to_vec3::<f32>()?;
let t = t
.iter()
.map(|t| {
t.iter()
.map(|t| t.iter().map(|t| ... | candle/candle-flash-attn/tests/flash_attn_tests.rs/0 | {
"file_path": "candle/candle-flash-attn/tests/flash_attn_tests.rs",
"repo_id": "candle",
"token_count": 2787
} | 28 |
#include "cuda_utils.cuh"
#include<stdint.h>
#define WHERE_OP(TYPENAME, ID_TYPENAME, FN_NAME) \
extern "C" __global__ void FN_NAME( \
const size_t numel, \
const size_t num_dims, \
const size_t *info, \
const ID_TYPENAME *ids, \
const TYPENAME *t, \
const TYPENAME *f, \
TYPENAME *out \
) ... | candle/candle-kernels/src/ternary.cu/0 | {
"file_path": "candle/candle-kernels/src/ternary.cu",
"repo_id": "candle",
"token_count": 1159
} | 29 |
#include <metal_stdlib>
#include <metal_math>
#
using namespace metal;
METAL_FUNC uint get_strided_index(
uint idx,
constant size_t &num_dims,
constant size_t *dims,
constant size_t *strides
) {
uint strided_i = 0;
for (uint d = 0; d < num_dims; d++) {
uint dim_idx = num_dims - 1 - d;
... | candle/candle-metal-kernels/src/unary.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/unary.metal",
"repo_id": "candle",
"token_count": 2325
} | 30 |
//! Convolution Layers.
use crate::BatchNorm;
use candle::{Result, Tensor};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Conv1dConfig {
pub padding: usize,
pub stride: usize,
pub dilation: usize,
pub groups: usize,
}
impl Default for Conv1dConfig {
fn default() -> Self {
Self {
... | candle/candle-nn/src/conv.rs/0 | {
"file_path": "candle/candle-nn/src/conv.rs",
"repo_id": "candle",
"token_count": 5891
} | 31 |
use candle::{DType, Device, Result, Shape, Tensor, Var};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
/// A `VarMap` is a store that holds named variables. Variables can be retrieved from the stores
/// and new variables can be added by providing some initialization config in case they are
/// missing.
... | candle/candle-nn/src/var_map.rs/0 | {
"file_path": "candle/candle-nn/src/var_map.rs",
"repo_id": "candle",
"token_count": 1973
} | 32 |
import math
from typing import Any
import candle
from candle import Tensor
from .module import Module
# See https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/linear.py
class Identity(Module):
r"""A placeholder identity operator that is argument-insensitive.
Args:
args: any argument (unu... | candle/candle-pyo3/py_src/candle/nn/linear.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/linear.py",
"repo_id": "candle",
"token_count": 1947
} | 33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.