text
stringlengths
5
424k
id
stringlengths
13
178
metadata
dict
__index_level_0__
int64
0
672
# 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/clap/test_processing_clap.py/0
{ "file_path": "transformers/tests/models/clap/test_processing_clap.py", "repo_id": "transformers", "token_count": 1704 }
519
# coding=utf-8 # Copyright 2025 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/colqwen2/test_modeling_colqwen2.py/0
{ "file_path": "transformers/tests/models/colqwen2/test_modeling_colqwen2.py", "repo_id": "transformers", "token_count": 5938 }
520
# 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...
transformers/tests/models/dinat/test_modeling_dinat.py/0
{ "file_path": "transformers/tests/models/dinat/test_modeling_dinat.py", "repo_id": "transformers", "token_count": 6154 }
521
# coding=utf-8 # Copyright 2025 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/doge/test_modeling_doge.py/0
{ "file_path": "transformers/tests/models/doge/test_modeling_doge.py", "repo_id": "transformers", "token_count": 6329 }
522
# Copyright 2025 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/efficientloftr/test_image_processing_efficientloftr.py/0
{ "file_path": "transformers/tests/models/efficientloftr/test_image_processing_efficientloftr.py", "repo_id": "transformers", "token_count": 3534 }
523
# Copyright 2022 Meta Platforms 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/LICENSE-2.0 ...
transformers/tests/models/flava/test_modeling_flava.py/0
{ "file_path": "transformers/tests/models/flava/test_modeling_flava.py", "repo_id": "transformers", "token_count": 24848 }
524
# Copyright 2020 HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
transformers/tests/models/funnel/test_modeling_funnel.py/0
{ "file_path": "transformers/tests/models/funnel/test_modeling_funnel.py", "repo_id": "transformers", "token_count": 9088 }
525
# Copyright 2025 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 agreed to in writ...
transformers/tests/models/gemma3n/test_feature_extraction_gemma3n.py/0
{ "file_path": "transformers/tests/models/gemma3n/test_feature_extraction_gemma3n.py", "repo_id": "transformers", "token_count": 5630 }
526
# Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
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": 10939 }
527
# Copyright 2025 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/granite_speech/test_processing_granite_speech.py/0
{ "file_path": "transformers/tests/models/granite_speech/test_processing_granite_speech.py", "repo_id": "transformers", "token_count": 3355 }
528
# Copyright 2018 The Google AI Language Team Authors, Allegro.pl 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-...
transformers/tests/models/herbert/test_tokenization_herbert.py/0
{ "file_path": "transformers/tests/models/herbert/test_tokenization_herbert.py", "repo_id": "transformers", "token_count": 2228 }
529
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/idefics/test_processing_idefics.py/0
{ "file_path": "transformers/tests/models/idefics/test_processing_idefics.py", "repo_id": "transformers", "token_count": 3430 }
530
# 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/janus/test_processing_janus.py/0
{ "file_path": "transformers/tests/models/janus/test_processing_janus.py", "repo_id": "transformers", "token_count": 9491 }
531
# 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/mobilebert/test_modeling_mobilebert.py/0
{ "file_path": "transformers/tests/models/mobilebert/test_modeling_mobilebert.py", "repo_id": "transformers", "token_count": 7814 }
532
# 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/modernbert_decoder/test_modeling_modernbert_decoder.py/0
{ "file_path": "transformers/tests/models/modernbert_decoder/test_modeling_modernbert_decoder.py", "repo_id": "transformers", "token_count": 3618 }
533
# Copyright 2021, The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
transformers/tests/models/musicgen/test_modeling_musicgen.py/0
{ "file_path": "transformers/tests/models/musicgen/test_modeling_musicgen.py", "repo_id": "transformers", "token_count": 26948 }
534
# 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/omdet_turbo/test_processing_omdet_turbo.py/0
{ "file_path": "transformers/tests/models/omdet_turbo/test_processing_omdet_turbo.py", "repo_id": "transformers", "token_count": 3099 }
535
# Copyright 2025 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/perception_lm/test_processing_perception_lm.py/0
{ "file_path": "transformers/tests/models/perception_lm/test_processing_perception_lm.py", "repo_id": "transformers", "token_count": 2834 }
536
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
transformers/tests/models/pop2piano/test_modeling_pop2piano.py/0
{ "file_path": "transformers/tests/models/pop2piano/test_modeling_pop2piano.py", "repo_id": "transformers", "token_count": 14339 }
537
# coding=utf-8 # Copyright 2025 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/qwen2_vl/test_video_processing_qwen2_vl.py/0
{ "file_path": "transformers/tests/models/qwen2_vl/test_video_processing_qwen2_vl.py", "repo_id": "transformers", "token_count": 7134 }
538
# 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/sam_hq/test_processing_samhq.py/0
{ "file_path": "transformers/tests/models/sam_hq/test_processing_samhq.py", "repo_id": "transformers", "token_count": 2506 }
539
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/models/superpoint/test_modeling_superpoint.py/0
{ "file_path": "transformers/tests/models/superpoint/test_modeling_superpoint.py", "repo_id": "transformers", "token_count": 5398 }
540
# Copyright 2025 Google Inc. 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...
transformers/tests/models/t5gemma/test_modeling_t5gemma.py/0
{ "file_path": "transformers/tests/models/t5gemma/test_modeling_t5gemma.py", "repo_id": "transformers", "token_count": 31514 }
541
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
transformers/tests/models/timm_backbone/test_modeling_timm_backbone.py/0
{ "file_path": "transformers/tests/models/timm_backbone/test_modeling_timm_backbone.py", "repo_id": "transformers", "token_count": 4311 }
542
# 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...
transformers/tests/models/videomae/test_modeling_videomae.py/0
{ "file_path": "transformers/tests/models/videomae/test_modeling_videomae.py", "repo_id": "transformers", "token_count": 8891 }
543
# Copyright 2025 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/tests/models/xcodec/test_modeling_xcodec.py/0
{ "file_path": "transformers/tests/models/xcodec/test_modeling_xcodec.py", "repo_id": "transformers", "token_count": 8752 }
544
# Copyright 2025 NXAI GmbH. 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 ag...
transformers/tests/models/xlstm/test_modeling_xlstm.py/0
{ "file_path": "transformers/tests/models/xlstm/test_modeling_xlstm.py", "repo_id": "transformers", "token_count": 7272 }
545
# 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.py/0
{ "file_path": "transformers/tests/optimization/test_optimization.py", "repo_id": "transformers", "token_count": 4494 }
546
# Copyright 2025 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_keypoint_matching.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_keypoint_matching.py", "repo_id": "transformers", "token_count": 3508 }
547
# 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_zero_shot_image_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_zero_shot_image_classification.py", "repo_id": "transformers", "token_count": 4414 }
548
import gc import unittest from transformers import AutoModelForCausalLM, AutoTokenizer, CompressedTensorsConfig from transformers.testing_utils import backend_empty_cache, require_compressed_tensors, require_torch, torch_device from transformers.utils import is_torch_available if is_torch_available(): import tor...
transformers/tests/quantization/compressed_tensors_integration/test_compressed_tensors.py/0
{ "file_path": "transformers/tests/quantization/compressed_tensors_integration/test_compressed_tensors.py", "repo_id": "transformers", "token_count": 1700 }
549
# 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/repo_utils/test_tests_fetcher.py/0
{ "file_path": "transformers/tests/repo_utils/test_tests_fetcher.py", "repo_id": "transformers", "token_count": 16221 }
550
# 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 agreed to in writ...
transformers/tests/test_image_processing_common.py/0
{ "file_path": "transformers/tests/test_image_processing_common.py", "repo_id": "transformers", "token_count": 15549 }
551
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/trainer/test_trainer_callback.py/0
{ "file_path": "transformers/tests/trainer/test_trainer_callback.py", "repo_id": "transformers", "token_count": 7812 }
552
# Copyright 2025 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 law or agreed ...
transformers/tests/utils/test_attention_visualizer.py/0
{ "file_path": "transformers/tests/utils/test_attention_visualizer.py", "repo_id": "transformers", "token_count": 2995 }
553
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/utils/test_hf_argparser.py/0
{ "file_path": "transformers/tests/utils/test_hf_argparser.py", "repo_id": "transformers", "token_count": 8139 }
554
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/utils/test_versions_utils.py/0
{ "file_path": "transformers/tests/utils/test_versions_utils.py", "repo_id": "transformers", "token_count": 1539 }
555
import argparse import difflib import glob import logging import multiprocessing import os import shutil import subprocess from functools import partial from io import StringIO from create_dependency_mapping import find_priority_list # Console for rich printing from modular_model_converter import convert_modular_file...
transformers/utils/check_modular_conversion.py/0
{ "file_path": "transformers/utils/check_modular_conversion.py", "repo_id": "transformers", "token_count": 3799 }
556
# 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/utils/process_circleci_workflow_test_reports.py/0
{ "file_path": "transformers/utils/process_circleci_workflow_test_reports.py", "repo_id": "transformers", "token_count": 1573 }
557
from transformers import BertTokenizer class CustomTokenizer(BertTokenizer): pass
transformers/utils/test_module/custom_tokenization.py/0
{ "file_path": "transformers/utils/test_module/custom_tokenization.py", "repo_id": "transformers", "token_count": 25 }
558
FROM pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip uv RUN uv pip install --system --no-cache "git+https://github.com/huggingface/trl.git#egg=trl[liger,peft,vlm]" RUN uv pip install --system hf_transfer liger_kernel...
trl/docker/trl-dev/Dockerfile/0
{ "file_path": "trl/docker/trl-dev/Dockerfile", "repo_id": "trl", "token_count": 211 }
559
# Speeding Up Training <Tip warning={true}> Section under construction. Feel free to contribute! </Tip> ## vLLM for fast generation in online methods Online methods such as GRPO or Online DPO require the model to generate completions, which is often a slow process and can significantly impact training time. To spe...
trl/docs/source/speeding_up_training.md/0
{ "file_path": "trl/docs/source/speeding_up_training.md", "repo_id": "trl", "token_count": 932 }
560
# This is an example configuration file of TRL CLI, you can use it for # SFT like that: `trl sft --config config.yaml --output_dir test-sft` # The YAML file supports environment variables by adding an `env` field # as below # env: # CUDA_VISIBLE_DEVICES: 0 model_name_or_path: Qwen/Qwen2.5-0.5B dataset_name: st...
trl/examples/cli_configs/example_config.yaml/0
{ "file_path": "trl/examples/cli_configs/example_config.yaml", "repo_id": "trl", "token_count": 158 }
561
# Research projects that use TRL Welcome to the research projects folder! Here you can find the scripts used for some research projects that used TRL and maintained by the developers and the community (LM de-toxification, Stack-Llama, etc.). Check out the READMEs in the subfolders for more information! - [De-detoxify...
trl/examples/research_projects/README.md/0
{ "file_path": "trl/examples/research_projects/README.md", "repo_id": "trl", "token_count": 189 }
562
# Copyright 2020-2025 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 appl...
trl/examples/research_projects/toxicity/scripts/evaluate-toxicity.py/0
{ "file_path": "trl/examples/research_projects/toxicity/scripts/evaluate-toxicity.py", "repo_id": "trl", "token_count": 2223 }
563
# Copyright 2020-2025 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 appl...
trl/scripts/add_copyrights.py/0
{ "file_path": "trl/scripts/add_copyrights.py", "repo_id": "trl", "token_count": 1111 }
564
# Copyright 2020-2025 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 appl...
trl/tests/slow/test_sft_slow.py/0
{ "file_path": "trl/tests/slow/test_sft_slow.py", "repo_id": "trl", "token_count": 7352 }
565
# Copyright 2020-2025 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 appl...
trl/tests/test_judges.py/0
{ "file_path": "trl/tests/test_judges.py", "repo_id": "trl", "token_count": 1303 }
566
# Copyright 2020-2025 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 appl...
trl/tests/test_utils.py/0
{ "file_path": "trl/tests/test_utils.py", "repo_id": "trl", "token_count": 21956 }
567
# Copyright 2020-2025 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 appl...
trl/trl/experimental/__init__.py/0
{ "file_path": "trl/trl/experimental/__init__.py", "repo_id": "trl", "token_count": 366 }
568
# Copyright 2020-2025 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 appl...
trl/trl/extras/vllm_client.py/0
{ "file_path": "trl/trl/extras/vllm_client.py", "repo_id": "trl", "token_count": 7256 }
569
# Copyright 2020-2025 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 appl...
trl/trl/scripts/kto.py/0
{ "file_path": "trl/trl/scripts/kto.py", "repo_id": "trl", "token_count": 2045 }
570
# Copyright 2020-2025 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 appl...
trl/trl/trainer/gkd_trainer.py/0
{ "file_path": "trl/trl/trainer/gkd_trainer.py", "repo_id": "trl", "token_count": 8728 }
571
# Copyright 2020-2025 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 appl...
trl/trl/trainer/prm_trainer.py/0
{ "file_path": "trl/trl/trainer/prm_trainer.py", "repo_id": "trl", "token_count": 6060 }
572
# Introduction <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/bonus-unit3/pokemon_thumbnail.png" alt="Bonus Unit 3 AI in Games"/> 🎶I want to be the very best ... 🎶 Welcome to this **bonus unit**, where you'll explore the exciting intersection of **AI Agents and games**! 🎮🤖 ...
agents-course/units/en/bonus-unit3/introduction.mdx/0
{ "file_path": "agents-course/units/en/bonus-unit3/introduction.mdx", "repo_id": "agents-course", "token_count": 516 }
0
### Q1: What is an Agent? Which of the following best describes an AI Agent? <Question choices={[ { text: "An AI model that can reason, plan, and use tools to interact with its environment to achieve a specific goal.", explain: "This definition captures the essential characteristics of an Agent.", correct: true }, { t...
agents-course/units/en/unit1/quiz1.mdx/0
{ "file_path": "agents-course/units/en/unit1/quiz1.mdx", "repo_id": "agents-course", "token_count": 1562 }
1
# Using Agents in LlamaIndex Remember Alfred, our helpful butler agent from earlier? Well, he's about to get an upgrade! Now that we understand the tools available in LlamaIndex, we can give Alfred new capabilities to serve us better. But before we continue, let's remind ourselves what makes an agent like Alfred tick...
agents-course/units/en/unit2/llama-index/agents.mdx/0
{ "file_path": "agents-course/units/en/unit2/llama-index/agents.mdx", "repo_id": "agents-course", "token_count": 2112 }
2
<CourseFloatingBanner classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Google Colab", value: "https://colab.research.google.com/#fileId=https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/retrieval_agents.ipynb"}, ]} askForHelpUrl="http://hf.co/join/discord" /> # Building A...
agents-course/units/en/unit2/smolagents/retrieval_agents.mdx/0
{ "file_path": "agents-course/units/en/unit2/smolagents/retrieval_agents.mdx", "repo_id": "agents-course", "token_count": 2404 }
3
# Welcome to the final Unit [[introduction]] <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit4/thumbnail.jpg" alt="AI Agents Course thumbnail" width="100%"/> Welcome to the final unit of the course! 🎉 So far, you’ve **built a strong foundation in AI Agents**, from understan...
agents-course/units/en/unit4/introduction.mdx/0
{ "file_path": "agents-course/units/en/unit4/introduction.mdx", "repo_id": "agents-course", "token_count": 433 }
4
# El Estado del Arte en el Uso de LLMs en Juegos Para darte una idea de cuánto se ha avanzado en este campo, examinemos tres demos tecnológicas y un juego publicado que muestran la integración de LLMs en los videojuegos. ## 🕵️‍♂️ Covert Protocol por NVIDIA e Inworld AI <img src="https://huggingface.co/datasets/agen...
agents-course/units/es/bonus-unit3/state-of-art.mdx/0
{ "file_path": "agents-course/units/es/bonus-unit3/state-of-art.mdx", "repo_id": "agents-course", "token_count": 1184 }
5
# Pensamiento: Razonamiento Interno y el Enfoque Re-Act <Tip> En esta sección, profundizamos en el funcionamiento interno de un agente de IA—su capacidad para razonar y planificar. Exploraremos cómo el agente aprovecha su diálogo interno para analizar información, desglosar problemas complejos en pasos manejables y d...
agents-course/units/es/unit1/thoughts.mdx/0
{ "file_path": "agents-course/units/es/unit1/thoughts.mdx", "repo_id": "agents-course", "token_count": 1519 }
6
# Conclusión !Felicidades por terminar el módulo `llama-index` de esta segunda Unidad 🥳 Acabas de dominar los fundamentos de `llama-index` y has visto como construir tus propias flujos de trabajo agentivos! Ahora que tienes habilidades en `llama-index`, puedes empezar a crear motores de búsqueda que resolveran tarea...
agents-course/units/es/unit2/llama-index/conclusion.mdx/0
{ "file_path": "agents-course/units/es/unit2/llama-index/conclusion.mdx", "repo_id": "agents-course", "token_count": 377 }
7
<CourseFloatingBanner chapter={2} classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Google Colab", value: "https://colab.research.google.com/#fileId=https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/tools.ipynb"}, ]} /> # Herramientas Como exploramos en la [unidad 1](htt...
agents-course/units/es/unit2/smolagents/tools.mdx/0
{ "file_path": "agents-course/units/es/unit2/smolagents/tools.mdx", "repo_id": "agents-course", "token_count": 5480 }
8
# ¿Qué es GAIA? [GAIA](https://huggingface.co/papers/2311.12983) es un **benchmark diseñado para evaluar asistentes de IA en tareas del mundo real** que requieren una combinación de capacidades centrales, como razonamiento, comprensión multimodal, navegación web y uso competente de herramientas. Fue introducido en el...
agents-course/units/es/unit4/what-is-gaia.mdx/0
{ "file_path": "agents-course/units/es/unit4/what-is-gaia.mdx", "repo_id": "agents-course", "token_count": 1674 }
9
# Que sont les outils ? <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-2.jpg" alt="Planification de l'Unité 1"/> Un aspect crucial des agents est leur capacité à prendre des **actions**. Comme nous l'avons vu, cela se fait par l'utilisation d'**outils**. ...
agents-course/units/fr/unit1/tools.mdx/0
{ "file_path": "agents-course/units/fr/unit1/tools.mdx", "repo_id": "agents-course", "token_count": 6144 }
10
<CourseFloatingBanner classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Google Colab", value: "https://colab.research.google.com/#fileId=https://huggingface.co/agents-course/notebooks/blob/main/fr/unit2/smolagents/vision_agents.ipynb"}, ]} askForHelpUrl="http://hf.co/join/discord" /> # Agents vis...
agents-course/units/fr/unit2/smolagents/vision_agents.mdx/0
{ "file_path": "agents-course/units/fr/unit2/smolagents/vision_agents.mdx", "repo_id": "agents-course", "token_count": 5099 }
11
# 소개[[introduction]] ![Bonus Unit 1 Thumbnail](https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/bonus-unit1/thumbnail.jpg) 첫 번째 **Bonus Unit**에 오신 것을 환영합니다. 여기에서 **함수 호출을 위한 대형 언어 모델(LLM)을 미세 조정하는 방법**을 배우게 됩니다. 대형 언어 모델(LLM)에서 함수 호출은 *필수 학습* 기술이 되어 가고 있습니다. 여기서 핵심은 Unit 1에서 했던 것처럼 프롬프트 ...
agents-course/units/ko/bonus-unit1/introduction.mdx/0
{ "file_path": "agents-course/units/ko/bonus-unit1/introduction.mdx", "repo_id": "agents-course", "token_count": 2653 }
12
# 도구(Tool)란? [[what-are-tools]] <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-2.jpg" alt="Unit 1 planning"/> AI 에이전트(AI Agents)의 핵심 요소 중 하나는 **행동(Actions)**을 수행할 수 있는 능력입니다. 이러한 행동은 **도구(Tools)**를 사용하여 이루어집니다. 이번 섹션에서는 도구란 무엇이고, 어떻게 효과적으로 설계하는지, 시스템 메시지를...
agents-course/units/ko/unit1/tools.mdx/0
{ "file_path": "agents-course/units/ko/unit1/tools.mdx", "repo_id": "agents-course", "token_count": 11441 }
13
# Понимание AI Агентов через цикл Мысль - Действие - Наблюдение. <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-3.jpg" alt="Раздел 1 планирование"/> В предыдущих разделах мы узнали: - **Как инструменты становятся доступны агенту в системной подсказке**. -...
agents-course/units/ru-RU/unit1/agent-steps-and-structure.mdx/0
{ "file_path": "agents-course/units/ru-RU/unit1/agent-steps-and-structure.mdx", "repo_id": "agents-course", "token_count": 6492 }
14
# Kết luận [[conclusion]] Chúc mừng các bạn đã hoàn thành chương bổ trợ đầu tiên 🥳 Bạn đã **thành thạo việc hiểu function-calling và cách fine-tune (tinh chỉnh) model để thực hiện function-calling**! Nếu có một lời khuyên từ chúng mình lúc này, đó là hãy thử **fine-tune các model khác nhau**. **Cách học tốt nhất ch...
agents-course/units/vi/bonus-unit1/conclusion.mdx/0
{ "file_path": "agents-course/units/vi/bonus-unit1/conclusion.mdx", "repo_id": "agents-course", "token_count": 563 }
15
# Quan sát: Tích hợp phản hồi để phản ánh và thích ứng Quan sát là **cách Agent nhận thức hậu quả từ hành động của nó**. Chúng cung cấp thông tin quan trọng thúc đẩy quá trình tư duy của Agent và định hướng các hành động tiếp theo. Chúng là **tín hiệu từ môi trường**—dù là dữ liệu từ API, thông báo lỗi hay nhật ký...
agents-course/units/vi/unit1/observations.mdx/0
{ "file_path": "agents-course/units/vi/unit1/observations.mdx", "repo_id": "agents-course", "token_count": 2084 }
16
# 构建你自己的宝可梦对战智能体 现在你已经探索了智能体 AI 在游戏中的潜力和局限性,是时候亲自动手了。在本节中,你将**构建自己的 AI 智能体来进行宝可梦风格的回合制战斗**,使用你在整个课程中学到的一切知识。 我们将把系统分解为四个关键构建块: - **Poke-env:** 一个专为训练基于规则或强化学习的宝可梦机器人而设计的 Python 库。 - **Pokémon Showdown:** 一个在线对战模拟器,你的智能体将在这里战斗。 - **LLMAgentBase:** 我们构建的一个自定义 Python 类,用于将你的 LLM 与 Poke-env 战斗环境连接。 - **TemplateAgent:...
agents-course/units/zh-CN/bonus-unit3/building_your_pokemon_agent.mdx/0
{ "file_path": "agents-course/units/zh-CN/bonus-unit3/building_your_pokemon_agent.mdx", "repo_id": "agents-course", "token_count": 6699 }
17
# 动作:使智能体能够与环境交互 <Tip> 在本节中,我们将探讨 AI 智能体 (AI agent) 与其环境交互的具体步骤。 我们将介绍动作 (actions) 如何被表示(使用 JSON 或代码),停止和解析方法 (stop and parse approach) 的重要性,以及不同类型的智能体。 </Tip> 动作是**AI 智能体 (AI agent) 与其环境交互的具体步骤**。 无论是浏览网络获取信息还是控制物理设备,每个动作都是智能体执行的一个特定操作。 例如,一个协助客户服务的智能体可能会检索客户数据、提供支持文章或将问题转交给人工代表。 ## 智能体动作的类型 (Types of Agent Acti...
agents-course/units/zh-CN/unit1/actions.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit1/actions.mdx", "repo_id": "agents-course", "token_count": 3502 }
18
# LangGraph 的核心构建模块 要使用 LangGraph 构建应用程序,需要理解其核心组件。让我们探索构成 LangGraph 应用程序的基础构建模块。 <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/LangGraph/Building_blocks.png" alt="Building Blocks" width="70%"/> LangGraph 应用程序从 **entrypoint** 开始,根据执行情况,流程可能流向不同的函数直到抵达 END。 <img src="htt...
agents-course/units/zh-CN/unit2/langgraph/building_blocks.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/langgraph/building_blocks.mdx", "repo_id": "agents-course", "token_count": 2010 }
19
# 在 LlamaIndex 中创建智能工作流 LlamaIndex 中的工作流提供了一种结构化方式来将代码组织成可管理的顺序步骤。 这种工作流通过定义由`事件(Events)`触发的`步骤(Steps)`来创建,这些步骤本身也会发出`事件`来触发后续步骤。 让我们看看 Alfred 展示的用于 RAG 任务的 LlamaIndex 工作流。 ![工作流示意图](https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/workflows.png) **工作流具有以下关键优势:** - 将代码清...
agents-course/units/zh-CN/unit2/llama-index/workflows.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/llama-index/workflows.mdx", "repo_id": "agents-course", "token_count": 5010 }
20
# 总结 在本单元中,我们学习了如何创建智能体增强的检索生成(RAG)系统,帮助我们友好的智能体 Alfred 筹备并管理一场盛大的晚会。 RAG 与智能体能力的结合展示了当 AI 助手具备以下能力时的强大潜力: - 访问结构化知识(宾客信息) - 获取实时信息(网络搜索) - 领域专用工具(天气信息、Hub 统计) - 历史交互记忆 凭借这些能力,Alfred 现已具备完美主持者的素质,能够回答宾客问题、提供最新信息、确保晚会顺利进行——甚至能精准控制烟花表演的时机! <Tip> 完成智能体构建后,您可以进一步探索: - 为特定用例创建定制化工具 - 使用嵌入技术实现更复杂的 RAG 系统 - 构建可协作的多智能体系统...
agents-course/units/zh-CN/unit3/agentic-rag/conclusion.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit3/agentic-rag/conclusion.mdx", "repo_id": "agents-course", "token_count": 632 }
21
[workspace] members = [ "candle-core", "candle-datasets", "candle-examples", "candle-nn", "candle-pyo3", "candle-transformers", "candle-wasm-examples/*", "candle-wasm-tests", "tensor-tools", ] exclude = [ "candle-book", "candle-flash-attn", "candle-kernels", "candle-m...
candle/Cargo.toml/0
{ "file_path": "candle/Cargo.toml", "repo_id": "candle", "token_count": 1379 }
22
# Chapter 1
candle/candle-book/src/chapter_1.md/0
{ "file_path": "candle/candle-book/src/chapter_1.md", "repo_id": "candle", "token_count": 4 }
23
# Running a model In order to run an existing model, you will need to download and use existing weights. Most models are already available on https://huggingface.co/ in [`safetensors`](https://github.com/huggingface/safetensors) format. Let's get started by running an old model : `bert-base-uncased`.
candle/candle-book/src/inference/inference.md/0
{ "file_path": "candle/candle-book/src/inference/inference.md", "repo_id": "candle", "token_count": 88 }
24
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 }
25
use super::{Cpu, CpuBF16, CpuF16}; #[cfg(target_arch = "x86")] use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; use half::{bf16, f16}; pub struct CurrentCpu {} const STEP: usize = 32; const EPR: usize = 8; const ARR: usize = STEP / EPR; impl Cpu<ARR> for CurrentCpu { type Unit =...
candle/candle-core/src/cpu/avx.rs/0
{ "file_path": "candle/candle-core/src/cpu/avx.rs", "repo_id": "candle", "token_count": 3288 }
26
//! Types for elements that can be stored and manipulated using tensors. #![allow(clippy::redundant_closure_call)] use crate::backend::BackendStorage; use crate::cpu::kernels::VecOps; use crate::{CpuStorage, CpuStorageRef, Error, Result}; /// The different types of elements allowed in tensors. #[derive(Debug, Copy, Cl...
candle/candle-core/src/dtype.rs/0
{ "file_path": "candle/candle-core/src/dtype.rs", "repo_id": "candle", "token_count": 3549 }
27
#![allow(unused)] use super::GgmlDType; use crate::{Error, MetalDevice, MetalStorage, Result}; pub struct QMetalStorage { dtype: GgmlDType, device: MetalDevice, } impl QMetalStorage { pub fn zeros(_: &MetalDevice, _: usize, _: GgmlDType) -> Result<Self> { Err(Error::NotCompiledWithMetalSupport) ...
candle/candle-core/src/quantized/dummy_metal.rs/0
{ "file_path": "candle/candle-core/src/quantized/dummy_metal.rs", "repo_id": "candle", "token_count": 522 }
28
//! Tensors are N-dimensional matrixes of elements using a single data type. #![allow(clippy::redundant_closure_call)] use crate::backend::{BackendDevice, BackendStorage}; use crate::op::{BackpropOp, BinaryOp, CmpOp, Op, ReduceOp, UnaryOp}; use crate::scalar::TensorOrScalar; use crate::shape::{Dim, Dims, ShapeWithOneHo...
candle/candle-core/src/tensor.rs/0
{ "file_path": "candle/candle-core/src/tensor.rs", "repo_id": "candle", "token_count": 52099 }
29
/// Regression test for pth files not loading on Windows. #[test] fn test_pth() { let tensors = candle_core::pickle::PthTensors::new("tests/test.pt", None).unwrap(); tensors.get("test").unwrap().unwrap(); } #[test] fn test_pth_with_key() { let tensors = candle_core::pickle::PthTensors::new("tests/t...
candle/candle-core/tests/pth_tests.rs/0
{ "file_path": "candle/candle-core/tests/pth_tests.rs", "repo_id": "candle", "token_count": 440 }
30
//! Zalando Fashion MNIST dataset. //! A slightly more difficult dataset that is drop-in compatible with MNIST. //! //! Taken from here: https://huggingface.co/datasets/zalando-datasets/fashion_mnist use candle::Result; pub fn load() -> Result<crate::vision::Dataset> { crate::vision::mnist::load_mnist_like( ...
candle/candle-datasets/src/vision/fashion_mnist.rs/0
{ "file_path": "candle/candle-datasets/src/vision/fashion_mnist.rs", "repo_id": "candle", "token_count": 196 }
31
# candle-chatglm Uses `THUDM/chatglm3-6b` to generate chinese text. Will not generate text for english (usually). ## Text Generation ```bash cargo run --example chatglm --release -- --prompt "部署门槛较低等众多优秀特 " > 部署门槛较低等众多优秀特 点,使得其成为了一款备受欢迎的AI助手。 > > 作为一款人工智能助手,ChatGLM3-6B ```
candle/candle-examples/examples/chatglm/README.md/0
{ "file_path": "candle/candle-examples/examples/chatglm/README.md", "repo_id": "candle", "token_count": 204 }
32
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::fastvit; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { T8,...
candle/candle-examples/examples/fastvit/main.rs/0
{ "file_path": "candle/candle-examples/examples/fastvit/main.rs", "repo_id": "candle", "token_count": 1331 }
33
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::hiera; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { Tiny,...
candle/candle-examples/examples/hiera/main.rs/0
{ "file_path": "candle/candle-examples/examples/hiera/main.rs", "repo_id": "candle", "token_count": 1256 }
34
/// This follows the lines of: /// https://github.com/johnma2006/mamba-minimal/blob/master/model.py /// Simple, minimal implementation of Mamba in one file of PyTorch. use candle::{IndexOp, Module, Result, Tensor, D}; use candle_nn::{RmsNorm, VarBuilder}; use candle_transformers::models::with_tracing::{linear, linear_...
candle/candle-examples/examples/mamba-minimal/model.rs/0
{ "file_path": "candle/candle-examples/examples/mamba-minimal/model.rs", "repo_id": "candle", "token_count": 3490 }
35
# candle-mnist-training Training a 2 layer MLP on mnist in Candle. ## Running an example ```bash $ cargo run --example mnist-training --features candle-datasets > train-images: [60000, 784] > train-labels: [60000] > test-images: [10000, 784] > test-labels: [10000] > 1 train loss: 2.30265 test acc: 68.08% > 2...
candle/candle-examples/examples/mnist-training/README.md/0
{ "file_path": "candle/candle-examples/examples/mnist-training/README.md", "repo_id": "candle", "token_count": 143 }
36
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::{Error as E, Result}; use candle::{DType, IndexOp, Shape, Tensor, D}; use candle_nn::VarBuilder; use candle_transformers::models::nvembed_v2::model::Model; use clap::Parser; use hf_hub::{api::sy...
candle/candle-examples/examples/nvembed_v2/main.rs/0
{ "file_path": "candle/candle-examples/examples/nvembed_v2/main.rs", "repo_id": "candle", "token_count": 3339 }
37
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::{Error as E, Result}; use clap::{Parser, ValueEnum}; use candle_examples::token_output_stream::TokenOutputStream; use candle_transformers::models::mixformer::{Config, MixFormerSequentialForCaus...
candle/candle-examples/examples/phi/main.rs/0
{ "file_path": "candle/candle-examples/examples/phi/main.rs", "repo_id": "candle", "token_count": 9709 }
38
# candle-qwen: large language model series from Alibaba Cloud Qwen 1.5 is a series of large language models that provide strong performances on English and Chinese. - [Blog post](https://qwenlm.github.io/blog/qwen1.5/) introducing Qwen1.5. - [Model card](https://huggingface.co/Qwen/Qwen1.5-0.5B) on the HuggingFace Hu...
candle/candle-examples/examples/qwen/README.md/0
{ "file_path": "candle/candle-examples/examples/qwen/README.md", "repo_id": "candle", "token_count": 616 }
39
# candle-resnet A candle implementation of inference using a pre-trained [ResNet](https://arxiv.org/abs/1512.03385). This uses a classification head trained on the ImageNet dataset and returns the probabilities for the top-5 classes. ## Running an example ``` $ cargo run --example resnet --release -- --image candle-...
candle/candle-examples/examples/resnet/README.md/0
{ "file_path": "candle/candle-examples/examples/resnet/README.md", "repo_id": "candle", "token_count": 220 }
40
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::Result; use clap::Parser; use candle::{DType, Tensor}; #[derive(Clone, Debug, Copy, PartialEq, Eq, clap::ValueEnum)] enum Which { #[value(name = "silero")] Silero, } #[derive(Clone, D...
candle/candle-examples/examples/silero-vad/main.rs/0
{ "file_path": "candle/candle-examples/examples/silero-vad/main.rs", "repo_id": "candle", "token_count": 2894 }
41
# candle-starcoder2 Candle implementation of Star Coder 2 family of code generation model from [StarCoder 2 and The Stack v2: The Next Generation](https://arxiv.org/pdf/2402.19173). ## Running an example ```bash $ cargo run --example starcoder2 -- --prompt "write a recursive fibonacci function in python " > # that ...
candle/candle-examples/examples/starcoder2/README.md/0
{ "file_path": "candle/candle-examples/examples/starcoder2/README.md", "repo_id": "candle", "token_count": 126 }
42
use std::path::PathBuf; use anyhow::Result; use hf_hub::{api::sync::Api, Repo, RepoType}; /// # Errors /// /// Returns an error if the model files cannot be downloaded. /// /// # Panics /// /// Panics if the model files cannot be downloaded. pub fn model_files(model_id: &str) -> Result<((PathBuf, Vec<PathBuf>), PathB...
candle/candle-examples/examples/voxtral/download.rs/0
{ "file_path": "candle/candle-examples/examples/voxtral/download.rs", "repo_id": "candle", "token_count": 1158 }
43
# candle-xlm-roberta This example demonstrates how to use the XLM-RoBERTa model in Candle especially known for their use in reranking. It uses the `fill-mask` task to generate a word for a masked token. And a `reranker` task to rerank a list of documents for a given query. ## Usage Fill Mask: ```bash cargo run --exa...
candle/candle-examples/examples/xlm-roberta/Readme.md/0
{ "file_path": "candle/candle-examples/examples/xlm-roberta/Readme.md", "repo_id": "candle", "token_count": 547 }
44
#include "kernels.h" #include "kernel_helpers.h" #include "flash_fwd_launch_template.h" void run_mha_fwd(Flash_fwd_params &params, cudaStream_t stream) { FP16_SWITCH(!params.is_bf16, [&] { HEADDIM_SWITCH(params.d, [&] { BOOL_SWITCH(params.is_causal, Is_causal, [&] { run_mha_fwd_<elem_ty...
candle/candle-flash-attn/kernels/flash_api.cu/0
{ "file_path": "candle/candle-flash-attn/kernels/flash_api.cu", "repo_id": "candle", "token_count": 1818 }
45