text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
{"[MASK]": 0, "[UNK]": 1, "[PAD]": 2, "DUMMY": 3, "DUMMY2": 4, "[MASK2]": 5}
transformers/tests/fixtures/test_entity_vocab.json/0
{ "file_path": "transformers/tests/fixtures/test_entity_vocab.json", "repo_id": "transformers", "token_count": 45 }
563
[ { "repo_id": "hf-audio/xcodec-hubert-librispeech", "bandwidth": 0.5, "codes": [ [ [ 590, 590, 306, 306, 590, 1006, 826, ...
transformers/tests/fixtures/xcodec/integration_tests.json/0
{ "file_path": "transformers/tests/fixtures/xcodec/integration_tests.json", "repo_id": "transformers", "token_count": 55835 }
564
# 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/aimv2/test_modeling_aimv2.py/0
{ "file_path": "transformers/tests/models/aimv2/test_modeling_aimv2.py", "repo_id": "transformers", "token_count": 12409 }
565
# 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/bert/test_modeling_bert.py/0
{ "file_path": "transformers/tests/models/bert/test_modeling_bert.py", "repo_id": "transformers", "token_count": 14119 }
566
# 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/biogpt/test_tokenization_biogpt.py/0
{ "file_path": "transformers/tests/models/biogpt/test_tokenization_biogpt.py", "repo_id": "transformers", "token_count": 1549 }
567
# 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/blip/test_processing_blip.py/0
{ "file_path": "transformers/tests/models/blip/test_processing_blip.py", "repo_id": "transformers", "token_count": 2299 }
568
# 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/camembert/test_modeling_camembert.py/0
{ "file_path": "transformers/tests/models/camembert/test_modeling_camembert.py", "repo_id": "transformers", "token_count": 1257 }
569
# 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 }
570
# Copyright 2022 The OpenBMB Team and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
transformers/tests/models/cpmant/test_tokenization_cpmant.py/0
{ "file_path": "transformers/tests/models/cpmant/test_tokenization_cpmant.py", "repo_id": "transformers", "token_count": 1096 }
571
# 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": 6149 }
572
# 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 }
573
# 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": 1442 }
574
# 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 }
575
# 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/gemma3n/test_processing_gemma3n.py/0
{ "file_path": "transformers/tests/models/gemma3n/test_processing_gemma3n.py", "repo_id": "transformers", "token_count": 2913 }
576
# 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/tests/models/idefics2/test_modeling_idefics2.py/0
{ "file_path": "transformers/tests/models/idefics2/test_modeling_idefics2.py", "repo_id": "transformers", "token_count": 14062 }
577
# 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/lfm2/test_modeling_lfm2.py/0
{ "file_path": "transformers/tests/models/lfm2/test_modeling_lfm2.py", "repo_id": "transformers", "token_count": 1183 }
578
# 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/longformer/test_modeling_longformer.py/0
{ "file_path": "transformers/tests/models/longformer/test_modeling_longformer.py", "repo_id": "transformers", "token_count": 15694 }
579
# 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/mamba2/test_modeling_mamba2.py/0
{ "file_path": "transformers/tests/models/mamba2/test_modeling_mamba2.py", "repo_id": "transformers", "token_count": 10137 }
580
# 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/tests/models/mimi/test_modeling_mimi.py/0
{ "file_path": "transformers/tests/models/mimi/test_modeling_mimi.py", "repo_id": "transformers", "token_count": 11725 }
581
# 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/tests/models/olmoe/test_modeling_olmoe.py/0
{ "file_path": "transformers/tests/models/olmoe/test_modeling_olmoe.py", "repo_id": "transformers", "token_count": 6000 }
582
# 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/ovis2/test_processor_ovis2.py/0
{ "file_path": "transformers/tests/models/ovis2/test_processor_ovis2.py", "repo_id": "transformers", "token_count": 2107 }
583
# 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/pix2struct/test_modeling_pix2struct.py/0
{ "file_path": "transformers/tests/models/pix2struct/test_modeling_pix2struct.py", "repo_id": "transformers", "token_count": 16393 }
584
# 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/pop2piano/test_tokenization_pop2piano.py/0
{ "file_path": "transformers/tests/models/pop2piano/test_tokenization_pop2piano.py", "repo_id": "transformers", "token_count": 7928 }
585
# coding=utf-8 # Copyright 2025 The Qwen team, Alibaba Group 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.or...
transformers/tests/models/qwen2_5_omni/test_modeling_qwen2_5_omni.py/0
{ "file_path": "transformers/tests/models/qwen2_5_omni/test_modeling_qwen2_5_omni.py", "repo_id": "transformers", "token_count": 17974 }
586
# 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/rembert/test_tokenization_rembert.py/0
{ "file_path": "transformers/tests/models/rembert/test_tokenization_rembert.py", "repo_id": "transformers", "token_count": 6955 }
587
# 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...
transformers/tests/models/rt_detr/test_modeling_rt_detr.py/0
{ "file_path": "transformers/tests/models/rt_detr/test_modeling_rt_detr.py", "repo_id": "transformers", "token_count": 15985 }
588
# 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/siglip2/test_modeling_siglip2.py/0
{ "file_path": "transformers/tests/models/siglip2/test_modeling_siglip2.py", "repo_id": "transformers", "token_count": 13151 }
589
# Copyright 2021-2023 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
transformers/tests/models/speecht5/test_feature_extraction_speecht5.py/0
{ "file_path": "transformers/tests/models/speecht5/test_feature_extraction_speecht5.py", "repo_id": "transformers", "token_count": 8412 }
590
# 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/superglue/test_modeling_superglue.py/0
{ "file_path": "transformers/tests/models/superglue/test_modeling_superglue.py", "repo_id": "transformers", "token_count": 8457 }
591
# Copyright 2018 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 required by applica...
transformers/tests/models/t5/test_modeling_t5.py/0
{ "file_path": "transformers/tests/models/t5/test_modeling_t5.py", "repo_id": "transformers", "token_count": 38837 }
592
# 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 agreed to in writ...
transformers/tests/models/videomae/test_image_processing_videomae.py/0
{ "file_path": "transformers/tests/models/videomae/test_image_processing_videomae.py", "repo_id": "transformers", "token_count": 3754 }
593
# 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/vit/test_modeling_vit.py/0
{ "file_path": "transformers/tests/models/vit/test_modeling_vit.py", "repo_id": "transformers", "token_count": 5234 }
594
# 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/vits/test_modeling_vits.py/0
{ "file_path": "transformers/tests/models/vits/test_modeling_vits.py", "repo_id": "transformers", "token_count": 9537 }
595
# 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/pipelines/test_pipelines_image_to_text.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_image_to_text.py", "repo_id": "transformers", "token_count": 4465 }
596
# 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 }
597
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 }
598
# 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": 17293 }
599
# 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 agreed to in writ...
transformers/tests/test_feature_extraction_common.py/0
{ "file_path": "transformers/tests/test_feature_extraction_common.py", "repo_id": "transformers", "token_count": 821 }
600
# 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 law or agreed ...
transformers/tests/trainer/test_trainer.py/0
{ "file_path": "transformers/tests/trainer/test_trainer.py", "repo_id": "transformers", "token_count": 123327 }
601
# 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": 14635 }
602
# Copyright 2019-present, the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
transformers/tests/utils/test_generic.py/0
{ "file_path": "transformers/tests/utils/test_generic.py", "repo_id": "transformers", "token_count": 5891 }
603
# Copyright 2019 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
transformers/tests/utils/test_tokenization_utils.py/0
{ "file_path": "transformers/tests/utils/test_tokenization_utils.py", "repo_id": "transformers", "token_count": 5851 }
604
# 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_model_tester.py/0
{ "file_path": "transformers/utils/check_model_tester.py", "repo_id": "transformers", "token_count": 1240 }
605
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def get_jobs(workflow_run_id, token=None): """Extract jobs in a GitHub Actions workflow run""" headers = None if token is not None: headers = {"Accept": "...
transformers/utils/get_ci_error_statistics.py/0
{ "file_path": "transformers/utils/get_ci_error_statistics.py", "repo_id": "transformers", "token_count": 4815 }
606
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
transformers/utils/print_env.py/0
{ "file_path": "transformers/utils/print_env.py", "repo_id": "transformers", "token_count": 912 }
607
import numpy as np from transformers import Pipeline def softmax(outputs): maxes = np.max(outputs, axis=-1, keepdims=True) shifted_exp = np.exp(outputs - maxes) return shifted_exp / shifted_exp.sum(axis=-1, keepdims=True) class PairClassificationPipeline(Pipeline): def _sanitize_parameters(self, **...
transformers/utils/test_module/custom_pipeline.py/0
{ "file_path": "transformers/utils/test_module/custom_pipeline.py", "repo_id": "transformers", "token_count": 453 }
608
# Detoxifying a Language Model using PPO Language models (LMs) are known to sometimes generate toxic outputs. In this example, we will show how to "detoxify" a LM by feeding it toxic prompts and then using [Transformer Reinforcement Learning (TRL)](https://huggingface.co/docs/trl/index) and Proximal Policy Optimizatio...
trl/docs/source/detoxifying_a_lm.md/0
{ "file_path": "trl/docs/source/detoxifying_a_lm.md", "repo_id": "trl", "token_count": 3789 }
609
# Multi Adapter RL (MARL) - a single base model for everything Here we present an approach that uses a single base model for the entire PPO algorithm - which includes retrieving the reference logits, computing the active logits and the rewards. This feature is experimental as we did not test the convergence of the app...
trl/docs/source/multi_adapter_rl.md/0
{ "file_path": "trl/docs/source/multi_adapter_rl.md", "repo_id": "trl", "token_count": 1227 }
610
# SFT Trainer [![All_models-SFT-blue](https://img.shields.io/badge/All_models-SFT-blue)](https://huggingface.co/models?other=sft,trl) [![smol_course-Chapter_1-yellow](https://img.shields.io/badge/smol_course-Chapter_1-yellow)](https://github.com/huggingface/smol-course/tree/main/1_instruction_tuning) ## Overview TRL...
trl/docs/source/sft_trainer.md/0
{ "file_path": "trl/docs/source/sft_trainer.md", "repo_id": "trl", "token_count": 4917 }
611
# 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/datasets/hh-rlhf-helpful-base.py/0
{ "file_path": "trl/examples/datasets/hh-rlhf-helpful-base.py", "repo_id": "trl", "token_count": 1846 }
612
# LayerSkip Training Recipe Implements the training recipe as described in the [LayerSkip paper](https://huggingface.co/papers/2404.16710). ## Run training ``` cd scripts python layer_skip_sft.py ``` ## Run benchmark ``` cd scripts python benchmark_layer_skip.py ```
trl/examples/research_projects/layer_skip/README.md/0
{ "file_path": "trl/examples/research_projects/layer_skip/README.md", "repo_id": "trl", "token_count": 86 }
613
# 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/gpt-j-6b-toxicity.py/0
{ "file_path": "trl/examples/research_projects/toxicity/scripts/gpt-j-6b-toxicity.py", "repo_id": "trl", "token_count": 3138 }
614
# 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/scripts/orpo.py/0
{ "file_path": "trl/examples/scripts/orpo.py", "repo_id": "trl", "token_count": 1380 }
615
# 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 }
616
# 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 }
617
# 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_gkd_trainer.py/0
{ "file_path": "trl/tests/test_gkd_trainer.py", "repo_id": "trl", "token_count": 5126 }
618
# 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_rloo_trainer.py/0
{ "file_path": "trl/tests/test_rloo_trainer.py", "repo_id": "trl", "token_count": 3828 }
619
# 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/cli.py/0
{ "file_path": "trl/trl/cli.py", "repo_id": "trl", "token_count": 2383 }
620
# 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/models/sd_utils.py/0
{ "file_path": "trl/trl/models/sd_utils.py", "repo_id": "trl", "token_count": 2510 }
621
# 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/alignprop_config.py/0
{ "file_path": "trl/trl/trainer/alignprop_config.py", "repo_id": "trl", "token_count": 3898 }
622
# 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/iterative_sft_trainer.py/0
{ "file_path": "trl/trl/trainer/iterative_sft_trainer.py", "repo_id": "trl", "token_count": 9421 }
623
# 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/reward_trainer.py/0
{ "file_path": "trl/trl/trainer/reward_trainer.py", "repo_id": "trl", "token_count": 7946 }
624
3.11
agents-course/quiz/.python-version/0
{ "file_path": "agents-course/quiz/.python-version", "repo_id": "agents-course", "token_count": 4 }
0
# Quiz: Evaluating AI Agents Let's assess your understanding of the agent tracing and evaluation concepts covered in this bonus unit. This quiz is optional and ungraded. ### Q1: What does observability in AI agents primarily refer to? Which statement accurately describes the purpose of observability for AI agents? ...
agents-course/units/en/bonus-unit2/quiz.mdx/0
{ "file_path": "agents-course/units/en/bonus-unit2/quiz.mdx", "repo_id": "agents-course", "token_count": 1277 }
1
# Dummy Agent Library <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg" alt="Unit 1 planning"/> This course is framework-agnostic because we want to **focus on the concepts of AI agents and avoid getting bogged down in the specifics of a particul...
agents-course/units/en/unit1/dummy-agent-library.mdx/0
{ "file_path": "agents-course/units/en/unit1/dummy-agent-library.mdx", "repo_id": "agents-course", "token_count": 3135 }
2
# Building Your First LangGraph Now that we understand the building blocks, let's put them into practice by building our first functional graph. We'll implement Alfred's email processing system, where he needs to: 1. Read incoming emails 2. Classify them as spam or legitimate 3. Draft a preliminary response for legit...
agents-course/units/en/unit2/langgraph/first_graph.mdx/0
{ "file_path": "agents-course/units/en/unit2/langgraph/first_graph.mdx", "repo_id": "agents-course", "token_count": 4339 }
3
# Exam Time! Well done on working through the material on `smolagents`! You've already achieved a lot. Now, it's time to put your knowledge to the test with a quiz. 🧠 ## Instructions - The quiz consists of code questions. - You will be given instructions to complete the code snippets. - Read the instructions carefu...
agents-course/units/en/unit2/smolagents/final_quiz.mdx/0
{ "file_path": "agents-course/units/en/unit2/smolagents/final_quiz.mdx", "repo_id": "agents-course", "token_count": 277 }
4
# Building and Integrating Tools for Your Agent In this section, we'll grant Alfred access to the web, enabling him to find the latest news and global updates. Additionally, he'll have access to weather data and Hugging Face hub model download statistics, so that he can make relevant conversation about fresh topics. ...
agents-course/units/en/unit3/agentic-rag/tools.mdx/0
{ "file_path": "agents-course/units/en/unit3/agentic-rag/tools.mdx", "repo_id": "agents-course", "token_count": 4393 }
5
# Construye tu Propio Agente de Batalla Pokémon Ahora que has explorado el potencial y las limitaciones de la IA Agéntica en los juegos, es hora de poner manos a la obra. En esta sección, **construirás tu propio Agente de IA para luchar en combates por turnos al estilo Pokémon**, utilizando todo lo que has aprendido a...
agents-course/units/es/bonus-unit3/building_your_pokemon_agent.mdx/0
{ "file_path": "agents-course/units/es/bonus-unit3/building_your_pokemon_agent.mdx", "repo_id": "agents-course", "token_count": 5941 }
6
# Introducción a los Agentes <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/thumbnail.jpg" alt="Thumbnail"/> Bienvenido a esta primera unidad, donde **construirás una base sólida en los fundamentos de los Agentes de IA** incluyendo: - **Comprendiendo los Agentes** - ¿...
agents-course/units/es/unit1/introduction.mdx/0
{ "file_path": "agents-course/units/es/unit1/introduction.mdx", "repo_id": "agents-course", "token_count": 751 }
7
# Evalua de tu comprensión de LangGraph ¡Vamos a comprobar tu comprensión de `LangGraph` on un breve cuestionario! Esto te ayudará a reforzar los conceptos clave que hemos cubierto hasta ahora. Este es un cuestionario opcional y no está calificado. ### Q1: ¿Cuál es el propósito principal de LangGraph?? ¿Qué afirmaci...
agents-course/units/es/unit2/langgraph/quiz1.mdx/0
{ "file_path": "agents-course/units/es/unit2/langgraph/quiz1.mdx", "repo_id": "agents-course", "token_count": 1963 }
8
<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/multiagent_notebook.ipynb"}, ]} /> # Sistemas Multi-Agente Los sistemas mu...
agents-course/units/es/unit2/smolagents/multi_agent_systems.mdx/0
{ "file_path": "agents-course/units/es/unit2/smolagents/multi_agent_systems.mdx", "repo_id": "agents-course", "token_count": 10340 }
9
# ¿Y ahora? ¿Qué temas debería aprender? La IA Agéntica es un campo en rápida evolución, y comprender los protocolos fundamentales es esencial para construir sistemas inteligentes y autónomos. Dos estándares importantes con los que deberías familiarizarte son: - El **Protocolo de Contexto del Modelo (MCP)** - El **P...
agents-course/units/es/unit4/additional-readings.mdx/0
{ "file_path": "agents-course/units/es/unit4/additional-readings.mdx", "repo_id": "agents-course", "token_count": 674 }
10
# Conclusion Si vous êtes arrivé jusqu'ici, félicitations ! 🥳 Vous avez construit avec succès votre propre agent de combat Pokémon ! ⚔️🎮 Vous avez maîtrisé les fondamentaux des **flux de travail agentiques**, connecté un **LLM** à un environnement de jeu, et déployé un Agent intelligent prêt à affronter les défis d...
agents-course/units/fr/bonus-unit3/conclusion.mdx/0
{ "file_path": "agents-course/units/fr/bonus-unit3/conclusion.mdx", "repo_id": "agents-course", "token_count": 447 }
11
# Messages et *tokens* spéciaux Maintenant que nous comprenons comment fonctionnent les LLM, examinons **comment ils structurent leurs générations via des patrons de chat (appelés aussi gabarit de chat)**. Tout comme avec ChatGPT, les utilisateurs interagissent généralement avec les agents via une interface de chat. ...
agents-course/units/fr/unit1/messages-and-special-tokens.mdx/0
{ "file_path": "agents-course/units/fr/unit1/messages-and-special-tokens.mdx", "repo_id": "agents-course", "token_count": 4350 }
12
# Qu'est-ce que LangGraph ? `LangGraph` est un *framework* développé par [LangChain](https://www.langchain.com/) **pour gérer le flux de contrôle des applications qui intègrent un LLM**. ## `LangGraph` est-il différent de `LangChain` ? LangChain fournit une interface standard pour interagir avec les modèles et autre...
agents-course/units/fr/unit2/langgraph/when_to_use_langgraph.mdx/0
{ "file_path": "agents-course/units/fr/unit2/langgraph/when_to_use_langgraph.mdx", "repo_id": "agents-course", "token_count": 1690 }
13
# Petit Quiz (non noté) [[quiz1]] Testons votre compréhension de `smolagents` avec un rapide quiz ! N'oubliez pas, se tester aide à renforcer l'apprentissage et à identifier les domaines qui pourraient nécessiter une révision. Ceci est un quiz optionnel et il n'est pas noté. ### Q1 : Quel est l'un des principaux ava...
agents-course/units/fr/unit2/smolagents/quiz1.mdx/0
{ "file_path": "agents-course/units/fr/unit2/smolagents/quiz1.mdx", "repo_id": "agents-course", "token_count": 2570 }
14
# Obtenez votre certificat 🎓 Si vous avez obtenu un score **supérieur à 30%, félicitations ! 👏 Vous êtes maintenant éligible pour réclamer votre certificat officiel.** Suivez les étapes ci-dessous pour le recevoir : 1. Visitez la [page du certificat](https://huggingface.co/spaces/agents-course/Unit4-Final-Certific...
agents-course/units/fr/unit4/get-your-certificate.mdx/0
{ "file_path": "agents-course/units/fr/unit4/get-your-certificate.mdx", "repo_id": "agents-course", "token_count": 470 }
15
# 관찰: 피드백을 통합하여 성찰하고 적응하기 [[observe-integrating-feedback-to-reflect-and-adapt]] 관찰은 **에이전트가 자신의 행동 결과를 인식하는 방법**입니다. 이는 에이전트의 사고 과정을 촉진하고 향후 행동을 안내하는 중요한 정보를 제공합니다. 관찰은 **환경으로부터의 신호**입니다. API의 데이터, 오류 메시지, 또는 시스템 로그와 같은 정보가 다음 사고 주기를 이끕니다. 관찰 단계에서 에이전트는: - **피드백 수집:** 행동이 성공했는지(또는 실패했는지)에 대한 데이터나 확인을 받습니다. - **결과 ...
agents-course/units/ko/unit1/observations.mdx/0
{ "file_path": "agents-course/units/ko/unit1/observations.mdx", "repo_id": "agents-course", "token_count": 2384 }
16
# Добро пожаловать на курс 🤗 ИИ Агенты [[introduction]] <img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/community_translation.png" alt="Community translation banner" width="100%"/> <figure> <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/ma...
agents-course/units/ru-RU/unit0/introduction.mdx/0
{ "file_path": "agents-course/units/ru-RU/unit0/introduction.mdx", "repo_id": "agents-course", "token_count": 8917 }
17
# Давайте создадим нашего первого агента с помощью smolagents В прошлом разделе мы узнали, как можно создавать агентов с нуля, используя код на Python, и **увидели, насколько утомительным может быть этот процесс**. К счастью, многие библиотеки Агентов упрощают эту работу, **выполняя большую часть тяжелой работы за вас...
agents-course/units/ru-RU/unit1/tutorial.mdx/0
{ "file_path": "agents-course/units/ru-RU/unit1/tutorial.mdx", "repo_id": "agents-course", "token_count": 8000 }
18
# Thư viện Dummy Agent <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg" alt="Unit 1 planning"/> Khóa học này không phụ thuộc framework cụ thể vì chúng ta muốn **tập trung vào khái niệm AI agent và tránh sa đà vào chi tiết kỹ thuật của một framew...
agents-course/units/vi/unit1/dummy-agent-library.mdx/0
{ "file_path": "agents-course/units/vi/unit1/dummy-agent-library.mdx", "repo_id": "agents-course", "token_count": 10373 }
19
# 结论 (Conclusion) [[conclusion]] 恭喜你完成第一个附加单元 🥳 你已经**掌握了函数调用 (function-calling) 的理解,以及如何微调 (fine-tune) 你的模型来实现函数调用**! 如果我们现在有一条建议,那就是尝试**微调 (fine-tune) 不同的模型**。**学习的最好方式就是通过尝试。** 在下一个单元中,你将学习如何使用**最先进的框架 (state-of-the-art frameworks),如 `smolagents`、`LlamaIndex` 和 `LangGraph`**。 最后,我们很想**听听你对这门课程的看法,以及我们如何改进它**。如果...
agents-course/units/zh-CN/bonus-unit1/conclusion.mdx/0
{ "file_path": "agents-course/units/zh-CN/bonus-unit1/conclusion.mdx", "repo_id": "agents-course", "token_count": 511 }
20
# 总结 [[conclusion]] 恭喜你完成第一单元 🥳 你刚刚**掌握了智能体 (Agents) 的基础知识**,并且创建了你的第一个 AI 智能体 (AI Agent)! 如果你对某些内容仍感到困惑,这是**很正常的**。智能体是一个复杂的主题,需要一定时间才能完全理解所有内容。 在继续之前,**请花时间真正掌握这些材料**。在进入有趣的部分之前,掌握这些要素并建立坚实的基础很重要。 如果你通过了测验,别忘了在这里获取你的证书 🎓 👉 [点击这里](https://huggingface.co/spaces/agents-course/unit1-certification-app) <img src="...
agents-course/units/zh-CN/unit1/conclusion.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit1/conclusion.mdx", "repo_id": "agents-course", "token_count": 767 }
21
# 文档分析图 Alfred 为您服务。作为韦恩先生值得信赖的管家,我已记录下协助处理各类文档需求的工作流程。当 Mr Wayne 外出进行...夜间活动时,我会确保所有文件、训练计划和营养方案都得到妥善分析和整理。 在离开前,他留下了本周训练计划的笔记。我随后负责拟定了明日餐点的**菜单**。 为应对未来的类似需求,让我们使用 LangGraph 构建一个文档分析系统来服务 Mr Wayne。该系统能够: 1. 处理图像文档 2. 使用视觉模型 (Vision Language Model) 提取文本 3. 在需要时执行计算(用于演示常规工具) 4. 分析内容并提供简明摘要 5. 执行与文档相关的特定指令 ## 管家的工...
agents-course/units/zh-CN/unit2/langgraph/document_analysis_agent.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/langgraph/document_analysis_agent.mdx", "repo_id": "agents-course", "token_count": 4514 }
22
# 结论 恭喜你完成了第二单元的 `smolagents` 模块 🥳 你刚刚掌握了 `smolagents` 的基础知识,并且构建了自己的智能体!现在你已经具备了 `smolagents` 的技能,你可以开始创建能够解决你感兴趣任务的智能体。 在下一个模块中,你将学习**如何使用 LlamaIndex 构建智能体(Agents)**。 最后,我们非常想**听听你对这门课程的看法以及我们如何改进它**。如果你有任何反馈,请👉 [填写这个表格](https://docs.google.com/forms/d/e/1FAIpQLSe9VaONn0eglax0uTwi29rIn4tM7H2sYmmybmG5jJNlE5v0xA/...
agents-course/units/zh-CN/unit2/smolagents/conclusion.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/smolagents/conclusion.mdx", "repo_id": "agents-course", "token_count": 454 }
23
# 创建宾客信息检索生成(RAG)工具 您信赖的智能体 Alfred 正在筹备本世纪最盛大的晚会。为确保活动顺利进行,Alfred 需要快速获取最新宾客信息。让我们通过定制化的检索增强生成(RAG)工具(基于专属数据集)为 Alfred 赋能。 ## 为何选择 RAG 技术? 试想 Alfred 在宾客间穿梭时需即时调取详细信息,传统大语言模型(LLM)可能面临以下挑战: 1. 宾客名单属于特定活动数据,不在模型训练范围内 2. 宾客信息可能频繁变更或更新 3. 需精确检索电子邮件地址等细节信息 这正是检索增强生成(RAG)技术的优势所在!通过结合检索系统与 LLM,Alfred 可按需获取准确、实时的宾客信息。 <Tip...
agents-course/units/zh-CN/unit3/agentic-rag/invitees.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit3/agentic-rag/invitees.mdx", "repo_id": "agents-course", "token_count": 8689 }
24
[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": 1373 }
25
# 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 }
26
# 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 }
27
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 }
28
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 }
29
//! 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 }
30
#![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 }
31
//! 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 }
32
/// 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 }
33
//! 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 }
34
# 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 }
35
#[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 }
36
/// 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 }
37