text stringlengths 7 1.24M | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 519 |
|---|---|---|---|
# 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/unispeech/convert_unispeech_original_pytorch_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/unispeech/convert_unispeech_original_pytorch_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 5200
} | 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/src/transformers/models/upernet/modeling_upernet.py/0 | {
"file_path": "transformers/src/transformers/models/upernet/modeling_upernet.py",
"repo_id": "transformers",
"token_count": 7409
} | 401 |
# 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/src/transformers/models/vision_text_dual_encoder/modeling_tf_vision_text_dual_encoder.py/0 | {
"file_path": "transformers/src/transformers/models/vision_text_dual_encoder/modeling_tf_vision_text_dual_encoder.py",
"repo_id": "transformers",
"token_count": 11779
} | 402 |
# 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/src/transformers/models/vitmatte/image_processing_vitmatte.py/0 | {
"file_path": "transformers/src/transformers/models/vitmatte/image_processing_vitmatte.py",
"repo_id": "transformers",
"token_count": 5663
} | 403 |
# 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/wav2vec2/feature_extraction_wav2vec2.py/0 | {
"file_path": "transformers/src/transformers/models/wav2vec2/feature_extraction_wav2vec2.py",
"repo_id": "transformers",
"token_count": 4807
} | 404 |
# coding=utf-8
# Copyright 2021 The Facebook Inc. 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/LI... | transformers/src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py/0 | {
"file_path": "transformers/src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py",
"repo_id": "transformers",
"token_count": 10089
} | 405 |
# coding=utf-8
# Copyright 2022 The OpenAI 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/L... | transformers/src/transformers/models/whisper/modeling_whisper.py/0 | {
"file_path": "transformers/src/transformers/models/whisper/modeling_whisper.py",
"repo_id": "transformers",
"token_count": 46497
} | 406 |
# 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/xlm_roberta_xl/convert_xlm_roberta_xl_original_pytorch_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/xlm_roberta_xl/convert_xlm_roberta_xl_original_pytorch_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 3308
} | 407 |
import os
from functools import partial, reduce
from typing import TYPE_CHECKING, Callable, Dict, Optional, Tuple, Type, Union
import transformers
from .. import PretrainedConfig, is_tf_available, is_torch_available
from ..utils import TF2_WEIGHTS_NAME, WEIGHTS_NAME, logging
from .config import OnnxConfig
if TYPE_C... | transformers/src/transformers/onnx/features.py/0 | {
"file_path": "transformers/src/transformers/onnx/features.py",
"repo_id": "transformers",
"token_count": 13911
} | 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/src/transformers/pipelines/image_to_image.py/0 | {
"file_path": "transformers/src/transformers/pipelines/image_to_image.py",
"repo_id": "transformers",
"token_count": 1924
} | 409 |
from collections import UserDict
from typing import List, Union
from ..utils import (
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 import ... | transformers/src/transformers/pipelines/zero_shot_image_classification.py/0 | {
"file_path": "transformers/src/transformers/pipelines/zero_shot_image_classification.py",
"repo_id": "transformers",
"token_count": 3125
} | 410 |
# 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_torchao.py/0 | {
"file_path": "transformers/src/transformers/quantizers/quantizer_torchao.py",
"repo_id": "transformers",
"token_count": 2789
} | 411 |
# coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | transformers/src/transformers/trainer_utils.py/0 | {
"file_path": "transformers/src/transformers/trainer_utils.py",
"repo_id": "transformers",
"token_count": 13992
} | 412 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class PyTorchBenchmark(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"])
class PyTorchBenchmarkArguments... | transformers/src/transformers/utils/dummy_pt_objects.py/0 | {
"file_path": "transformers/src/transformers/utils/dummy_pt_objects.py",
"repo_id": "transformers",
"token_count": 97807
} | 413 |
# 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/src/transformers/utils/model_parallel_utils.py/0 | {
"file_path": "transformers/src/transformers/utils/model_parallel_utils.py",
"repo_id": "transformers",
"token_count": 778
} | 414 |
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
} | 415 |
# 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/tests/models/auto/test_feature_extraction_auto.py/0 | {
"file_path": "transformers/tests/models/auto/test_feature_extraction_auto.py",
"repo_id": "transformers",
"token_count": 3275
} | 416 |
# 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/bart/test_modeling_tf_bart.py/0 | {
"file_path": "transformers/tests/models/bart/test_modeling_tf_bart.py",
"repo_id": "transformers",
"token_count": 30028
} | 417 |
# 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/blip/test_modeling_tf_blip.py/0 | {
"file_path": "transformers/tests/models/blip/test_modeling_tf_blip.py",
"repo_id": "transformers",
"token_count": 14806
} | 418 |
# coding=utf-8
# Copyright 2020 Google T5 Authors and HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | transformers/tests/models/byt5/test_tokenization_byt5.py/0 | {
"file_path": "transformers/tests/models/byt5/test_tokenization_byt5.py",
"repo_id": "transformers",
"token_count": 7851
} | 419 |
# 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/clap/test_feature_extraction_clap.py/0 | {
"file_path": "transformers/tests/models/clap/test_feature_extraction_clap.py",
"repo_id": "transformers",
"token_count": 19243
} | 420 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/models/clvp/test_processor_clvp.py/0 | {
"file_path": "transformers/tests/models/clvp/test_processor_clvp.py",
"repo_id": "transformers",
"token_count": 2197
} | 421 |
# coding=utf-8
# Copyright 2019 Hugging Face 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 a... | transformers/tests/models/deberta/test_tokenization_deberta.py/0 | {
"file_path": "transformers/tests/models/deberta/test_tokenization_deberta.py",
"repo_id": "transformers",
"token_count": 3812
} | 422 |
# coding=utf-8
# Copyright 2022 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/donut/test_image_processing_donut.py/0 | {
"file_path": "transformers/tests/models/donut/test_image_processing_donut.py",
"repo_id": "transformers",
"token_count": 3768
} | 423 |
# 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": 8304
} | 424 |
# 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/esm/test_modeling_tf_esm.py/0 | {
"file_path": "transformers/tests/models/esm/test_modeling_tf_esm.py",
"repo_id": "transformers",
"token_count": 5388
} | 425 |
# 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/gpt2/test_modeling_tf_gpt2.py/0 | {
"file_path": "transformers/tests/models/gpt2/test_modeling_tf_gpt2.py",
"repo_id": "transformers",
"token_count": 14242
} | 426 |
# 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/gptj/test_modeling_flax_gptj.py/0 | {
"file_path": "transformers/tests/models/gptj/test_modeling_flax_gptj.py",
"repo_id": "transformers",
"token_count": 6806
} | 427 |
# coding=utf-8
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/imagegpt/test_modeling_imagegpt.py/0 | {
"file_path": "transformers/tests/models/imagegpt/test_modeling_imagegpt.py",
"repo_id": "transformers",
"token_count": 11091
} | 428 |
# 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/llava/test_modeling_llava.py/0 | {
"file_path": "transformers/tests/models/llava/test_modeling_llava.py",
"repo_id": "transformers",
"token_count": 10666
} | 429 |
# 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/marian/test_modeling_marian.py/0 | {
"file_path": "transformers/tests/models/marian/test_modeling_marian.py",
"repo_id": "transformers",
"token_count": 15121
} | 430 |
# 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/mbart/test_modeling_flax_mbart.py/0 | {
"file_path": "transformers/tests/models/mbart/test_modeling_flax_mbart.py",
"repo_id": "transformers",
"token_count": 8921
} | 431 |
# coding=utf-8
# Copyright 2023 Mistral AI 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/LICENSE-2... | transformers/tests/models/mistral/test_modeling_mistral.py/0 | {
"file_path": "transformers/tests/models/mistral/test_modeling_mistral.py",
"repo_id": "transformers",
"token_count": 17085
} | 432 |
# 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/mt5/test_modeling_mt5.py/0 | {
"file_path": "transformers/tests/models/mt5/test_modeling_mt5.py",
"repo_id": "transformers",
"token_count": 21084
} | 433 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | transformers/tests/models/openai/test_tokenization_openai.py/0 | {
"file_path": "transformers/tests/models/openai/test_tokenization_openai.py",
"repo_id": "transformers",
"token_count": 2438
} | 434 |
# 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/pop2piano/test_modeling_pop2piano.py/0 | {
"file_path": "transformers/tests/models/pop2piano/test_modeling_pop2piano.py",
"repo_id": "transformers",
"token_count": 15014
} | 435 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/models/qwen2_audio/test_processor_qwen2_audio.py/0 | {
"file_path": "transformers/tests/models/qwen2_audio/test_processor_qwen2_audio.py",
"repo_id": "transformers",
"token_count": 2277
} | 436 |
# 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/rt_detr/test_modeling_rt_detr_resnet.py/0 | {
"file_path": "transformers/tests/models/rt_detr/test_modeling_rt_detr_resnet.py",
"repo_id": "transformers",
"token_count": 1914
} | 437 |
# 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/segformer/test_modeling_segformer.py/0 | {
"file_path": "transformers/tests/models/segformer/test_modeling_segformer.py",
"repo_id": "transformers",
"token_count": 7777
} | 438 |
# 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/time_series_transformer/test_modeling_time_series_transformer.py/0 | {
"file_path": "transformers/tests/models/time_series_transformer/test_modeling_time_series_transformer.py",
"repo_id": "transformers",
"token_count": 10496
} | 439 |
# 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/vilt/test_image_processing_vilt.py/0 | {
"file_path": "transformers/tests/models/vilt/test_image_processing_vilt.py",
"repo_id": "transformers",
"token_count": 2545
} | 440 |
# 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/vits/test_modeling_vits.py/0 | {
"file_path": "transformers/tests/models/vits/test_modeling_vits.py",
"repo_id": "transformers",
"token_count": 8559
} | 441 |
# 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/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py/0 | {
"file_path": "transformers/tests/models/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py",
"repo_id": "transformers",
"token_count": 17989
} | 442 |
# 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/optimization/test_optimization_tf.py/0 | {
"file_path": "transformers/tests/optimization/test_optimization_tf.py",
"repo_id": "transformers",
"token_count": 1782
} | 443 |
# 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/pipelines/test_pipelines_object_detection.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_object_detection.py",
"repo_id": "transformers",
"token_count": 6070
} | 444 |
# coding=utf-8
# 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 requir... | transformers/tests/quantization/hqq/test_hqq.py/0 | {
"file_path": "transformers/tests/quantization/hqq/test_hqq.py",
"repo_id": "transformers",
"token_count": 2392
} | 445 |
# 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/test_sequence_feature_extraction_common.py/0 | {
"file_path": "transformers/tests/test_sequence_feature_extraction_common.py",
"repo_id": "transformers",
"token_count": 7929
} | 446 |
# 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": 25145
} | 447 |
# 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/utils/test_image_processing_utils.py/0 | {
"file_path": "transformers/tests/utils/test_image_processing_utils.py",
"repo_id": "transformers",
"token_count": 4106
} | 448 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/check_build.py/0 | {
"file_path": "transformers/utils/check_build.py",
"repo_id": "transformers",
"token_count": 616
} | 449 |
import argparse
import os
past_versions_testing = {
"pytorch": {
"1.13": {
"torch": "1.13.1",
"torchvision": "0.14.1",
"torchaudio": "0.13.1",
"python": 3.9,
"cuda": "cu116",
"install": (
"python3 -m pip install --no-c... | transformers/utils/past_ci_versions.py/0 | {
"file_path": "transformers/utils/past_ci_versions.py",
"repo_id": "transformers",
"token_count": 2774
} | 450 |
from transformers import ProcessorMixin
class CustomProcessor(ProcessorMixin):
feature_extractor_class = "AutoFeatureExtractor"
tokenizer_class = "AutoTokenizer"
| transformers/utils/test_module/custom_processing.py/0 | {
"file_path": "transformers/utils/test_module/custom_processing.py",
"repo_id": "transformers",
"token_count": 51
} | 451 |
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
# - repo: https://github.com/codespell-project/codespell
# rev: v2.1.0
# hooks:
# - id: codespell
# args:
# - --ignore-words-list=n... | trl/.pre-commit-config.yaml/0 | {
"file_path": "trl/.pre-commit-config.yaml",
"repo_id": "trl",
"token_count": 212
} | 452 |
import json
import os
from ghapi.all import GhApi
FOLDER_STRING = os.environ.get("FOLDER_STRING", "")
folder = f"benchmark/trl/{FOLDER_STRING}"
host_url = f"https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/benchmark/{FOLDER_STRING}"
# Create a GitHub API instance
github_contex... | trl/benchmark/post_github_comment.py/0 | {
"file_path": "trl/benchmark/post_github_comment.py",
"repo_id": "trl",
"token_count": 358
} | 453 |
# Training customization
TRL is designed with modularity in mind so that users to be able to efficiently customize the training loop for their needs. Below are some examples on how you can apply and test different techniques.
## Train on multiple GPUs / nodes
The trainers in TRL use 🤗 Accelerate to enable distribut... | trl/docs/source/customization.mdx/0 | {
"file_path": "trl/docs/source/customization.mdx",
"repo_id": "trl",
"token_count": 2837
} | 454 |
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
} | 455 |
# flake8: noqa
# 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 requir... | trl/examples/scripts/chat.py/0 | {
"file_path": "trl/examples/scripts/chat.py",
"repo_id": "trl",
"token_count": 5956
} | 456 |
import shutil
from accelerate import PartialState
from datasets import load_dataset
from transformers import (
AutoModelForCausalLM,
AutoModelForSequenceClassification,
AutoTokenizer,
HfArgumentParser,
)
from trl import ModelConfig
from trl.trainer.rloo_trainer import RLOOConfig, RLOOTrainer
from trl.... | trl/examples/scripts/rloo/rloo_tldr.py/0 | {
"file_path": "trl/examples/scripts/rloo/rloo_tldr.py",
"repo_id": "trl",
"token_count": 2036
} | 457 |
# 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_online_dpo_trainer.py/0 | {
"file_path": "trl/tests/test_online_dpo_trainer.py",
"repo_id": "trl",
"token_count": 1731
} | 458 |
# This file is a copy of trl/examples/scripts/sft.py so that we could
# use it together with rich and the TRL CLI in a more customizable manner.
# 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 comp... | trl/trl/commands/cli_utils.py/0 | {
"file_path": "trl/trl/commands/cli_utils.py",
"repo_id": "trl",
"token_count": 4444
} | 459 |
# flake8: noqa
# 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 requi... | trl/trl/trainer/__init__.py/0 | {
"file_path": "trl/trl/trainer/__init__.py",
"repo_id": "trl",
"token_count": 1852
} | 460 |
# KTO Authors: Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela
# 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 ... | trl/trl/trainer/kto_trainer.py/0 | {
"file_path": "trl/trl/trainer/kto_trainer.py",
"repo_id": "trl",
"token_count": 31450
} | 461 |
# 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/utils.py/0 | {
"file_path": "trl/trl/trainer/utils.py",
"repo_id": "trl",
"token_count": 23577
} | 462 |
# 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/benchmarks/big_model_inference/measures_util.py/0 | {
"file_path": "accelerate/benchmarks/big_model_inference/measures_util.py",
"repo_id": "accelerate",
"token_count": 1146
} | 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/basic_tutorials/install.md/0 | {
"file_path": "accelerate/docs/source/basic_tutorials/install.md",
"repo_id": "accelerate",
"token_count": 996
} | 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/mps.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/mps.md",
"repo_id": "accelerate",
"token_count": 861
} | 2 |
# Since this is single GPU, we don't need distributed training
distributed_type: "NO"
# Can be one of "no", "fp16", or "bf16" (see `transformer_engine.yaml` for `fp8`)
mixed_precision: "bf16" | accelerate/examples/config_yaml_templates/single_gpu.yaml/0 | {
"file_path": "accelerate/examples/config_yaml_templates/single_gpu.yaml",
"repo_id": "accelerate",
"token_count": 68
} | 3 |
# 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/examples/multigpu_remote_launcher.py/0 | {
"file_path": "accelerate/examples/multigpu_remote_launcher.py",
"repo_id": "accelerate",
"token_count": 1026
} | 4 |
# 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... | accelerate/manim_animations/dataloaders/stage_3.py/0 | {
"file_path": "accelerate/manim_animations/dataloaders/stage_3.py",
"repo_id": "accelerate",
"token_count": 577
} | 5 |
#!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | accelerate/src/accelerate/commands/config/config_args.py/0 | {
"file_path": "accelerate/src/accelerate/commands/config/config_args.py",
"repo_id": "accelerate",
"token_count": 4227
} | 6 |
#!/usr/bin/env python
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | accelerate/src/accelerate/commands/tpu.py/0 | {
"file_path": "accelerate/src/accelerate/commands/tpu.py",
"repo_id": "accelerate",
"token_count": 2114
} | 7 |
# 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 required by appl... | accelerate/src/accelerate/test_utils/scripts/external_deps/test_checkpointing.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/external_deps/test_checkpointing.py",
"repo_id": "accelerate",
"token_count": 4199
} | 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/tracking.py/0 | {
"file_path": "accelerate/src/accelerate/tracking.py",
"repo_id": "accelerate",
"token_count": 17105
} | 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/src/accelerate/utils/random.py/0 | {
"file_path": "accelerate/src/accelerate/utils/random.py",
"repo_id": "accelerate",
"token_count": 2199
} | 10 |
compute_environment: AMAZON_SAGEMAKER
debug: false
distributed_type: NO
mixed_precision: fp16
debug: false
use_cpu: false
ec2_instance_type: MY_TYPE
iam_role_name: MY_ROLE
| accelerate/tests/test_configs/0_30_0_sagemaker.yaml/0 | {
"file_path": "accelerate/tests/test_configs/0_30_0_sagemaker.yaml",
"repo_id": "accelerate",
"token_count": 68
} | 11 |
# 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_multigpu.py/0 | {
"file_path": "accelerate/tests/test_multigpu.py",
"repo_id": "accelerate",
"token_count": 2479
} | 12 |
cff-version: 1.2.0
title: The Alignment Handbook
message: >-
Robust recipes to align language models with human and AI
preferences.
type: software
authors:
- given-names: Lewis
family-names: Tunstall
- given-names: Edward
family-names: Beeching
- given-names: Nathan
family-names: Lambert
- given... | alignment-handbook/CITATION.cff/0 | {
"file_path": "alignment-handbook/CITATION.cff",
"repo_id": "alignment-handbook",
"token_count": 269
} | 13 |
# 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
eval_strategy: "no"
gradient_ac... | 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": 369
} | 14 |
# Model arguments
model_name_or_path: alignment-handbook/zephyr-7b-sft-full
torch_dtype: null
# 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 ar... | alignment-handbook/recipes/zephyr-7b-beta/dpo/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/zephyr-7b-beta/dpo/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 364
} | 15 |
# coding=utf-8
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | alignment-handbook/src/alignment/data.py/0 | {
"file_path": "alignment-handbook/src/alignment/data.py",
"repo_id": "alignment-handbook",
"token_count": 4703
} | 16 |
repos:
- repo: https://github.com/Narsil/pre-commit-rust
rev: 2eed6366172ef2a5186e8785ec0e67243d7d73d0
hooks:
- id: fmt
name: "Rust (fmt)"
- id: clippy
name: "Rust (clippy)"
args:
[
"--tests",
"--examples",
"--",
"-D... | candle/.pre-commit-config.yaml/0 | {
"file_path": "candle/.pre-commit-config.yaml",
"repo_id": "candle",
"token_count": 210
} | 17 |
# Creating a REST api webserver
| candle/candle-book/src/apps/rest.md/0 | {
"file_path": "candle/candle-book/src/apps/rest.md",
"repo_id": "candle",
"token_count": 8
} | 18 |
//! #A simplified example in Rust of training a neural network and then using it based on the Candle Framework by Hugging Face.
//! Author: Evgeny Igumnov 2023 igumnovnsk@gmail.com
//! This program implements a neural network to predict the winner of the second round of elections based on the results of the first round... | candle/candle-book/src/simplified.rs/0 | {
"file_path": "candle/candle-book/src/simplified.rs",
"repo_id": "candle",
"token_count": 2903
} | 19 |
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) {
a.sqrt().unwrap();
}
fn run_unary_benchmark(c: &mut Criterion, device: &Device, dtype: DType, name: &... | candle/candle-core/benches/benchmarks/unary.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/unary.rs",
"repo_id": "candle",
"token_count": 656
} | 20 |
use super::Cpu;
use core::arch::wasm32::*;
pub struct CurrentCpu {}
const STEP: usize = 16;
const EPR: usize = 4;
const ARR: usize = STEP / EPR;
impl Cpu<ARR> for CurrentCpu {
type Unit = v128;
type Array = [v128; ARR];
const STEP: usize = STEP;
const EPR: usize = EPR;
fn n() -> usize {
... | candle/candle-core/src/cpu/simd128.rs/0 | {
"file_path": "candle/candle-core/src/cpu/simd128.rs",
"repo_id": "candle",
"token_count": 839
} | 21 |
use crate::{Error, Result, Shape};
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Layout {
shape: Shape,
// The strides are given in number of elements and not in bytes.
stride: Vec<usize>,
start_offset: usize,
}
impl Layout {
pub fn new(shape: Shape, stride: Vec<usize>, start_offset: usize) ->... | candle/candle-core/src/layout.rs/0 | {
"file_path": "candle/candle-core/src/layout.rs",
"repo_id": "candle",
"token_count": 4349
} | 22 |
use crate::{CpuStorage, DType, Device, Result, Shape, Storage, Tensor};
use k_quants::*;
use std::borrow::Cow;
#[cfg(target_feature = "avx")]
pub mod avx;
mod dummy_cuda;
mod dummy_metal;
pub mod ggml_file;
pub mod gguf_file;
pub mod k_quants;
#[cfg(feature = "metal")]
pub mod metal;
#[cfg(not(feature = "metal"))]
mod... | candle/candle-core/src/quantized/mod.rs/0 | {
"file_path": "candle/candle-core/src/quantized/mod.rs",
"repo_id": "candle",
"token_count": 9433
} | 23 |
use anyhow::Result;
use candle_core::{test_device, test_utils, Device, IndexOp, Tensor};
/* This test is based on the following script.
import torch
torch.manual_seed(4242)
t = torch.randn((1, 4, 5))
w = torch.randn((2, 4, 3))
print(t.flatten())
print(w.flatten())
res = torch.nn.functional.conv1d(t, w)
print(res.flat... | candle/candle-core/tests/conv_tests.rs/0 | {
"file_path": "candle/candle-core/tests/conv_tests.rs",
"repo_id": "candle",
"token_count": 22766
} | 24 |
# candle-based
Experimental, not instruction-tuned small LLM from the Hazy Research group, combining local and linear attention layers.
[Blogpost](https://hazyresearch.stanford.edu/blog/2024-03-03-based)
[Simple linear attention language models balance the recall-throughput tradeoff](https://arxiv.org/abs/2402.18668... | candle/candle-examples/examples/based/README.md/0 | {
"file_path": "candle/candle-examples/examples/based/README.md",
"repo_id": "candle",
"token_count": 243
} | 25 |
# candle-convnext
[A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) and
[ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808).
This candle implementation uses a pre-trained ConvNeXt network for inference. The
classification head has been trained on the I... | candle/candle-examples/examples/convnext/README.md/0 | {
"file_path": "candle/candle-examples/examples/convnext/README.md",
"repo_id": "candle",
"token_count": 293
} | 26 |
# candle-efficientvit
[EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention](https://arxiv.org/abs/2305.07027).
This candle implementation uses a pre-trained EfficientViT (from Microsoft Research Asia) network for inference.
The classification head has been trained on the ImageNet dataset and... | candle/candle-examples/examples/efficientvit/README.md/0 | {
"file_path": "candle/candle-examples/examples/efficientvit/README.md",
"repo_id": "candle",
"token_count": 273
} | 27 |
# candle-gemma: 2b and 7b LLMs from Google DeepMind
[Gemma](https://ai.google.dev/gemma/docs) is a collection of lightweight open
models published by Google Deepmind with a 2b and a 7b variant for the first
version, and a 2b and a 9b variant for v2.
## Running the example
```bash
$ cargo run --example gemma --featur... | candle/candle-examples/examples/gemma/README.md/0 | {
"file_path": "candle/candle-examples/examples/gemma/README.md",
"repo_id": "candle",
"token_count": 441
} | 28 |
pub enum SeparatorStyle {
Two,
Mpt,
}
pub struct Conversation {
pub system: String,
pub roles: Vec<String>,
pub messages: Vec<(String, Option<String>)>,
pub offset: i32,
pub sep_style: SeparatorStyle,
pub sep: String,
pub sep2: Option<String>,
pub version: String,
}
impl Convers... | candle/candle-examples/examples/llava/conversation.rs/0 | {
"file_path": "candle/candle-examples/examples/llava/conversation.rs",
"repo_id": "candle",
"token_count": 1910
} | 29 |
# candle-mixtral: 8x7b LLM using a sparse mixture of experts.
Mixtral-8x7B-v0.1 is a pretrained generative LLM with 56 billion parameters.
- [Blog post](https://mistral.ai/news/mixtral-of-experts/) from Mistral announcing the model release.
- [Model card](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) on the Hu... | candle/candle-examples/examples/mixtral/README.md/0 | {
"file_path": "candle/candle-examples/examples/mixtral/README.md",
"repo_id": "candle",
"token_count": 322
} | 30 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{IndexOp, D};
use clap::{Parser, ValueEnum};
#[derive(Clone, Copy, Debug, ValueEnum)]
enum Which {
SqueezeNet,
EfficientNet,
}
#[derive(Parser)]
struct Args {
#[arg(long)]
imag... | candle/candle-examples/examples/onnx/main.rs/0 | {
"file_path": "candle/candle-examples/examples/onnx/main.rs",
"repo_id": "candle",
"token_count": 1042
} | 31 |
#[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::qwen2::{Config as ConfigBase, ModelForCausalLM as ModelBase};
use candle_transformers::models::qwen2_moe::{Config as Con... | candle/candle-examples/examples/qwen/main.rs/0 | {
"file_path": "candle/candle-examples/examples/qwen/main.rs",
"repo_id": "candle",
"token_count": 4905
} | 32 |
# This script exports pre-trained model weights in the safetensors format.
import numpy as np
import torch
import torchvision
from safetensors import torch as stt
m = torchvision.models.resnet50(pretrained=True)
stt.save_file(m.state_dict(), 'resnet50.safetensors')
m = torchvision.models.resnet101(pretrained=True)
stt... | candle/candle-examples/examples/resnet/export_models.py/0 | {
"file_path": "candle/candle-examples/examples/resnet/export_models.py",
"repo_id": "candle",
"token_count": 166
} | 33 |
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use candle_transformers::models::stable_diffusion;
use anyhow::{Error as E, Result};
use candle::{DType, Device, IndexOp, Module, Tensor, D};
use clap::Parser;
use stable_diffusion::vae::AutoEncoderKL;
use... | candle/candle-examples/examples/stable-diffusion/main.rs/0 | {
"file_path": "candle/candle-examples/examples/stable-diffusion/main.rs",
"repo_id": "candle",
"token_count": 10313
} | 34 |
use crate::{token_id, Model};
use candle::{IndexOp, Result, Tensor, D};
use candle_transformers::models::whisper::{self as m};
use tokenizers::Tokenizer;
const LANGUAGES: [(&str, &str); 99] = [
("en", "english"),
("zh", "chinese"),
("de", "german"),
("es", "spanish"),
("ru", "russian"),
("ko", ... | candle/candle-examples/examples/whisper-microphone/multilingual.rs/0 | {
"file_path": "candle/candle-examples/examples/whisper-microphone/multilingual.rs",
"repo_id": "candle",
"token_count": 1851
} | 35 |
# candle-yolo-v8: Object Detection and Pose Estimation
This is a port of [Ultralytics
YOLOv8](https://github.com/ultralytics/ultralytics). The implementation is based
on the [tinygrad
version](https://github.com/tinygrad/tinygrad/blob/master/examples/yolov8.py)
and on the model architecture described in this
[issue](h... | candle/candle-examples/examples/yolo-v8/README.md/0 | {
"file_path": "candle/candle-examples/examples/yolo-v8/README.md",
"repo_id": "candle",
"token_count": 562
} | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.