text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
# 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/mimi/test_modeling_mimi.py/0 | {
"file_path": "transformers/tests/models/mimi/test_modeling_mimi.py",
"repo_id": "transformers",
"token_count": 21775
} |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/moonshine/test_modeling_moonshine.py/0 | {
"file_path": "transformers/tests/models/moonshine/test_modeling_moonshine.py",
"repo_id": "transformers",
"token_count": 12733
} |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/pop2piano/test_modeling_pop2piano.py/0 | {
"file_path": "transformers/tests/models/pop2piano/test_modeling_pop2piano.py",
"repo_id": "transformers",
"token_count": 15020
} |
# coding=utf-8
# Copyright 2025 The Qwen Team 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/LICENS... | transformers/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py/0 | {
"file_path": "transformers/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py",
"repo_id": "transformers",
"token_count": 10316
} |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/resnet/test_modeling_tf_resnet.py/0 | {
"file_path": "transformers/tests/models/resnet/test_modeling_tf_resnet.py",
"repo_id": "transformers",
"token_count": 3760
} |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/roformer/test_modeling_tf_roformer.py/0 | {
"file_path": "transformers/tests/models/roformer/test_modeling_tf_roformer.py",
"repo_id": "transformers",
"token_count": 7875
} |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/seamless_m4t/test_modeling_seamless_m4t.py/0 | {
"file_path": "transformers/tests/models/seamless_m4t/test_modeling_seamless_m4t.py",
"repo_id": "transformers",
"token_count": 21270
} |
# 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/speecht5/test_processor_speecht5.py/0 | {
"file_path": "transformers/tests/models/speecht5/test_processor_speecht5.py",
"repo_id": "transformers",
"token_count": 2860
} |
# 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_image_processing_superpoint.py/0 | {
"file_path": "transformers/tests/models/superpoint/test_image_processing_superpoint.py",
"repo_id": "transformers",
"token_count": 2967
} |
# coding=utf-8
# Copyright 2021 Google T5 Authors and HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | transformers/tests/models/t5/test_modeling_flax_t5.py/0 | {
"file_path": "transformers/tests/models/t5/test_modeling_flax_t5.py",
"repo_id": "transformers",
"token_count": 23924
} |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/timesformer/test_modeling_timesformer.py/0 | {
"file_path": "transformers/tests/models/timesformer/test_modeling_timesformer.py",
"repo_id": "transformers",
"token_count": 5966
} |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/videomae/test_modeling_videomae.py/0 | {
"file_path": "transformers/tests/models/videomae/test_modeling_videomae.py",
"repo_id": "transformers",
"token_count": 7603
} |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/vitmatte/test_modeling_vitmatte.py/0 | {
"file_path": "transformers/tests/models/vitmatte/test_modeling_vitmatte.py",
"repo_id": "transformers",
"token_count": 4468
} |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/wav2vec2/test_modeling_wav2vec2.py/0 | {
"file_path": "transformers/tests/models/wav2vec2/test_modeling_wav2vec2.py",
"repo_id": "transformers",
"token_count": 39586
} |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/whisper/test_modeling_flax_whisper.py/0 | {
"file_path": "transformers/tests/models/whisper/test_modeling_flax_whisper.py",
"repo_id": "transformers",
"token_count": 18408
} |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/pipelines/test_pipelines_common.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_common.py",
"repo_id": "transformers",
"token_count": 17527
} |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/pipelines/test_pipelines_text2text_generation.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_text2text_generation.py",
"repo_id": "transformers",
"token_count": 2311
} |
# 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": 17320
} |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/test_image_processing_common.py/0 | {
"file_path": "transformers/tests/test_image_processing_common.py",
"repo_id": "transformers",
"token_count": 12839
} |
# 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": 7470
} |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/utils/test_cache_utils.py/0 | {
"file_path": "transformers/tests/utils/test_cache_utils.py",
"repo_id": "transformers",
"token_count": 12990
} |
# 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_logging.py/0 | {
"file_path": "transformers/tests/utils/test_logging.py",
"repo_id": "transformers",
"token_count": 2007
} |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/check_build.py/0 | {
"file_path": "transformers/utils/check_build.py",
"repo_id": "transformers",
"token_count": 677
} |
import ast
from collections import defaultdict
# Function to perform topological sorting
def topological_sort(dependencies: dict):
# Nodes are the name of the models to convert (we only add those to the graph)
nodes = {node.rsplit("modular_", 1)[1].replace(".py", "") for node in dependencies.keys()}
# Thi... | transformers/utils/create_dependency_mapping.py/0 | {
"file_path": "transformers/utils/create_dependency_mapping.py",
"repo_id": "transformers",
"token_count": 870
} |
# 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/utils/notification_service_doc_tests.py/0 | {
"file_path": "transformers/utils/notification_service_doc_tests.py",
"repo_id": "transformers",
"token_count": 6488
} |
from transformers import PretrainedConfig
class CustomConfig(PretrainedConfig):
model_type = "custom"
def __init__(self, attribute=1, **kwargs):
self.attribute = attribute
super().__init__(**kwargs)
class NoSuperInitConfig(PretrainedConfig):
model_type = "custom"
def __init__(self,... | transformers/utils/test_module/custom_configuration.py/0 | {
"file_path": "transformers/utils/test_module/custom_configuration.py",
"repo_id": "transformers",
"token_count": 136
} |
# Using LLaMA models with TRL
We've begun rolling out examples to use Meta's LLaMA models in `trl` (see [Meta's LLaMA release](https://ai.facebook.com/blog/large-language-model-llama-meta-ai/) for the original LLaMA model).
## Efficient training strategies
Even training the smallest LLaMA model requires an enormous ... | trl/docs/source/using_llama_models.md/0 | {
"file_path": "trl/docs/source/using_llama_models.md",
"repo_id": "trl",
"token_count": 2985
} |
# 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... | trl/examples/datasets/tldr.py/0 | {
"file_path": "trl/examples/datasets/tldr.py",
"repo_id": "trl",
"token_count": 1501
} |
# 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... | trl/examples/scripts/evals/judge_tldr.py/0 | {
"file_path": "trl/examples/scripts/evals/judge_tldr.py",
"repo_id": "trl",
"token_count": 1497
} |
[tool.ruff]
target-version = "py37"
line-length = 119
[tool.ruff.lint]
ignore = [
"B028", # warning without explicit stacklevel
"C408", # dict() calls (stylistic)
"C901", # function complexity
"E501",
]
extend-select = ["E", "F", "I", "W", "UP", "B", "T", "C"]
[tool.ruff.lint.per-file-ignores]
# Allow... | trl/pyproject.toml/0 | {
"file_path": "trl/pyproject.toml",
"repo_id": "trl",
"token_count": 227
} |
# 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... | trl/tests/test_best_of_n_sampler.py/0 | {
"file_path": "trl/tests/test_best_of_n_sampler.py",
"repo_id": "trl",
"token_count": 1678
} |
# 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... | trl/tests/test_judges.py/0 | {
"file_path": "trl/tests/test_judges.py",
"repo_id": "trl",
"token_count": 1297
} |
# 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... | trl/tests/test_xpo_trainer.py/0 | {
"file_path": "trl/tests/test_xpo_trainer.py",
"repo_id": "trl",
"token_count": 3756
} |
# 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... | trl/trl/models/modeling_base.py/0 | {
"file_path": "trl/trl/models/modeling_base.py",
"repo_id": "trl",
"token_count": 13951
} |
# 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... | trl/trl/trainer/alignprop_trainer.py/0 | {
"file_path": "trl/trl/trainer/alignprop_trainer.py",
"repo_id": "trl",
"token_count": 8255
} |
# 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... | trl/trl/trainer/kto_config.py/0 | {
"file_path": "trl/trl/trainer/kto_config.py",
"repo_id": "trl",
"token_count": 3485
} |
# 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... | trl/trl/trainer/rloo_trainer.py/0 | {
"file_path": "trl/trl/trainer/rloo_trainer.py",
"repo_id": "trl",
"token_count": 16823
} |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/benchmarks/fp8/ms_amp/distrib_deepspeed.py/0 | {
"file_path": "accelerate/benchmarks/fp8/ms_amp/distrib_deepspeed.py",
"repo_id": "accelerate",
"token_count": 2583
} |
- sections:
- local: index
title: 🤗 Accelerate
- local: basic_tutorials/install
title: Installation
- local: quicktour
title: Quicktour
title: Getting started
- sections:
- local: basic_tutorials/overview
title: Overview
- local: basic_tutorials/migration
title: Add Accelerate to your c... | accelerate/docs/source/_toctree.yml/0 | {
"file_path": "accelerate/docs/source/_toctree.yml",
"repo_id": "accelerate",
"token_count": 1411
} |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/concept_guides/training_tpu.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/training_tpu.md",
"repo_id": "accelerate",
"token_count": 2196
} |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/usage_guides/low_precision_training.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/low_precision_training.md",
"repo_id": "accelerate",
"token_count": 1933
} |
# Since we are doing FSDP (even though it's multi-GPU), we need to specify the distributed type as FSDP
distributed_type: FSDP
# Can be one of "no", "fp16", or "bf16" (see `transformer_engine.yaml` for `fp8`, but it works for FSDP as well)
mixed_precision: 'bf16'
# Specify the number of GPUs to use
num_processes: 2
# T... | accelerate/examples/config_yaml_templates/fsdp.yaml/0 | {
"file_path": "accelerate/examples/config_yaml_templates/fsdp.yaml",
"repo_id": "accelerate",
"token_count": 275
} |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/examples/inference/distributed/stable_diffusion.py/0 | {
"file_path": "accelerate/examples/inference/distributed/stable_diffusion.py",
"repo_id": "accelerate",
"token_count": 363
} |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/manim_animations/big_model_inference/stage_2.py/0 | {
"file_path": "accelerate/manim_animations/big_model_inference/stage_2.py",
"repo_id": "accelerate",
"token_count": 2354
} |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/big_modeling.py/0 | {
"file_path": "accelerate/src/accelerate/big_modeling.py",
"repo_id": "accelerate",
"token_count": 11505
} |
# Copyright 2022 The HuggingFace Team and Brian Chao. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | accelerate/src/accelerate/commands/menu/cursor.py/0 | {
"file_path": "accelerate/src/accelerate/commands/menu/cursor.py",
"repo_id": "accelerate",
"token_count": 763
} |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/optimizer.py/0 | {
"file_path": "accelerate/src/accelerate/optimizer.py",
"repo_id": "accelerate",
"token_count": 3435
} |
#!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | accelerate/src/accelerate/test_utils/scripts/test_distributed_data_loop.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_distributed_data_loop.py",
"repo_id": "accelerate",
"token_count": 5904
} |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/utils/imports.py/0 | {
"file_path": "accelerate/src/accelerate/utils/imports.py",
"repo_id": "accelerate",
"token_count": 5400
} |
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
... | accelerate/tests/deepspeed/ds_config_zero3.json/0 | {
"file_path": "accelerate/tests/deepspeed/ds_config_zero3.json",
"repo_id": "accelerate",
"token_count": 825
} |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle_core::{
quantized::{self, GgmlDType, QMatMul},
Device, Module, Tensor,
};
use criterion::{black_box, criterion_group, Criterion, Throughput};
use std::time::Instant;
fn run(matmul: &QMatMul, x: &Tensor) {
matmul.forward(x).unwrap();
}
fn... | candle/candle-core/benches/benchmarks/qmatmul.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/qmatmul.rs",
"repo_id": "candle",
"token_count": 1085
} |
pub trait VecOps: num_traits::NumAssign + Copy {
fn min(self, rhs: Self) -> Self;
fn max(self, rhs: Self) -> Self;
/// Dot-product of two vectors.
///
/// # Safety
///
/// The length of `lhs` and `rhs` have to be at least `len`. `res` has to point to a valid
/// element.
#[inline(al... | candle/candle-core/src/cpu/kernels.rs/0 | {
"file_path": "candle/candle-core/src/cpu/kernels.rs",
"repo_id": "candle",
"token_count": 2328
} |
#![allow(dead_code)]
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{CpuStorage, DType, Error, Layout, Result, Shape};
#[derive(Debug, Clone)]
pub struct MetalDevice;
#[derive(Debug)]
pub struct MetalStorage;
#[derive(thiserror::Error, Debug)]
pub enum MetalError {
#[error("{0}")]
Message(... | candle/candle-core/src/dummy_metal_backend.rs/0 | {
"file_path": "candle/candle-core/src/dummy_metal_backend.rs",
"repo_id": "candle",
"token_count": 3042
} |
//! Support for the [GGUF file format](https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md).
//!
use super::{GgmlDType, QTensor};
use crate::{Context, Device, Result};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use std::collections::HashMap;
pub const DEFAULT_ALIGNMENT: u64 = 32;
#[derive(De... | candle/candle-core/src/quantized/gguf_file.rs/0 | {
"file_path": "candle/candle-core/src/quantized/gguf_file.rs",
"repo_id": "candle",
"token_count": 9550
} |
use crate::{Result, Tensor};
#[macro_export]
macro_rules! test_device {
// TODO: Switch to generating the two last arguments automatically once concat_idents is
// stable. https://github.com/rust-lang/rust/issues/29599
($fn_name: ident, $test_cpu: ident, $test_cuda: ident, $test_metal: ident) => {
... | candle/candle-core/src/test_utils.rs/0 | {
"file_path": "candle/candle-core/src/test_utils.rs",
"repo_id": "candle",
"token_count": 923
} |
use candle_core::{DType, Result, Tensor};
struct TmpFile(std::path::PathBuf);
impl TmpFile {
fn create(base: &str) -> TmpFile {
let filename = std::env::temp_dir().join(format!(
"candle-{}-{}-{:?}",
base,
std::process::id(),
std::thread::current().id(),
... | candle/candle-core/tests/serialization_tests.rs/0 | {
"file_path": "candle/candle-core/tests/serialization_tests.rs",
"repo_id": "candle",
"token_count": 981
} |
[package]
name = "candle-examples"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
readme = "README.md"
[dependencies]
accelerate-src = { workspace = true, optional = true }
candle ... | candle/candle-examples/Cargo.toml/0 | {
"file_path": "candle/candle-examples/Cargo.toml",
"repo_id": "candle",
"token_count": 1292
} |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::Parser;
use candle::{DType, Device, Tensor};
use candle_nn::{ops::softmax, VarBuilder};
use candle_transformers::models::clip;
use tokenizers::Tokenizer;
#[derive(Parser... | candle/candle-examples/examples/clip/main.rs/0 | {
"file_path": "candle/candle-examples/examples/clip/main.rs",
"repo_id": "candle",
"token_count": 2483
} |
//! Depth Anything V2
//! https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use clap::Parser;
use std::{ffi::OsString, path::PathBuf, sync::Arc};
use candle::DType::{F32, U8};
use candle::{DTy... | candle/candle-examples/examples/depth_anything_v2/main.rs/0 | {
"file_path": "candle/candle-examples/examples/depth_anything_v2/main.rs",
"repo_id": "candle",
"token_count": 2544
} |
# candle-helium: 2b LLM with CC-BY licensed weights
Helium-1 is a lightweight model with around 2B parameters, the preview version
currently supports 6 languages, showing strong capabilities in those languages
compared to existing open weights models.
- [Blog Post](https://kyutai.org/2025/01/13/helium.html) announcin... | candle/candle-examples/examples/helium/README.md/0 | {
"file_path": "candle/candle-examples/examples/helium/README.md",
"repo_id": "candle",
"token_count": 174
} |
# candle-mamba-minimal: minimal implementation of Mamba
This is based on [mamba-minimal](https://github.com/johnma2006/mamba-minimal).
Compared to the mamba example, this version can handle training but is much
slower.
## Running the example
```bash
$ cargo run --example mamba-minimal --release -- --prompt "Mamba i... | candle/candle-examples/examples/mamba-minimal/README.md/0 | {
"file_path": "candle/candle-examples/examples/mamba-minimal/README.md",
"repo_id": "candle",
"token_count": 206
} |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::Parser;
use candle_transformers::models::mixtral::{Config, Model};
use candle::{DType, Device, Tensor};
use candle_examples::token_output_stream::TokenOutputStr... | candle/candle-examples/examples/mixtral/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mixtral/main.rs",
"repo_id": "candle",
"token_count": 3396
} |
# candle-olmo: Open Language Models designed to enable the science of language models
OLMo is a series of Open Language Models designed to enable the science of language models.
- **Project Page:** https://allenai.org/olmo
- **Paper:** [Link](https://arxiv.org/abs/2402.00838)
- **Technical blog post:** https://blog.a... | candle/candle-examples/examples/olmo/README.md/0 | {
"file_path": "candle/candle-examples/examples/olmo/README.md",
"repo_id": "candle",
"token_count": 504
} |
use super::gym_env::{GymEnv, Step};
use candle::{DType, Device, Error, Module, Result, Tensor};
use candle_nn::{
linear, ops::log_softmax, ops::softmax, sequential::seq, Activation, AdamW, Optimizer,
ParamsAdamW, VarBuilder, VarMap,
};
use rand::{distributions::Distribution, rngs::ThreadRng, Rng};
fn new_model... | candle/candle-examples/examples/reinforcement-learning/policy_gradient.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/policy_gradient.rs",
"repo_id": "candle",
"token_count": 2332
} |
# candle-vit
Vision Transformer (ViT) model implementation following the lines of
[vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224)
This uses a classification head trained on the ImageNet dataset and returns the
probabilities for the top-5 classes.
## Running an example
```
$ cargo run --exa... | candle/candle-examples/examples/vit/README.md/0 | {
"file_path": "candle/candle-examples/examples/vit/README.md",
"repo_id": "candle",
"token_count": 219
} |
use candle::{Device, Result, Tensor};
pub const IMAGENET_MEAN: [f32; 3] = [0.485f32, 0.456, 0.406];
pub const IMAGENET_STD: [f32; 3] = [0.229f32, 0.224, 0.225];
/// Loads an image from disk using the image crate at the requested resolution,
/// using the given std and mean parameters.
/// This returns a tensor with s... | candle/candle-examples/src/imagenet.rs/0 | {
"file_path": "candle/candle-examples/src/imagenet.rs",
"repo_id": "candle",
"token_count": 13048
} |
// This header is not specific to our application and you'll probably want
// something like this for any extension you're building. This includes the
// infrastructure needed to serialize descriptors that are used with the
// "opaque" parameter of the GPU custom call. In our example we'll use this
// parameter to pass... | candle/candle-flash-attn/kernels/kernel_helpers.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/kernel_helpers.h",
"repo_id": "candle",
"token_count": 600
} |
#include "cuda_utils.cuh"
#include<stdint.h>
#define AFFINE_OP(TYPENAME, FN_NAME) \
extern "C" __global__ void FN_NAME( \
const size_t numel, \
const size_t num_dims, \
const size_t *info, \
const TYPENAME *inp, \
TYPENAME *out, \
const TYPENAME mul, \
const TYPENAME add \
) { \
cons... | candle/candle-kernels/src/affine.cu/0 | {
"file_path": "candle/candle-kernels/src/affine.cu",
"repo_id": "candle",
"token_count": 659
} |
// Imported from https://github.com/ggerganov/llama.cpp/blob/master/ggml-metal.metal
#include <metal_stdlib>
using namespace metal;
#define SWAP(x, y) { auto tmp = (x); (x) = (y); (y) = tmp; }
#define SORT_ASC 1
#define SORT_DESC 0
template<int order, typename T>
METAL_FUNC void argsort(
device const T ... | candle/candle-metal-kernels/src/sort.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/sort.metal",
"repo_id": "candle",
"token_count": 1748
} |
//! Loss Calculations
//!
use candle::{Result, Tensor};
/// The negative log likelihood loss.
///
/// Arguments
///
/// * [inp]: The input tensor of dimensions `N, C` where `N` is the batch size and `C` the number
/// of categories. This is expected to contain log probabilities.
/// * [target]: The ground tru... | candle/candle-nn/src/loss.rs/0 | {
"file_path": "candle/candle-nn/src/loss.rs",
"repo_id": "candle",
"token_count": 1049
} |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{test_utils::to_vec2_round, DType, Device, Result, Tensor};
use candle_nn::RNN;
/* The following test can be verified against PyTorch using the following snippet.
import torch
from torch import... | candle/candle-nn/tests/rnn.rs/0 | {
"file_path": "candle/candle-nn/tests/rnn.rs",
"repo_id": "candle",
"token_count": 2010
} |
import logging
try:
from .candle import *
except ImportError as e:
# If we are in development mode, or we did not bundle the DLLs, we try to locate them here
# PyO3 wont give us any information about what DLLs are missing, so we can only try to load
# the DLLs and re-import the module
logging.warni... | candle/candle-pyo3/py_src/candle/__init__.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/__init__.py",
"repo_id": "candle",
"token_count": 919
} |
from typing import TypeVar, Union, Sequence
_T = TypeVar("_T")
_ArrayLike = Union[
_T,
Sequence[_T],
Sequence[Sequence[_T]],
Sequence[Sequence[Sequence[_T]]],
Sequence[Sequence[Sequence[Sequence[_T]]]],
]
CPU: str = "cpu"
CUDA: str = "cuda"
Device = TypeVar("Device", CPU, CUDA)
Scalar = Union[i... | candle/candle-pyo3/py_src/candle/typing/__init__.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/typing/__init__.py",
"repo_id": "candle",
"token_count": 166
} |
from candle import Tensor
from candle import rand
import pytest
def test_absolute_shapes_are_valid():
a = rand((10, 20))
assert a.shape == (10, 20)
b = rand(10, 20)
assert b.shape == (10, 20)
pytest.raises(OverflowError, lambda: rand((10, 20, -1)))
pytest.raises(OverflowError, lambda: rand(-1... | candle/candle-pyo3/tests/native/test_shape.py/0 | {
"file_path": "candle/candle-pyo3/tests/native/test_shape.py",
"repo_id": "candle",
"token_count": 385
} |
//! Chinese contrastive Language-Image Pre-Training
//!
//! Chinese contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
//! pairs of images with related texts.
//!
//! - 💻 [Chinese-CLIP](https://github.com/OFA-Sys/Chinese-CLIP)
//! - 💻 [GH](https://github.com/huggingface/transformers/blob/5af... | candle/candle-transformers/src/models/chinese_clip/vision_model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/chinese_clip/vision_model.rs",
"repo_id": "candle",
"token_count": 6262
} |
//! EnCodec neural audio codec based on the Encodec implementation.
//!
//! See ["High Fidelity Neural Audio Compression"](https://arxiv.org/abs/2210.13438)
//!
//! Based on implementation from [huggingface/transformers](https://github.com/huggingface/transformers/blob/main/src/transformers/models/encodec/modeling_enco... | candle/candle-transformers/src/models/encodec.rs/0 | {
"file_path": "candle/candle-transformers/src/models/encodec.rs",
"repo_id": "candle",
"token_count": 12744
} |
//! MixFormer (Microsoft's Phi Architecture)
//!
//! See "Textbooks Are All You Need II: phi-1.5 technical report", Lin et al. 2023
//! - [Arxiv](https://arxiv.org/abs/2309.05463)
//! - [Github](https://huggingface.co/microsoft/phi-1_5)
//!
use crate::models::with_tracing::{linear, Embedding as E, Linear};
/// MixForm... | candle/candle-transformers/src/models/mixformer.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mixformer.rs",
"repo_id": "candle",
"token_count": 8060
} |
use super::embedding::Model as EmbeddingModel;
use crate::models::{
mistral::Config,
with_tracing::{layer_norm, linear, linear_no_bias, LayerNorm, Linear},
};
use candle::{DType, Device, Result, Tensor, D};
use candle_nn::{ops::softmax_last_dim, LayerNormConfig, Module, VarBuilder};
// Geglu and feedforward fr... | candle/candle-transformers/src/models/nvembed_v2/model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/nvembed_v2/model.rs",
"repo_id": "candle",
"token_count": 3730
} |
//! Quantized MetaVoice model implementation.
//!
//! MetaVoice is a conditional text-to-speech model based on a transformer architecture.
//! This implementation provides quantization for reduced memory and compute.
//!
//! Key characteristics:
//! - Transformer-based autoregressive decoder
//! - Speaker conditioning
... | candle/candle-transformers/src/models/quantized_metavoice.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_metavoice.rs",
"repo_id": "candle",
"token_count": 5192
} |
//! RepVGG inference implementation
//!
//! Key characteristics:
//! - Efficient inference architecture through structural reparameterization
//! - Single 3x3 conv layer after fusing 3x3 branch, 1x1 branch and identity branch
//! - Different configurations including a0-a2, b0-b3 and variants with group convolutions
//!... | candle/candle-transformers/src/models/repvgg.rs/0 | {
"file_path": "candle/candle-transformers/src/models/repvgg.rs",
"repo_id": "candle",
"token_count": 4487
} |
use super::schedulers::{betas_for_alpha_bar, BetaSchedule, PredictionType};
use candle::{Result, Tensor};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DDPMVarianceType {
FixedSmall,
FixedSmallLog,
FixedLarge,
FixedLargeLog,
Learned,
}
impl Default for DDPMVarianceType {
fn default() -> Self... | candle/candle-transformers/src/models/stable_diffusion/ddpm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/ddpm.rs",
"repo_id": "candle",
"token_count": 3666
} |
//! VGG-16 model implementation.
//!
//! VGG-16 is a convolutional neural network architecture. It consists of 13
//! convolutional layers followed by 3 fully connected layers.
//!
//! Key characteristics:
//! - Conv layers with 3x3 filters
//! - Max pooling after every 2-3 conv layers
//! - Three fully connected layer... | candle/candle-transformers/src/models/vgg.rs/0 | {
"file_path": "candle/candle-transformers/src/models/vgg.rs",
"repo_id": "candle",
"token_count": 4390
} |
//! Bounding Boxes and Intersection
//!
//! This module provides functionality for handling bounding boxes and their manipulation,
//! particularly in the context of object detection. It includes tools for calculating
//! intersection over union (IoU) and non-maximum suppression (NMS).
/// A bounding box around an obj... | candle/candle-transformers/src/object_detection.rs/0 | {
"file_path": "candle/candle-transformers/src/object_detection.rs",
"repo_id": "candle",
"token_count": 1950
} |
use candle::{Device, Tensor};
use candle_transformers::generation::LogitsProcessor;
use candle_wasm_example_llama2::worker::{Model as M, ModelData};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct Model {
inner: M,
logits_processor: LogitsProcessor,
tokens: Vec<u32>,
repeat_penalty: f32,
}
im... | candle/candle-wasm-examples/llama2-c/src/bin/m.rs/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/src/bin/m.rs",
"repo_id": "candle",
"token_count": 1807
} |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle Phi 1.5 / Phi 2.0 Rust/WASM</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
... | candle/candle-wasm-examples/phi/index.html/0 | {
"file_path": "candle/candle-wasm-examples/phi/index.html",
"repo_id": "candle",
"token_count": 9818
} |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle T5</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
@import ur... | candle/candle-wasm-examples/t5/index.html/0 | {
"file_path": "candle/candle-wasm-examples/t5/index.html",
"repo_id": "candle",
"token_count": 4724
} |
pub const LANGUAGES: [(&str, &str); 99] = [
("en", "english"),
("zh", "chinese"),
("de", "german"),
("es", "spanish"),
("ru", "russian"),
("ko", "korean"),
("fr", "french"),
("ja", "japanese"),
("pt", "portuguese"),
("tr", "turkish"),
("pl", "polish"),
("ca", "catalan"),
... | candle/candle-wasm-examples/whisper/src/languages.rs/0 | {
"file_path": "candle/candle-wasm-examples/whisper/src/languages.rs",
"repo_id": "candle",
"token_count": 1175
} |
use crate::model::{report_detect, report_pose, Bbox, Multiples, YoloV8, YoloV8Pose};
use candle::{DType, Device, Result, Tensor};
use candle_nn::{Module, VarBuilder};
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use yew_agent::{HandlerId, Public, WorkerLink};
#[wasm_bindgen]
extern "C" {
// U... | candle/candle-wasm-examples/yolo/src/worker.rs/0 | {
"file_path": "candle/candle-wasm-examples/yolo/src/worker.rs",
"repo_id": "candle",
"token_count": 4075
} |
- local: index
title: 🤗 Chat UI
- title: Installation
sections:
- local: installation/local
title: Local
- local: installation/spaces
title: Spaces
- local: installation/docker
title: Docker
- local: installation/helm
title: Helm
- title: Configuration
sections:
- loca... | chat-ui/docs/source/_toctree.yml/0 | {
"file_path": "chat-ui/docs/source/_toctree.yml",
"repo_id": "chat-ui",
"token_count": 879
} |
# Tools
Tool calling instructs the model to generate an output matching a user-defined schema, which may be parsed for invoking external tools. The model simply chooses the tools and their parameters. Currently, only `TGI` and `Cohere` with `Command R+` are supported.
<div class="flex justify-center">
<img class="blo... | chat-ui/docs/source/configuration/models/tools.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/tools.md",
"repo_id": "chat-ui",
"token_count": 948
} |
import readline from "readline";
import minimist from "minimist";
// @ts-expect-error: vite-node makes the var available but the typescript compiler doesn't see them
import { env } from "$env/dynamic/private";
import { faker } from "@faker-js/faker";
import { ObjectId } from "mongodb";
// @ts-expect-error: vite-node... | chat-ui/scripts/populate.ts/0 | {
"file_path": "chat-ui/scripts/populate.ts",
"repo_id": "chat-ui",
"token_count": 4497
} |
<script lang="ts">
import { base } from "$app/paths";
import { page } from "$app/state";
import { env as envPublic } from "$env/dynamic/public";
import LogoHuggingFaceBorderless from "$lib/components/icons/LogoHuggingFaceBorderless.svelte";
import Modal from "$lib/components/Modal.svelte";
import { useSettingsSto... | chat-ui/src/lib/components/DisclaimerModal.svelte/0 | {
"file_path": "chat-ui/src/lib/components/DisclaimerModal.svelte",
"repo_id": "chat-ui",
"token_count": 1086
} |
<script lang="ts">
import { fade } from "svelte/transition";
import { onDestroy, untrack } from "svelte";
import IconChevron from "./icons/IconChevron.svelte";
let visible = $state(false);
interface Props {
scrollNode: HTMLElement;
class?: string;
}
let { scrollNode, class: className = "" }: Props = $props... | chat-ui/src/lib/components/ScrollToPreviousBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ScrollToPreviousBtn.svelte",
"repo_id": "chat-ui",
"token_count": 771
} |
<script lang="ts">
import { run } from "svelte/legacy";
import type { Message } from "$lib/types/Message";
import { createEventDispatcher, tick } from "svelte";
import { page } from "$app/state";
import CopyToClipBoardBtn from "../CopyToClipBoardBtn.svelte";
import IconLoading from "../icons/IconLoading.svelte"... | chat-ui/src/lib/components/chat/ChatMessage.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatMessage.svelte",
"repo_id": "chat-ui",
"token_count": 5655
} |
<script lang="ts">
interface Props {
classNames?: string;
}
let { classNames = "" }: Props = $props();
</script>
<svg
class={classNames}
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
focusable="false"
role="img"
width="1em"
height="1em"
fill="currentColor"
preserveAspectRatio="xMidYMid meet"
vi... | chat-ui/src/lib/components/icons/IconPaperclip.svelte/0 | {
"file_path": "chat-ui/src/lib/components/icons/IconPaperclip.svelte",
"repo_id": "chat-ui",
"token_count": 381
} |
import type { Migration } from ".";
import { collections } from "$lib/server/database";
import { ObjectId, type WithId } from "mongodb";
import type { Conversation } from "$lib/types/Conversation";
import type { WebSearchSource } from "$lib/types/WebSearch";
import {
MessageUpdateStatus,
MessageUpdateType,
MessageWe... | chat-ui/src/lib/migrations/routines/04-update-message-updates.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/04-update-message-updates.ts",
"repo_id": "chat-ui",
"token_count": 1830
} |
import { env } from "$env/dynamic/private";
import { z } from "zod";
import { sum } from "$lib/utils/sum";
import {
embeddingEndpoints,
embeddingEndpointSchema,
type EmbeddingEndpoint,
} from "$lib/server/embeddingEndpoints/embeddingEndpoints";
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingE... | chat-ui/src/lib/server/embeddingModels.ts/0 | {
"file_path": "chat-ui/src/lib/server/embeddingModels.ts",
"repo_id": "chat-ui",
"token_count": 1115
} |
import { z } from "zod";
import { openAICompletionToTextGenerationStream } from "./openAICompletionToTextGenerationStream";
import { openAIChatToTextGenerationStream } from "./openAIChatToTextGenerationStream";
import type { CompletionCreateParamsStreaming } from "openai/resources/completions";
import type {
ChatCompl... | chat-ui/src/lib/server/endpoints/openai/endpointOai.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/openai/endpointOai.ts",
"repo_id": "chat-ui",
"token_count": 3562
} |
import type { ConfigTool } from "$lib/types/Tool";
import { ObjectId } from "mongodb";
import vm from "node:vm";
const calculator: ConfigTool = {
_id: new ObjectId("00000000000000000000000C"),
type: "config",
description: "Calculate the result of a mathematical expression",
color: "blue",
icon: "code",
displayNa... | chat-ui/src/lib/server/tools/calculator.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/calculator.ts",
"repo_id": "chat-ui",
"token_count": 360
} |
import type { SerializedHTMLElement } from "../../scrape/types";
import { MarkdownElementType, type MarkdownElement } from "../types";
// --- Markdown Elements ---
/** Converts markdown element to a string with formatting */
export function stringifyMarkdownElement(elem: MarkdownElement): string {
const content = el... | chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts",
"repo_id": "chat-ui",
"token_count": 1149
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.