text stringlengths 7 328k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 471 |
|---|---|---|---|
# coding=utf-8
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/git/test_modeling_git.py/0 | {
"file_path": "transformers/tests/models/git/test_modeling_git.py",
"repo_id": "transformers",
"token_count": 9502
} | 400 |
# coding=utf-8
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/imagegpt/test_modeling_imagegpt.py/0 | {
"file_path": "transformers/tests/models/imagegpt/test_modeling_imagegpt.py",
"repo_id": "transformers",
"token_count": 10579
} | 401 |
# coding=utf-8
# Copyright Iz Beltagy, Matthew E. Peters, Arman Cohan 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.ap... | transformers/tests/models/led/test_modeling_tf_led.py/0 | {
"file_path": "transformers/tests/models/led/test_modeling_tf_led.py",
"repo_id": "transformers",
"token_count": 6455
} | 402 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/megatron_gpt2/test_modeling_megatron_gpt2.py/0 | {
"file_path": "transformers/tests/models/megatron_gpt2/test_modeling_megatron_gpt2.py",
"repo_id": "transformers",
"token_count": 1284
} | 403 |
# coding=utf-8
# Copyright 2021, The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | transformers/tests/models/mvp/test_modeling_mvp.py/0 | {
"file_path": "transformers/tests/models/mvp/test_modeling_mvp.py",
"repo_id": "transformers",
"token_count": 15208
} | 404 |
# coding=utf-8
# Copyright 2022 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/oneformer/test_image_processing_oneformer.py/0 | {
"file_path": "transformers/tests/models/oneformer/test_image_processing_oneformer.py",
"repo_id": "transformers",
"token_count": 6432
} | 405 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/owlvit/test_modeling_owlvit.py/0 | {
"file_path": "transformers/tests/models/owlvit/test_modeling_owlvit.py",
"repo_id": "transformers",
"token_count": 15261
} | 406 |
# coding=utf-8
# Copyright 2024 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.org/... | transformers/tests/models/qwen2/test_modeling_qwen2.py/0 | {
"file_path": "transformers/tests/models/qwen2/test_modeling_qwen2.py",
"repo_id": "transformers",
"token_count": 11644
} | 407 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/roberta/test_tokenization_roberta.py/0 | {
"file_path": "transformers/tests/models/roberta/test_tokenization_roberta.py",
"repo_id": "transformers",
"token_count": 7034
} | 408 |
# 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/sam/test_modeling_sam.py/0 | {
"file_path": "transformers/tests/models/sam/test_modeling_sam.py",
"repo_id": "transformers",
"token_count": 12981
} | 409 |
# 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/seggpt/test_modeling_seggpt.py/0 | {
"file_path": "transformers/tests/models/seggpt/test_modeling_seggpt.py",
"repo_id": "transformers",
"token_count": 7109
} | 410 |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/models/speech_to_text/test_processor_speech_to_text.py/0 | {
"file_path": "transformers/tests/models/speech_to_text/test_processor_speech_to_text.py",
"repo_id": "transformers",
"token_count": 2448
} | 411 |
# 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/stablelm/test_modeling_stablelm.py/0 | {
"file_path": "transformers/tests/models/stablelm/test_modeling_stablelm.py",
"repo_id": "transformers",
"token_count": 11810
} | 412 |
# 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": 5945
} | 413 |
# coding=utf-8
# Copyright 2021 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/vilt/test_image_processing_vilt.py/0 | {
"file_path": "transformers/tests/models/vilt/test_image_processing_vilt.py",
"repo_id": "transformers",
"token_count": 2455
} | 414 |
# 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/x_clip/test_modeling_x_clip.py/0 | {
"file_path": "transformers/tests/models/x_clip/test_modeling_x_clip.py",
"repo_id": "transformers",
"token_count": 12549
} | 415 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/xlm_roberta/test_modeling_xlm_roberta.py/0 | {
"file_path": "transformers/tests/models/xlm_roberta/test_modeling_xlm_roberta.py",
"repo_id": "transformers",
"token_count": 1283
} | 416 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/optimization/test_optimization.py/0 | {
"file_path": "transformers/tests/optimization/test_optimization.py",
"repo_id": "transformers",
"token_count": 3392
} | 417 |
# 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": 5157
} | 418 |
# 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": 5307
} | 419 |
# 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_check_dummies.py/0 | {
"file_path": "transformers/tests/repo_utils/test_check_dummies.py",
"repo_id": "transformers",
"token_count": 1800
} | 420 |
# 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_cache_utils.py/0 | {
"file_path": "transformers/tests/test_cache_utils.py",
"repo_id": "transformers",
"token_count": 9511
} | 421 |
# coding=utf-8
# Copyright 2021 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/test_sequence_feature_extraction_common.py/0 | {
"file_path": "transformers/tests/test_sequence_feature_extraction_common.py",
"repo_id": "transformers",
"token_count": 7929
} | 422 |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/tools/test_text_summarization.py/0 | {
"file_path": "transformers/tests/tools/test_text_summarization.py",
"repo_id": "transformers",
"token_count": 1135
} | 423 |
# 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_audio_utils.py/0 | {
"file_path": "transformers/tests/utils/test_audio_utils.py",
"repo_id": "transformers",
"token_count": 18583
} | 424 |
# 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_offline.py/0 | {
"file_path": "transformers/tests/utils/test_offline.py",
"repo_id": "transformers",
"token_count": 2916
} | 425 |
import argparse
import json
import subprocess
def get_runner_status(target_runners, token):
offline_runners = []
cmd = (
f'curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {token}"'
" https://api.github.com/repos/huggingface/transformers/actions/runners"
)
outpu... | transformers/utils/check_self_hosted_runner.py/0 | {
"file_path": "transformers/utils/check_self_hosted_runner.py",
"repo_id": "transformers",
"token_count": 611
} | 426 |
# 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": 6457
} | 427 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/tests_fetcher.py/0 | {
"file_path": "transformers/utils/tests_fetcher.py",
"repo_id": "transformers",
"token_count": 22768
} | 428 |
import argparse
import math
import os
import shlex
import subprocess
import uuid
from distutils.util import strtobool
import requests
def parse_args():
# fmt: off
parser = argparse.ArgumentParser()
parser.add_argument("--command", type=str, default="",
help="the command to run")
parser.add_ar... | trl/benchmark/benchmark.py/0 | {
"file_path": "trl/benchmark/benchmark.py",
"repo_id": "trl",
"token_count": 2824
} | 429 |
# Logging
As reinforcement learning algorithms are historically challenging to debug, it's important to pay careful attention to logging.
By default, the TRL [`PPOTrainer`] saves a lot of relevant information to `wandb` or `tensorboard`.
Upon initialization, pass one of these two options to the [`PPOConfig`]:
```
con... | trl/docs/source/logging.mdx/0 | {
"file_path": "trl/docs/source/logging.mdx",
"repo_id": "trl",
"token_count": 1961
} | 430 |
compute_environment: LOCAL_MACHINE
debug: false
deepspeed_config:
deepspeed_multinode_launcher: standard
gradient_accumulation_steps: 1
zero3_init_flag: false
zero_stage: 1
distributed_type: DEEPSPEED
downcast_bf16: 'no'
machine_rank: 0
main_training_function: main
mixed_precision: 'bf16'
num_machines: 1
num_pr... | trl/examples/accelerate_configs/deepspeed_zero1.yaml/0 | {
"file_path": "trl/examples/accelerate_configs/deepspeed_zero1.yaml",
"repo_id": "trl",
"token_count": 171
} | 431 |
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
import evaluate
import numpy as np
import torch
import torch.nn as nn
from datasets import load_dataset
from peft import LoraConfig, TaskType, get_peft_model
from transformers import (
AutoModelForSequenceClassification,
... | trl/examples/research_projects/stack_llama/scripts/reward_modeling.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/reward_modeling.py",
"repo_id": "trl",
"token_count": 4554
} | 432 |
# Copyright 2023 metric-space, 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 require... | trl/examples/scripts/ddpo.py/0 | {
"file_path": "trl/examples/scripts/ddpo.py",
"repo_id": "trl",
"token_count": 2705
} | 433 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | trl/tests/test_modeling_value_head.py/0 | {
"file_path": "trl/tests/test_modeling_value_head.py",
"repo_id": "trl",
"token_count": 9527
} | 434 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | trl/trl/environment/base_environment.py/0 | {
"file_path": "trl/trl/environment/base_environment.py",
"repo_id": "trl",
"token_count": 7661
} | 435 |
# Copyright 2023 DDPO-pytorch authors (Kevin Black), metric-space, 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/lic... | trl/trl/trainer/ddpo_trainer.py/0 | {
"file_path": "trl/trl/trainer/ddpo_trainer.py",
"repo_id": "trl",
"token_count": 12350
} | 436 |
# Builds GPU docker image of PyTorch specifically
# Uses multi-staged approach to reduce size
# Stage 1
# Use base conda image to reduce time
FROM continuumio/miniconda3:latest AS compile-image
# Specify py version
ENV PYTHON_VERSION=3.9
# Install apt libs
RUN apt-get update && \
apt-get install -y curl git wget &&... | accelerate/docker/accelerate-gpu/Dockerfile/0 | {
"file_path": "accelerate/docker/accelerate-gpu/Dockerfile",
"repo_id": "accelerate",
"token_count": 539
} | 0 |
<!--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/concept_guides/low_precision_training.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/low_precision_training.md",
"repo_id": "accelerate",
"token_count": 1466
} | 1 |
<!--Copyright 2021 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/package_reference/state.md/0 | {
"file_path": "accelerate/docs/source/package_reference/state.md",
"repo_id": "accelerate",
"token_count": 291
} | 2 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/usage_guides/model_size_estimator.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/model_size_estimator.md",
"repo_id": "accelerate",
"token_count": 2030
} | 3 |
# 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/llama.py/0 | {
"file_path": "accelerate/examples/inference/llama.py",
"repo_id": "accelerate",
"token_count": 706
} | 4 |
# 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/accelerator.py/0 | {
"file_path": "accelerate/src/accelerate/accelerator.py",
"repo_id": "accelerate",
"token_count": 63109
} | 5 |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/optimizer.py/0 | {
"file_path": "accelerate/src/accelerate/optimizer.py",
"repo_id": "accelerate",
"token_count": 3247
} | 6 |
#!/usr/bin/env python
# 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
#
# Unles... | accelerate/src/accelerate/test_utils/scripts/test_ops.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_ops.py",
"repo_id": "accelerate",
"token_count": 2347
} | 7 |
# 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/memory.py/0 | {
"file_path": "accelerate/src/accelerate/utils/memory.py",
"repo_id": "accelerate",
"token_count": 2210
} | 8 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/tests/test_big_modeling.py/0 | {
"file_path": "accelerate/tests/test_big_modeling.py",
"repo_id": "accelerate",
"token_count": 19558
} | 9 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/tests/test_modeling_utils.py/0 | {
"file_path": "accelerate/tests/test_modeling_utils.py",
"repo_id": "accelerate",
"token_count": 14814
} | 10 |
# Copyright 2022 The HuggingFace Team, the AllenNLP library authors. 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
#
... | accelerate/utils/stale.py/0 | {
"file_path": "accelerate/utils/stale.py",
"repo_id": "accelerate",
"token_count": 1013
} | 11 |
# Model arguments
model_name_or_path: BramVanroy/gpt2-cpt-dutch
model_revision: main
torch_dtype: bfloat16
# Data training arguments
chat_template: "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|syst... | alignment-handbook/recipes/gpt2-nl/sft/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/gpt2-nl/sft/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 553
} | 12 |
# Model arguments
model_name_or_path: google/gemma-7b
model_revision: main
tokenizer_name_or_path: philschmid/gemma-tokenizer-chatml # Custom tokenizer with <|im_start|> and <|im_end|> tokens
torch_dtype: bfloat16
use_flash_attention_2: true
# Data training arguments
dataset_mixer:
HuggingFaceH4/deita-10k-v0-sft: 1.... | alignment-handbook/recipes/zephyr-7b-gemma/sft/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/zephyr-7b-gemma/sft/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 480
} | 13 |
# 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... | alignment-handbook/tests/test_configs.py/0 | {
"file_path": "alignment-handbook/tests/test_configs.py",
"repo_id": "alignment-handbook",
"token_count": 697
} | 14 |
# Hello world!
We will now create the hello world of the ML world, building a model capable of solving MNIST dataset.
Open `src/main.rs` and fill in this content:
```rust
# extern crate candle_core;
use candle_core::{Device, Result, Tensor};
struct Model {
first: Tensor,
second: Tensor,
}
impl Model {
... | candle/candle-book/src/guide/hello_world.md/0 | {
"file_path": "candle/candle-book/src/guide/hello_world.md",
"repo_id": "candle",
"token_count": 2069
} | 15 |
# candle
Minimalist ML framework for Rust
| candle/candle-core/README.md/0 | {
"file_path": "candle/candle-core/README.md",
"repo_id": "candle",
"token_count": 11
} | 16 |
use super::{Cpu, CpuF16};
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
use half::f16;
pub struct CurrentCpu {}
const STEP: usize = 32;
const EPR: usize = 8;
const ARR: usize = STEP / EPR;
impl Cpu<ARR> for CurrentCpu {
type Unit = __m256;
type... | candle/candle-core/src/cpu/avx.rs/0 | {
"file_path": "candle/candle-core/src/cpu/avx.rs",
"repo_id": "candle",
"token_count": 2094
} | 17 |
//! Types for elements that can be stored and manipulated using tensors.
#![allow(clippy::redundant_closure_call)]
use crate::backend::BackendStorage;
use crate::{CpuStorage, Error, Result};
/// The different types of elements allowed in tensors.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum DType {
... | candle/candle-core/src/dtype.rs/0 | {
"file_path": "candle/candle-core/src/dtype.rs",
"repo_id": "candle",
"token_count": 2984
} | 18 |
#![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
} | 19 |
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
} | 20 |
use candle_core::{DType, Result, Tensor};
#[test]
fn npy() -> Result<()> {
let npy = Tensor::read_npy("tests/test.npy")?;
assert_eq!(
npy.to_dtype(DType::U8)?.to_vec1::<u8>()?,
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
);
Ok(())
}
#[test]
fn npz() -> Result<()> {
let npz = Tensor::read_npz("t... | candle/candle-core/tests/serialization_tests.rs/0 | {
"file_path": "candle/candle-core/tests/serialization_tests.rs",
"repo_id": "candle",
"token_count": 333
} | 21 |
[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": 1092
} | 22 |
#include <stdint.h>
#include "reduction_utils.cuh"
template <typename scalar_t>
__device__ void
rms_norm_kernel(scalar_t *__restrict__ out, // [num_tokens, hidden_size]
const scalar_t *__restrict__ input, // [num_tokens, hidden_size]
const float epsilon, const uint32_t num_token... | candle/candle-examples/examples/custom-ops/kernels/layernorm_kernels.cu/0 | {
"file_path": "candle/candle-examples/examples/custom-ops/kernels/layernorm_kernels.cu",
"repo_id": "candle",
"token_count": 561
} | 23 |
# candle-gemma: 2b and 7b LLMs from Google DeepMind
[Gemma](https://ai.google.dev/gemma/docs) is a collection of lightweight open
models published by Google Deepmind with a 2b and a 7b variant.
In order to use the example below, you have to accept the license on the
[HuggingFace Hub Gemma repo](https://huggingface.co... | candle/candle-examples/examples/gemma/README.md/0 | {
"file_path": "candle/candle-examples/examples/gemma/README.md",
"repo_id": "candle",
"token_count": 351
} | 24 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::{Parser, ValueEnum};
use candle::{DType, Tensor};
use candle_examples::token_output_stream::TokenOutputStream;
use candle_nn::VarBuilder;
use candle_transformers::models::... | candle/candle-examples/examples/marian-mt/main.rs/0 | {
"file_path": "candle/candle-examples/examples/marian-mt/main.rs",
"repo_id": "candle",
"token_count": 2385
} | 25 |
use anyhow::Result;
use candle::{Device, Tensor};
use clap::{Parser, Subcommand};
#[derive(Subcommand, Debug, Clone)]
enum Command {
Print {
#[arg(long)]
file: String,
},
SimpleEval {
#[arg(long)]
file: String,
},
}
#[derive(Parser, Debug)]
#[command(author, version, a... | candle/candle-examples/examples/onnx_basics.rs/0 | {
"file_path": "candle/candle-examples/examples/onnx_basics.rs",
"repo_id": "candle",
"token_count": 2016
} | 26 |
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": 2333
} | 27 |
## VGG Model Implementation
This example demonstrates the implementation of VGG models (VGG13, VGG16, VGG19) using the Candle library.
The VGG models are defined in `candle-transformers/src/models/vgg.rs`. The main function in `candle-examples/examples/vgg/main.rs` loads an image, selects the VGG model based on the p... | candle/candle-examples/examples/vgg/README.md/0 | {
"file_path": "candle/candle-examples/examples/vgg/README.md",
"repo_id": "candle",
"token_count": 200
} | 28 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::{Parser, ValueEnum};
use candle_transformers::models::yi::{Config, Model};
use candle::{DType, Device, Tensor};
use candle_examples::token_output_stream::TokenO... | candle/candle-examples/examples/yi/main.rs/0 | {
"file_path": "candle/candle-examples/examples/yi/main.rs",
"repo_id": "candle",
"token_count": 3580
} | 29 |
pub mod audio;
pub mod bs1770;
pub mod coco_classes;
pub mod imagenet;
pub mod token_output_stream;
pub mod wav;
use candle::utils::{cuda_is_available, metal_is_available};
use candle::{Device, Result, Tensor};
pub fn device(cpu: bool) -> Result<Device> {
if cpu {
Ok(Device::Cpu)
} else if cuda_is_ava... | candle/candle-examples/src/lib.rs/0 | {
"file_path": "candle/candle-examples/src/lib.rs",
"repo_id": "candle",
"token_count": 2455
} | 30 |
// Inspired by
// https://github.com/NVIDIA/DALI/blob/main/include/dali/core/static_switch.h
// and https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/Dispatch.h
#pragma once
/// @param COND - a boolean expression to switch by
/// @param CONST_NAME - a name given for the constexpr bool variable.
/// @... | candle/candle-flash-attn/kernels/static_switch.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/static_switch.h",
"repo_id": "candle",
"token_count": 1516
} | 31 |
// WARNING: THIS IS ONLY VALID ASSUMING THAT inp IS CONTIGUOUS!
// TODO: proper error reporting when ids are larger than v_size.
#include "cuda_utils.cuh"
#include<stdint.h>
template<typename T, typename I>
__device__ void index_select(
const size_t numel,
const size_t num_dims,
const size_t *info,
con... | candle/candle-kernels/src/indexing.cu/0 | {
"file_path": "candle/candle-kernels/src/indexing.cu",
"repo_id": "candle",
"token_count": 4357
} | 32 |
#include <metal_stdlib>
#include <metal_integer>
#include <metal_atomic>
using namespace metal;
// Constants
// 2^32 and 1/2^32. Useful for converting between float and uint.
static constexpr constant ulong UNIF01_NORM32 = 4294967296;
static constexpr constant float UNIF01_INV32 = 2.328306436538696289e-10;
// 2 * pi
... | candle/candle-metal-kernels/src/random.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/random.metal",
"repo_id": "candle",
"token_count": 3671
} | 33 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{DType, Device, Result, Tensor};
use candle_nn::{linear, AdamW, Linear, Module, Optimizer, ParamsAdamW, VarBuilder, VarMap};
fn gen_data() -> Result<(Tensor, Tensor)> {
// Generate some sam... | candle/candle-nn/examples/basic_optimizer.rs/0 | {
"file_path": "candle/candle-nn/examples/basic_optimizer.rs",
"repo_id": "candle",
"token_count": 595
} | 34 |
//! Recurrent Neural Networks
use candle::{DType, Device, IndexOp, Result, Tensor};
/// Trait for Recurrent Neural Networks.
#[allow(clippy::upper_case_acronyms)]
pub trait RNN {
type State: Clone;
/// A zero state from which the recurrent network is usually initialized.
fn zero_state(&self, batch_dim: us... | candle/candle-nn/src/rnn.rs/0 | {
"file_path": "candle/candle-nn/src/rnn.rs",
"repo_id": "candle",
"token_count": 4879
} | 35 |
use crate::onnx;
use crate::onnx::attribute_proto::AttributeType;
use crate::onnx::tensor_proto::DataType;
use candle::{bail, DType, Device, Result, Tensor};
use std::collections::HashMap;
pub type Value = Tensor;
pub fn dtype(dt: DataType) -> Option<DType> {
match dt {
DataType::Uint8 => Some(DType::U8),... | candle/candle-onnx/src/eval.rs/0 | {
"file_path": "candle/candle-onnx/src/eval.rs",
"repo_id": "candle",
"token_count": 21412
} | 36 |
import candle
from typing import Dict, Tuple, Any
from candle import Tensor, QTensor, utils, nn
from candle.nn import Module, ModuleList
def masked_fill(on_false: Tensor, mask: Tensor, on_true: Tensor):
shape = mask.shape
on_true = candle.tensor(on_true).broadcast_as(shape)
return mask.where_cond(on_true,... | candle/candle-pyo3/py_src/candle/models/llama.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/models/llama.py",
"repo_id": "candle",
"token_count": 2981
} | 37 |
#![allow(clippy::redundant_closure_call)]
use pyo3::exceptions::{PyTypeError, PyValueError};
use pyo3::prelude::*;
use pyo3::pyclass::CompareOp;
use pyo3::types::{IntoPyDict, PyDict, PyTuple};
use pyo3::ToPyObject;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::os::raw::c_long;
u... | candle/candle-pyo3/src/lib.rs/0 | {
"file_path": "candle/candle-pyo3/src/lib.rs",
"repo_id": "candle",
"token_count": 29734
} | 38 |
use candle::{DType, Error, Result, Tensor};
use rand::{distributions::Distribution, SeedableRng};
#[derive(Clone, PartialEq, Debug)]
pub enum Sampling {
ArgMax,
All { temperature: f64 },
TopK { k: usize, temperature: f64 },
TopP { p: f64, temperature: f64 },
TopKThenTopP { k: usize, p: f64, tempera... | candle/candle-transformers/src/generation/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/generation/mod.rs",
"repo_id": "candle",
"token_count": 2910
} | 39 |
#![allow(unused)]
use candle::{DType, IndexOp, Layout, Module, Result, Shape, Tensor, D};
use candle_nn::{conv1d, Conv1d, Conv1dConfig, ConvTranspose1d, VarBuilder};
// Encodec Model
// https://github.com/huggingface/transformers/blob/main/src/transformers/models/encodec/modeling_encodec.py
#[derive(Debug, Copy, Clon... | candle/candle-transformers/src/models/encodec.rs/0 | {
"file_path": "candle/candle-transformers/src/models/encodec.rs",
"repo_id": "candle",
"token_count": 12642
} | 40 |
use crate::models::with_tracing::{linear_no_bias, Embedding, Linear};
/// MPT model used by replit-code-v1_5-3b
/// https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/modeling_mpt.py
use candle::{DType, Device, IndexOp, Module, Result, Tensor, D};
use candle_nn::{layer_norm, LayerNorm, VarBuilder};
// https:/... | candle/candle-transformers/src/models/mpt.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mpt.rs",
"repo_id": "candle",
"token_count": 5485
} | 41 |
//! # Denoising Diffusion Implicit Models
//!
//! The Denoising Diffusion Implicit Models (DDIM) is a simple scheduler
//! similar to Denoising Diffusion Probabilistic Models (DDPM). The DDPM
//! generative process is the reverse of a Markovian process, DDIM generalizes
//! this to non-Markovian guidance.
//!
//! Denoi... | candle/candle-transformers/src/models/stable_diffusion/ddim.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/ddim.rs",
"repo_id": "candle",
"token_count": 3953
} | 42 |
use crate::models::with_tracing::{conv2d, linear, linear_no_bias, Conv2d, Linear};
use candle::{IndexOp, Module, Result, Tensor, D};
use candle_nn::{layer_norm, LayerNorm, VarBuilder};
// https://github.com/huggingface/transformers/blob/main/src/transformers/models/vit/configuration_vit.py
#[derive(Debug, Clone, serde... | candle/candle-transformers/src/models/vit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/vit.rs",
"repo_id": "candle",
"token_count": 5870
} | 43 |
use candle::{DType, Device, IndexOp, Result, Tensor, D};
use candle_nn::{
embedding, linear_no_bias as linear, rms_norm, Embedding, Linear, Module, RmsNorm, VarBuilder,
};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
#[derive(Debug, Clone)]
pub struct Config {
pub dim: usize, // transform... | candle/candle-wasm-examples/llama2-c/src/model.rs/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/src/model.rs",
"repo_id": "candle",
"token_count": 5272
} | 44 |
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
pub fn log(s: &str);
}
#[macro_export]
macro_rules! console_log {
// Note that this is using the `log` function impor... | candle/candle-wasm-examples/phi/src/lib.rs/0 | {
"file_path": "candle/candle-wasm-examples/phi/src/lib.rs",
"repo_id": "candle",
"token_count": 183
} | 45 |
//load the candle Whisper decoder wasm module
import init, { Decoder } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "whisper-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await ca... | candle/candle-wasm-examples/whisper/whisperWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/whisper/whisperWorker.js",
"repo_id": "candle",
"token_count": 1215
} | 46 |
Run the tests with:
```bash
RUST_LOG=wasm_bindgen_test_runner wasm-pack test --chrome --headless
```
Or:
```bash
wasm-pack test --chrome
```
If you get an "invalid session id" failure in headless mode, check that logs and
it may well be that your ChromeDriver is not at the same version as your
browser.
| candle/candle-wasm-tests/README.md/0 | {
"file_path": "candle/candle-wasm-tests/README.md",
"repo_id": "candle",
"token_count": 98
} | 47 |
# syntax=docker/dockerfile:1
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM node:20 as builder-production
WORKDIR /app
COPY --link --chown=1000 package-lock.json package.json ./
RUN --mount=type=cache,target=/app/.npm \
... | chat-ui/Dockerfile/0 | {
"file_path": "chat-ui/Dockerfile",
"repo_id": "chat-ui",
"token_count": 351
} | 48 |
import {
ADMIN_API_SECRET,
COOKIE_NAME,
ENABLE_ASSISTANTS,
EXPOSE_API,
MESSAGES_BEFORE_LOGIN,
PARQUET_EXPORT_SECRET,
} from "$env/static/private";
import type { Handle } from "@sveltejs/kit";
import {
PUBLIC_GOOGLE_ANALYTICS_ID,
PUBLIC_ORIGIN,
PUBLIC_APP_DISCLAIMER,
} from "$env/static/public";
import { collec... | chat-ui/src/hooks.server.ts/0 | {
"file_path": "chat-ui/src/hooks.server.ts",
"repo_id": "chat-ui",
"token_count": 1944
} | 49 |
<script lang="ts">
import CarbonEarth from "~icons/carbon/earth";
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
import type { Model } from "$lib/types/Model";
export let model: Pick<Model, "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl">;
export let variant: "light" | "dark" = ... | chat-ui/src/lib/components/ModelCardMetadata.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ModelCardMetadata.svelte",
"repo_id": "chat-ui",
"token_count": 623
} | 50 |
<script lang="ts">
import { webSearchParameters } from "$lib/stores/webSearchParameters";
import CarbonInformation from "~icons/carbon/information";
import Switch from "./Switch.svelte";
const toggle = () => ($webSearchParameters.useSearch = !$webSearchParameters.useSearch);
</script>
<div
class="flex h-8 cursor... | chat-ui/src/lib/components/WebSearchToggle.svelte/0 | {
"file_path": "chat-ui/src/lib/components/WebSearchToggle.svelte",
"repo_id": "chat-ui",
"token_count": 447
} | 51 |
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
/**
* Returns the lock id if the lock was acquired, false otherwise
*/
export async function acquireLock(key: string): Promise<ObjectId | false> {
try {
const id = new ObjectId();
const insert = await collections.semaphores... | chat-ui/src/lib/migrations/lock.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/lock.ts",
"repo_id": "chat-ui",
"token_count": 400
} | 52 |
import { z } from "zod";
import { COHERE_API_TOKEN } from "$env/static/private";
import type { Endpoint } from "../endpoints";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import type { Cohere, CohereClient } from "cohere-ai";
import { buildPrompt } from "$lib/buildPrompt";
export const en... | chat-ui/src/lib/server/endpoints/cohere/endpointCohere.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/cohere/endpointCohere.ts",
"repo_id": "chat-ui",
"token_count": 1331
} | 53 |
import { dot } from "@xenova/transformers";
import type { EmbeddingBackendModel } from "$lib/server/embeddingModels";
import type { Embedding } from "$lib/server/embeddingEndpoints/embeddingEndpoints";
// see here: https://github.com/nmslib/hnswlib/blob/359b2ba87358224963986f709e593d799064ace6/README.md?plain=1#L34
fu... | chat-ui/src/lib/server/sentenceSimilarity.ts/0 | {
"file_path": "chat-ui/src/lib/server/sentenceSimilarity.ts",
"repo_id": "chat-ui",
"token_count": 497
} | 54 |
import { writable } from "svelte/store";
export interface WebSearchParameters {
useSearch: boolean;
nItems: number;
}
export const webSearchParameters = writable<WebSearchParameters>({
useSearch: false,
nItems: 5,
});
| chat-ui/src/lib/stores/webSearchParameters.ts/0 | {
"file_path": "chat-ui/src/lib/stores/webSearchParameters.ts",
"repo_id": "chat-ui",
"token_count": 68
} | 55 |
import { defaultModel } from "$lib/server/models";
import type { Assistant } from "./Assistant";
import type { Timestamps } from "./Timestamps";
import type { User } from "./User";
export interface Settings extends Timestamps {
userId?: User["_id"];
sessionId?: string;
/**
* Note: Only conversations with this se... | chat-ui/src/lib/types/Settings.ts/0 | {
"file_path": "chat-ui/src/lib/types/Settings.ts",
"repo_id": "chat-ui",
"token_count": 289
} | 56 |
import { base } from "$app/paths";
import { PUBLIC_ORIGIN, PUBLIC_SHARE_PREFIX } from "$env/static/public";
export function getShareUrl(url: URL, shareId: string): string {
return `${PUBLIC_SHARE_PREFIX || `${PUBLIC_ORIGIN || url.origin}${base}`}/r/${shareId}`;
}
| chat-ui/src/lib/utils/getShareUrl.ts/0 | {
"file_path": "chat-ui/src/lib/utils/getShareUrl.ts",
"repo_id": "chat-ui",
"token_count": 99
} | 57 |
export const timeout = <T>(prom: Promise<T>, time: number): Promise<T> => {
let timer: NodeJS.Timeout;
return Promise.race([prom, new Promise<T>((_r, rej) => (timer = setTimeout(rej, time)))]).finally(
() => clearTimeout(timer)
);
};
| chat-ui/src/lib/utils/timeout.ts/0 | {
"file_path": "chat-ui/src/lib/utils/timeout.ts",
"repo_id": "chat-ui",
"token_count": 87
} | 58 |
import { PARQUET_EXPORT_DATASET, PARQUET_EXPORT_HF_TOKEN } from "$env/static/private";
import { collections } from "$lib/server/database";
import type { Message } from "$lib/types/Message";
import { error } from "@sveltejs/kit";
import { pathToFileURL } from "node:url";
import { unlink } from "node:fs/promises";
import... | chat-ui/src/routes/admin/export/+server.ts/0 | {
"file_path": "chat-ui/src/routes/admin/export/+server.ts",
"repo_id": "chat-ui",
"token_count": 1653
} | 59 |
<script lang="ts">
import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
import { pendingMessage } from "$lib/stores/pendingMessage";
import { isAborted } from "$lib/stores/isAborted";
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto, invalidateAll } from "$app/naviga... | chat-ui/src/routes/conversation/[id]/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/conversation/[id]/+page.svelte",
"repo_id": "chat-ui",
"token_count": 4558
} | 60 |
import ModelThumbnail from "./ModelThumbnail.svelte";
import { redirect, type RequestHandler } from "@sveltejs/kit";
import type { SvelteComponent } from "svelte";
import { Resvg } from "@resvg/resvg-js";
import satori from "satori";
import { html } from "satori-html";
import InterRegular from "../../../../../static/... | chat-ui/src/routes/models/[...model]/thumbnail.png/+server.ts/0 | {
"file_path": "chat-ui/src/routes/models/[...model]/thumbnail.png/+server.ts",
"repo_id": "chat-ui",
"token_count": 526
} | 61 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
<path
fill="#FFD21E"
d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z"
/>
<path
fill="#32343D"
d="M19.63 12.48c.37.14.52.9.9.7.71-.38.98-1.27.6-1.98a1.46 1.46 0 0 0-1.98-.61 1.4... | chat-ui/static/huggingchat/logo.svg/0 | {
"file_path": "chat-ui/static/huggingchat/logo.svg",
"repo_id": "chat-ui",
"token_count": 523
} | 62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.