text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/seggpt/test_image_processing_seggpt.py/0 | {
"file_path": "transformers/tests/models/seggpt/test_image_processing_seggpt.py",
"repo_id": "transformers",
"token_count": 6065
} |
# 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/speech_to_text/test_modeling_tf_speech_to_text.py/0 | {
"file_path": "transformers/tests/models/speech_to_text/test_modeling_tf_speech_to_text.py",
"repo_id": "transformers",
"token_count": 11558
} |
# 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/swin2sr/test_modeling_swin2sr.py/0 | {
"file_path": "transformers/tests/models/swin2sr/test_modeling_swin2sr.py",
"repo_id": "transformers",
"token_count": 6153
} |
# coding=utf-8
# Copyright 2023 The Intel Team Authors, 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/... | transformers/tests/models/tvp/test_image_processing_tvp.py/0 | {
"file_path": "transformers/tests/models/tvp/test_image_processing_tvp.py",
"repo_id": "transformers",
"token_count": 5459
} |
# 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/upernet/test_modeling_upernet.py/0 | {
"file_path": "transformers/tests/models/upernet/test_modeling_upernet.py",
"repo_id": "transformers",
"token_count": 5294
} |
# 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/xglm/test_modeling_xglm.py/0 | {
"file_path": "transformers/tests/models/xglm/test_modeling_xglm.py",
"repo_id": "transformers",
"token_count": 8225
} |
# 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": 4047
} |
# 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": 5436
} |
# 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": 6227
} |
# coding=utf-8
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/quantization/vptq_integration/test_vptq.py/0 | {
"file_path": "transformers/tests/quantization/vptq_integration/test_vptq.py",
"repo_id": "transformers",
"token_count": 3072
} |
import json
import os
import subprocess
import unittest
from ast import literal_eval
import pytest
from parameterized import parameterized, parameterized_class
from . import is_sagemaker_available
if is_sagemaker_available():
from sagemaker import Session, TrainingJobAnalytics
from sagemaker.huggingface imp... | transformers/tests/sagemaker/test_multi_node_data_parallel.py/0 | {
"file_path": "transformers/tests/sagemaker/test_multi_node_data_parallel.py",
"repo_id": "transformers",
"token_count": 1917
} |
# coding=utf-8
# Copyright 2019 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/tokenization/test_tokenization_fast.py/0 | {
"file_path": "transformers/tests/tokenization/test_tokenization_fast.py",
"repo_id": "transformers",
"token_count": 5106
} |
# coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | transformers/tests/utils/test_generic.py/0 | {
"file_path": "transformers/tests/utils/test_generic.py",
"repo_id": "transformers",
"token_count": 4758
} |
# coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | transformers/tests/utils/test_skip_decorators.py/0 | {
"file_path": "transformers/tests/utils/test_skip_decorators.py",
"repo_id": "transformers",
"token_count": 1214
} |
import argparse
import difflib
import glob
import logging
from io import StringIO
from create_dependency_mapping import find_priority_list
# Console for rich printing
from modular_model_converter import convert_modular_file
from rich.console import Console
from rich.syntax import Syntax
logging.basicConfig()
loggin... | transformers/utils/check_modular_conversion.py/0 | {
"file_path": "transformers/utils/check_modular_conversion.py",
"repo_id": "transformers",
"token_count": 1229
} |
# 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/get_test_info.py/0 | {
"file_path": "transformers/utils/get_test_info.py",
"repo_id": "transformers",
"token_count": 2737
} |
"""A simple script to set flexibly CUDA_VISIBLE_DEVICES in GitHub Actions CI workflow files."""
import argparse
import os
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--test_folder",
type=str,
default=None,
help="The test folder name of t... | transformers/utils/set_cuda_devices_for_ci.py/0 | {
"file_path": "transformers/utils/set_cuda_devices_for_ci.py",
"repo_id": "transformers",
"token_count": 338
} |
# 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/update_metadata.py/0 | {
"file_path": "transformers/utils/update_metadata.py",
"repo_id": "transformers",
"token_count": 6448
} |
# Training customization
TRL is designed with modularity in mind so that users to be able to efficiently customize the training loop for their needs. Below are some examples on how you can apply and test different techniques. Note: Although these examples use the DPOTrainer, the customization applies to most (if not ... | trl/docs/source/customization.md/0 | {
"file_path": "trl/docs/source/customization.md",
"repo_id": "trl",
"token_count": 2231
} |
# Learning Tools (Experimental 🧪)
Using Large Language Models (LLMs) with tools has been a popular topic recently with awesome works such as [ToolFormer](https://huggingface.co/papers/2302.04761) and [ToolBench](https://huggingface.co/papers/2305.16504). In TRL, we provide a simple example of how to teach LLM to use ... | trl/docs/source/learning_tools.md/0 | {
"file_path": "trl/docs/source/learning_tools.md",
"repo_id": "trl",
"token_count": 3870
} |
# 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/hh-rlhf-helpful-base.py/0 | {
"file_path": "trl/examples/datasets/hh-rlhf-helpful-base.py",
"repo_id": "trl",
"token_count": 1843
} |
# 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/research_projects/stack_llama/scripts/merge_peft_adapter.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/merge_peft_adapter.py",
"repo_id": "trl",
"token_count": 814
} |
# 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/rloo/rloo_tldr.py/0 | {
"file_path": "trl/examples/scripts/rloo/rloo_tldr.py",
"repo_id": "trl",
"token_count": 2235
} |
# 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_ddpo_trainer.py/0 | {
"file_path": "trl/tests/test_ddpo_trainer.py",
"repo_id": "trl",
"token_count": 1846
} |
# 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_reward_trainer.py/0 | {
"file_path": "trl/tests/test_reward_trainer.py",
"repo_id": "trl",
"token_count": 5202
} |
# 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/extras/best_of_n_sampler.py/0 | {
"file_path": "trl/trl/extras/best_of_n_sampler.py",
"repo_id": "trl",
"token_count": 2404
} |
# 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/gkd_config.py/0 | {
"file_path": "trl/trl/trainer/gkd_config.py",
"repo_id": "trl",
"token_count": 1765
} |
# 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/ppo_trainer.py/0 | {
"file_path": "trl/trl/trainer/ppo_trainer.py",
"repo_id": "trl",
"token_count": 19227
} |
<!--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 applicable law or agreed... | accelerate/docs/source/basic_tutorials/execution.md/0 | {
"file_path": "accelerate/docs/source/basic_tutorials/execution.md",
"repo_id": "accelerate",
"token_count": 1307
} |
<!--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/megatron_lm.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/megatron_lm.md",
"repo_id": "accelerate",
"token_count": 9538
} |
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py/0 | {
"file_path": "accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py",
"repo_id": "accelerate",
"token_count": 7835
} |
# Distributed inference examples with PiPPy
This repo contains a variety of tutorials for using the [PiPPy](https://github.com/PyTorch/PiPPy) pipeline parallelism library with accelerate. You will find examples covering:
1. How to trace the model using `accelerate.prepare_pippy`
2. How to specify inputs based on what... | accelerate/examples/inference/pippy/README.md/0 | {
"file_path": "accelerate/examples/inference/pippy/README.md",
"repo_id": "accelerate",
"token_count": 646
} |
# 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_3.py/0 | {
"file_path": "accelerate/manim_animations/big_model_inference/stage_3.py",
"repo_id": "accelerate",
"token_count": 2891
} |
# 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/checkpointing.py/0 | {
"file_path": "accelerate/src/accelerate/checkpointing.py",
"repo_id": "accelerate",
"token_count": 5491
} |
# 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/scheduler.py/0 | {
"file_path": "accelerate/src/accelerate/scheduler.py",
"repo_id": "accelerate",
"token_count": 1577
} |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/test_utils/scripts/test_merge_weights.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_merge_weights.py",
"repo_id": "accelerate",
"token_count": 2351
} |
# 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/launch.py/0 | {
"file_path": "accelerate/src/accelerate/utils/launch.py",
"repo_id": "accelerate",
"token_count": 12913
} |
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"zero_optimization": {
"stage": 3,
"offload_param": {
... | accelerate/tests/deepspeed/ds_config_zero3_model_only.json/0 | {
"file_path": "accelerate/tests/deepspeed/ds_config_zero3_model_only.json",
"repo_id": "accelerate",
"token_count": 425
} |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/tests/test_data_loader.py/0 | {
"file_path": "accelerate/tests/test_data_loader.py",
"repo_id": "accelerate",
"token_count": 16967
} |
#[cfg(test)]
pub mod simplified;
#[cfg(test)]
mod tests {
use anyhow::Result;
use candle::{DType, Device, Tensor};
use parquet::file::reader::SerializedFileReader;
// NOTE: Waiting on https://github.com/rust-lang/mdBook/pull/1856
#[rustfmt::skip]
#[tokio::test]
async fn book_hub_1() {
// A... | candle/candle-book/src/lib.rs/0 | {
"file_path": "candle/candle-book/src/lib.rs",
"repo_id": "candle",
"token_count": 2808
} |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle_core::{DType, Device, Tensor};
use criterion::{black_box, criterion_group, Criterion, Throughput};
use std::time::Instant;
fn rand_uniform(a: &Tensor) {
a.rand_like(-1.0, 123.0).unwrap();
}
fn rand_normal(a: &Tensor) {
a.randn_like(100.0, 15... | candle/candle-core/benches/benchmarks/random.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/random.rs",
"repo_id": "candle",
"token_count": 812
} |
//! Traits and methods for CPU-backed Tensors
pub mod erf;
pub mod kernels;
#[allow(unused)]
trait Cpu<const ARR: usize> {
type Unit;
type Array;
const STEP: usize;
const EPR: usize;
fn n() -> usize;
unsafe fn zero() -> Self::Unit;
unsafe fn zero_array() -> Self::Array;
unsafe fn load... | candle/candle-core/src/cpu/mod.rs/0 | {
"file_path": "candle/candle-core/src/cpu/mod.rs",
"repo_id": "candle",
"token_count": 2446
} |
//! Candle-specific Error and Result
use crate::{DType, DeviceLocation, Layout, MetalError, Shape};
#[derive(Debug, Clone)]
pub struct MatMulUnexpectedStriding {
pub lhs_l: Layout,
pub rhs_l: Layout,
pub bmnk: (usize, usize, usize, usize),
pub msg: &'static str,
}
impl std::fmt::Debug for Error {
... | candle/candle-core/src/error.rs/0 | {
"file_path": "candle/candle-core/src/error.rs",
"repo_id": "candle",
"token_count": 4127
} |
use super::utils::{
get_scale_min_k4, group_for_dequantization, group_for_quantization, make_q3_quants,
make_qkx1_quants, make_qx_quants, nearest_int,
};
use super::GgmlDType;
use crate::Result;
use byteorder::{ByteOrder, LittleEndian};
use half::f16;
use rayon::prelude::*;
// Default to QK_K 256 rather than 6... | candle/candle-core/src/quantized/k_quants.rs/0 | {
"file_path": "candle/candle-core/src/quantized/k_quants.rs",
"repo_id": "candle",
"token_count": 42632
} |
//! Useful functions for checking features.
use std::str::FromStr;
pub fn get_num_threads() -> usize {
// Respond to the same environment variable as rayon.
match std::env::var("RAYON_NUM_THREADS")
.ok()
.and_then(|s| usize::from_str(&s).ok())
{
Some(x) if x > 0 => x,
Some(_... | candle/candle-core/src/utils.rs/0 | {
"file_path": "candle/candle-core/src/utils.rs",
"repo_id": "candle",
"token_count": 398
} |
use candle_core::{test_device, test_utils, DType, Device, IndexOp, Result, Tensor, D};
fn zeros(device: &Device) -> Result<()> {
let tensor = Tensor::zeros((5, 2), DType::F32, device)?;
let (dim1, dim2) = tensor.dims2()?;
assert_eq!(dim1, 5);
assert_eq!(dim2, 2);
Ok(())
}
fn ones(device: &Device) ... | candle/candle-core/tests/tensor_tests.rs/0 | {
"file_path": "candle/candle-core/tests/tensor_tests.rs",
"repo_id": "candle",
"token_count": 33042
} |
* candle-codegeex4_9b
THUDM/CodeGeeX4 is a versatile model for all AI software development scenarios, including code completion, code interpreter, web search, function calling, repository-level Q&A and much more.
- [[https://github.com/THUDM/CodeGeeX4][Github]]
- [[https://codegeex.cn/][HomePage]]
- [[https://huggingf... | candle/candle-examples/examples/codegeex4-9b/README.org/0 | {
"file_path": "candle/candle-examples/examples/codegeex4-9b/README.org",
"repo_id": "candle",
"token_count": 1132
} |
// TODO: Add an offline mode.
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use anyhow::{Error as E, Result};
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::generation::LogitsProcessor;
use clap::Parser;
use h... | candle/candle-examples/examples/falcon/main.rs/0 | {
"file_path": "candle/candle-examples/examples/falcon/main.rs",
"repo_id": "candle",
"token_count": 2723
} |
#[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};
mod model;
use model::{Config, Model};
use candle::{DType, Device, Module, Tensor};
use candle_examples::token_output_stream::TokenOutputSt... | candle/candle-examples/examples/mamba-minimal/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mamba-minimal/main.rs",
"repo_id": "candle",
"token_count": 4087
} |
// This should reach 91.5% accuracy.
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::{Parser, ValueEnum};
use rand::prelude::*;
use candle::{DType, Result, Tensor, D};
use candle_nn::{loss, ops, Conv2d, Linear, Module, ModuleT, Optimizer, VarB... | candle/candle-examples/examples/mnist-training/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mnist-training/main.rs",
"repo_id": "candle",
"token_count": 4094
} |
# candle-quantized-t5
## Seq2Seq example
This example uses a quantized version of the t5 model.
```bash
$ cargo run --example quantized-t5 --release -- --prompt "translate to German: A beautiful candle."
...
Eine schöne Kerze.
```
## Generating Quantized weight files
The weight file is automatically retrieved fro... | candle/candle-examples/examples/quantized-t5/README.md/0 | {
"file_path": "candle/candle-examples/examples/quantized-t5/README.md",
"repo_id": "candle",
"token_count": 683
} |
//! Vectorized version of the gym environment.
use candle::{DType, Device, Result, Tensor};
use pyo3::prelude::*;
#[allow(unused)]
#[derive(Debug)]
pub struct Step {
pub obs: Tensor,
pub reward: Tensor,
pub is_done: Tensor,
}
#[allow(unused)]
pub struct VecGymEnv {
env: PyObject,
action_space: usi... | candle/candle-examples/examples/reinforcement-learning/vec_gym_env.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/vec_gym_env.rs",
"repo_id": "candle",
"token_count": 1572
} |
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use candle_transformers::models::stable_diffusion;
use std::ops::Div;
use anyhow::{Error as E, Result};
use candle::{DType, Device, IndexOp, Module, Tensor, D};
use clap::Parser;
use rand::Rng;
use stable_... | candle/candle-examples/examples/stable-diffusion/main.rs/0 | {
"file_path": "candle/candle-examples/examples/stable-diffusion/main.rs",
"repo_id": "candle",
"token_count": 14021
} |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::Parser;
use candle::{DType, IndexOp, D};
use candle_nn::VarBuilder;
use candle_transformers::models::vit;
#[derive(Parser)]
struct Args {
#[arg(long)]
model: Option<String>,
#[arg(l... | candle/candle-examples/examples/vit/main.rs/0 | {
"file_path": "candle/candle-examples/examples/vit/main.rs",
"repo_id": "candle",
"token_count": 762
} |
use candle::{DType, Device, IndexOp, Result, Tensor};
use candle_nn::{batch_norm, conv2d, conv2d_no_bias, Func, Module, VarBuilder};
use std::collections::BTreeMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
#[derive(Debug)]
struct Block {
block_type: String,
parameters: BTreeMa... | candle/candle-examples/examples/yolo-v3/darknet.rs/0 | {
"file_path": "candle/candle-examples/examples/yolo-v3/darknet.rs",
"repo_id": "candle",
"token_count": 5395
} |
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_avai... | candle/candle-examples/src/lib.rs/0 | {
"file_path": "candle/candle-examples/src/lib.rs",
"repo_id": "candle",
"token_count": 2878
} |
/******************************************************************************
* Copyright (c) 2024, Tri Dao.
******************************************************************************/
#pragma once
#include "cute/tensor.hpp"
#include "cutlass/cutlass.h"
#include "cutlass/layout/layout.h"
#include <cutlass/nu... | candle/candle-flash-attn/kernels/kernel_traits.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/kernel_traits.h",
"repo_id": "candle",
"token_count": 7903
} |
#include "binary_op_macros.cuh"
#include<stdint.h>
#if __CUDA_ARCH__ >= 800
BINARY_OP(__nv_bfloat16, badd_bf16, x + y)
BINARY_OP(__nv_bfloat16, bdiv_bf16, x / y)
BINARY_OP(__nv_bfloat16, bmul_bf16, x * y)
BINARY_OP(__nv_bfloat16, bsub_bf16, x - y)
BINARY_OP(__nv_bfloat16, bmaximum_bf16, maxg(x, y))
BINARY_OP(__nv_bflo... | candle/candle-kernels/src/binary.cu/0 | {
"file_path": "candle/candle-kernels/src/binary.cu",
"repo_id": "candle",
"token_count": 2144
} |
use anyhow::Result;
use candle_metal_kernels::GemmDType;
/// This example contains some simple benchmarks so that it's easy to run them in perf etc.
use clap::{Parser, Subcommand};
use half::f16;
fn run_gemm(f32: bool, n: usize) -> Result<()> {
const WARMUP_ITERS: usize = 2;
const MIN_DUR: f64 = 4.;
let d... | candle/candle-metal-kernels/examples/metal_benchmarks.rs/0 | {
"file_path": "candle/candle-metal-kernels/examples/metal_benchmarks.rs",
"repo_id": "candle",
"token_count": 1833
} |
use crate::utils::{BufferOffset, EncoderProvider};
use crate::{set_params, DType, Kernels, MetalKernelError, Source};
use metal::{Buffer, ComputeCommandEncoderRef, Device, MTLResourceOptions, MTLSize};
#[allow(clippy::too_many_arguments)]
pub fn call_arg_sort(
device: &Device,
ep: impl EncoderProvider,
ker... | candle/candle-metal-kernels/src/sort.rs/0 | {
"file_path": "candle/candle-metal-kernels/src/sort.rs",
"repo_id": "candle",
"token_count": 4875
} |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle::{DType, Device, Tensor};
use candle_nn::ops::softmax_last_dim;
use criterion::Throughput;
use criterion::{black_box, criterion_group, Criterion};
use std::time::Instant;
fn run(input: &Tensor) {
let _ = softmax_last_dim(&input).unwrap();
}
cons... | candle/candle-nn/benches/benchmarks/softmax.rs/0 | {
"file_path": "candle/candle-nn/benches/benchmarks/softmax.rs",
"repo_id": "candle",
"token_count": 662
} |
//! Tensor ops.
//!
use candle::{CpuStorage, DType, Layout, Module, Result, Shape, Tensor, D};
use rayon::prelude::*;
/// Applies the softmax function to the input tensor, rescaling the element so that elements on
/// a slice of fixed index on dimension `dim` are between 0 and 1 and sum to 1.
///
/// ```rust
/// use ... | candle/candle-nn/src/ops.rs/0 | {
"file_path": "candle/candle-nn/src/ops.rs",
"repo_id": "candle",
"token_count": 23996
} |
#[cfg(feature = "metal")]
mod metal_sdpa_tests {
use candle::{DType, Device, Result, Shape, Tensor};
use rand::SeedableRng;
use rand_distr::Distribution;
use std::ops::{Div, Mul};
fn randn<S: Into<Shape>>(
rng: &mut rand::rngs::StdRng,
shape: S,
dev: &Device,
) -> Result... | candle/candle-nn/tests/sdpa.rs/0 | {
"file_path": "candle/candle-nn/tests/sdpa.rs",
"repo_id": "candle",
"token_count": 3762
} |
# Generated content DO NOT EDIT
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence
from os import PathLike
from candle.typing import _ArrayLike, Device, Scalar, Index, Shape
class bf16(DType):
pass
@staticmethod
def cat(tensors: List[Tensor], dim: int) -> Tensor:
"""
Concatenat... | candle/candle-pyo3/py_src/candle/__init__.pyi/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/__init__.pyi",
"repo_id": "candle",
"token_count": 5844
} |
# Generated content DO NOT EDIT
from .. import utils
cuda_is_available = utils.cuda_is_available
get_num_threads = utils.get_num_threads
has_accelerate = utils.has_accelerate
has_mkl = utils.has_mkl
load_ggml = utils.load_ggml
load_gguf = utils.load_gguf
load_safetensors = utils.load_safetensors
save_gguf = utils.save... | candle/candle-pyo3/py_src/candle/utils/__init__.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/utils/__init__.py",
"repo_id": "candle",
"token_count": 150
} |
import candle
from candle import Tensor
from candle.utils import cuda_is_available
from candle.testing import assert_equal
import pytest
def test_tensor_can_be_constructed():
t = Tensor(42.0)
assert t.values() == 42.0
def test_tensor_can_be_constructed_from_list():
t = Tensor([3.0, 1, 4, 1, 5, 9, 2, 6])... | candle/candle-pyo3/tests/native/test_tensor.py/0 | {
"file_path": "candle/candle-pyo3/tests/native/test_tensor.py",
"repo_id": "candle",
"token_count": 4688
} |
//! Contrastive Language-Image Pre-Training
//!
//! Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
//! pairs of images with related texts.
//!
//! - 💻 [GH Link](https://github.com/openai/CLIP)
//! - 💻 Transformers Python [reference implementation](https://github.com/huggingface/transform... | candle/candle-transformers/src/models/clip/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/clip/mod.rs",
"repo_id": "candle",
"token_count": 2243
} |
//! EVA-2 inference implementation.
//!
//! EVA-02 is a computer vision model that can be used as an ImageNet classifier.
//! The model returns the probability for an image to belong to each of the 1000
//! ImageNet categories.
//!
//! - [Paper](https://arxiv.org/abs/2303.11331). EVA-02: A Visual Representation for Neo... | candle/candle-transformers/src/models/eva2.rs/0 | {
"file_path": "candle/candle-transformers/src/models/eva2.rs",
"repo_id": "candle",
"token_count": 7638
} |
//! Llama2 inference implementation.
//!
//! See ["LLaMA 2: Open Foundation and Fine-Tuned Chat Models"](https://arxiv.org/abs/2307.09288)
//!
//! - ⚡ [Interactive Wasm Example](https://huggingface.co/spaces/lmz/candle-llama2)
//! - 💻 llama2.c [GH Link](https://github.com/karpathy/llama2.c)
//!
use candle::{DType, De... | candle/candle-transformers/src/models/llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llama2_c.rs",
"repo_id": "candle",
"token_count": 6603
} |
//! Mixtral Model, a sparse mixture of expert model based on the Mistral architecture
//!
//! See Mixtral model details at:
//! - [Hugging Face](https://huggingface.co/docs/transformers/model_doc/mixtral)
//! - [Mixtral-8x7B Blog Post](https://mistral.ai/news/mixtral-of-experts/)
//!
//! The model uses a mixture of exp... | candle/candle-transformers/src/models/mixtral.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mixtral.rs",
"repo_id": "candle",
"token_count": 9110
} |
//! Mistral model implementation with quantization support.
//!
//! Mistral is a large language model optimized for efficiency.
//! This implementation provides quantization for reduced memory and compute.
//!
//! Key characteristics:
//! - Sliding window attention mechanism
//! - Grouped query attention (GQA)
//! - RM... | candle/candle-transformers/src/models/quantized_mistral.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_mistral.rs",
"repo_id": "candle",
"token_count": 5831
} |
//! # ResNet Implementation
//!
//! Implementation of ResNet architectures as described in the paper:
//!
//! ## Reference
//!
//! [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
//! He et al. (2015)
//!
//! This paper introduced ResNet, a deep neural network architecture that utilizes
... | candle/candle-transformers/src/models/resnet.rs/0 | {
"file_path": "candle/candle-transformers/src/models/resnet.rs",
"repo_id": "candle",
"token_count": 4023
} |
use candle::{Result, Tensor, D};
use candle_nn as nn;
use candle_nn::Module;
#[derive(Debug)]
pub struct TimestepEmbedding {
linear_1: nn::Linear,
linear_2: nn::Linear,
}
impl TimestepEmbedding {
// act_fn: "silu"
pub fn new(vs: nn::VarBuilder, channel: usize, time_embed_dim: usize) -> Result<Self> {
... | candle/candle-transformers/src/models/stable_diffusion/embeddings.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/embeddings.rs",
"repo_id": "candle",
"token_count": 1008
} |
//! Vision Transformer (ViT) implementation.
//!
//! Vision Transformer applies transformer architecture to image classification
//! by splitting images into patches and processing them as a sequence.
//!
//! Key characteristics:
//! - Image patches as sequence tokens
//! - Self-attention between patches
//! - Position... | candle/candle-transformers/src/models/vit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/vit.rs",
"repo_id": "candle",
"token_count": 6028
} |
import init, { Model } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "phi-mixformer-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await cachedResponse.arrayBuffer();
return new... | candle/candle-wasm-examples/phi/phiWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/phi/phiWorker.js",
"repo_id": "candle",
"token_count": 1667
} |
use candle::{Device, Tensor};
use candle_transformers::generation::LogitsProcessor;
pub use candle_transformers::models::quantized_t5::{
Config, T5EncoderModel, T5ForConditionalGeneration, VarBuilder,
};
use candle_wasm_example_t5::console_log;
use tokenizers::Tokenizer;
use wasm_bindgen::prelude::*;
const DEVICE:... | candle/candle-wasm-examples/t5/src/bin/m-quantized.rs/0 | {
"file_path": "candle/candle-wasm-examples/t5/src/bin/m-quantized.rs",
"repo_id": "candle",
"token_count": 3555
} |
//load the candle yolo wasm module
import init, { Model, ModelPose } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "yolo-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await cachedR... | candle/candle-wasm-examples/yolo/yoloWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/yolo/yoloWorker.js",
"repo_id": "candle",
"token_count": 756
} |
# Prompt templates
These are the templates used to format the conversation history for different models used in HuggingChat. Set them in your `.env.local` [like so](https://github.com/huggingface/chat-ui#chatprompttemplate).
## Llama 2
```env
<s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}... | chat-ui/PROMPTS.md/0 | {
"file_path": "chat-ui/PROMPTS.md",
"repo_id": "chat-ui",
"token_count": 1133
} |
# OpenID
The login feature is disabled by default and users are attributed a unique ID based on their browser. But if you want to use OpenID to authenticate your users, you can add the following to your `.env.local` file:
```ini
OPENID_CONFIG=`{
PROVIDER_URL: "<your OIDC issuer>",
CLIENT_ID: "<your OIDC client ID... | chat-ui/docs/source/configuration/open-id.md/0 | {
"file_path": "chat-ui/docs/source/configuration/open-id.md",
"repo_id": "chat-ui",
"token_count": 160
} |
import { vi, afterAll } from "vitest";
import dotenv from "dotenv";
import { resolve } from "path";
import fs from "fs";
import { MongoMemoryServer } from "mongodb-memory-server";
let mongoServer: MongoMemoryServer;
// Load the .env file
const envPath = resolve(__dirname, "../.env");
dotenv.config({ path: envPath });
... | chat-ui/scripts/setupTest.ts/0 | {
"file_path": "chat-ui/scripts/setupTest.ts",
"repo_id": "chat-ui",
"token_count": 390
} |
<script lang="ts">
interface Props {
isCollapsed: boolean;
onClick: () => void;
classNames: string;
}
let { isCollapsed, classNames, onClick }: Props = $props();
</script>
<button
onclick={onClick}
class="{classNames} group flex h-16 w-6 flex-col items-center justify-center -space-y-1 outline-none *:h-3 *:... | chat-ui/src/lib/components/ExpandNavigation.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ExpandNavigation.svelte",
"repo_id": "chat-ui",
"token_count": 304
} |
<script lang="ts">
import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
interface Props {
classNames?: string;
onClick?: () => void;
}
let { classNames = "", onClick }: Props = $props();
</script>
<button
type="button"
onclick={onClick}
class="btn flex h-8 rounded-lg border bg-white px-3 py-1 ... | chat-ui/src/lib/components/StopGeneratingBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/StopGeneratingBtn.svelte",
"repo_id": "chat-ui",
"token_count": 211
} |
<script lang="ts">
import { run, createBubbler } from "svelte/legacy";
const bubble = createBubbler();
import type { Message, MessageFile } from "$lib/types/Message";
import { createEventDispatcher, onDestroy, tick } from "svelte";
import CarbonExport from "~icons/carbon/export";
import CarbonCheckmark from "~i... | chat-ui/src/lib/components/chat/ChatWindow.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatWindow.svelte",
"repo_id": "chat-ui",
"token_count": 7079
} |
<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"
viewBox="0 0 32 32"
><path
fill-rule... | chat-ui/src/lib/components/icons/IconScreenshot.svelte/0 | {
"file_path": "chat-ui/src/lib/components/icons/IconScreenshot.svelte",
"repo_id": "chat-ui",
"token_count": 471
} |
import { ObjectId, type WithId } from "mongodb";
import { collections } from "$lib/server/database";
import type { Migration } from ".";
import type { Conversation } from "$lib/types/Conversation";
import type { MessageFile } from "$lib/types/Message";
const updateMessageFiles: Migration = {
_id: new ObjectId("5f9f5... | chat-ui/src/lib/migrations/routines/05-update-message-files.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/05-update-message-files.ts",
"repo_id": "chat-ui",
"token_count": 618
} |
import { z } from "zod";
import type { Endpoint } from "../endpoints";
import { env } from "$env/dynamic/private";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import { createImageProcessorOptionsValidator } from "../images";
import { endpointMessagesToAnthropicMessages, addToolResults } fr... | chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts",
"repo_id": "chat-ui",
"token_count": 2502
} |
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import type OpenAI from "openai";
import type { Stream } from "openai/streaming";
import type { ToolCall } from "$lib/types/Tool";
type ToolCallWithParameters = {
toolCall: ToolCall;
parameterJsonString: string;
};
function prepareToolCalls(t... | chat-ui/src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.ts",
"repo_id": "chat-ui",
"token_count": 963
} |
import { smallModel } from "$lib/server/models";
import { MessageUpdateType, type MessageUpdate } from "$lib/types/MessageUpdate";
import type { EndpointMessage } from "./endpoints/endpoints";
export async function* generateFromDefaultEndpoint({
messages,
preprompt,
generateSettings,
}: {
messages: EndpointMessage... | chat-ui/src/lib/server/generateFromDefaultEndpoint.ts/0 | {
"file_path": "chat-ui/src/lib/server/generateFromDefaultEndpoint.ts",
"repo_id": "chat-ui",
"token_count": 362
} |
import type { ConfigTool } from "$lib/types/Tool";
import { ObjectId } from "mongodb";
const directlyAnswer: ConfigTool = {
_id: new ObjectId("00000000000000000000000D"),
type: "config",
description: "Answer the user's query directly",
color: "blue",
icon: "chat",
displayName: "Directly Answer",
isOnByDefault: ... | chat-ui/src/lib/server/tools/directlyAnswer.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/directlyAnswer.ts",
"repo_id": "chat-ui",
"token_count": 209
} |
import { defaultEmbeddingModel, embeddingModels } from "$lib/server/embeddingModels";
import type { Conversation } from "$lib/types/Conversation";
import type { Message } from "$lib/types/Message";
import type { WebSearch, WebSearchScrapedSource } from "$lib/types/WebSearch";
import type { Assistant } from "$lib/types... | chat-ui/src/lib/server/websearch/runWebSearch.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/runWebSearch.ts",
"repo_id": "chat-ui",
"token_count": 1159
} |
import type { WebSearchSource } from "$lib/types/WebSearch";
import {
MessageUpdateType,
MessageWebSearchUpdateType,
type MessageWebSearchErrorUpdate,
type MessageWebSearchFinishedUpdate,
type MessageWebSearchGeneralUpdate,
type MessageWebSearchSourcesUpdate,
} from "$lib/types/MessageUpdate";
export function ma... | chat-ui/src/lib/server/websearch/update.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/update.ts",
"repo_id": "chat-ui",
"token_count": 374
} |
import type { MessageUpdate } from "./MessageUpdate";
import type { Timestamps } from "./Timestamps";
import type { WebSearch } from "./WebSearch";
import type { v4 } from "uuid";
export type Message = Partial<Timestamps> & {
from: "user" | "assistant" | "system";
id: ReturnType<typeof v4>;
content: string;
update... | chat-ui/src/lib/types/Message.ts/0 | {
"file_path": "chat-ui/src/lib/types/Message.ts",
"repo_id": "chat-ui",
"token_count": 277
} |
import type { ObjectId } from "mongodb";
import type { Timestamps } from "./Timestamps";
export interface User extends Timestamps {
_id: ObjectId;
username?: string;
name: string;
email?: string;
avatarUrl: string | undefined;
hfUserId: string;
isAdmin?: boolean;
isEarlyAccess?: boolean;
}
| chat-ui/src/lib/types/User.ts/0 | {
"file_path": "chat-ui/src/lib/types/User.ts",
"repo_id": "chat-ui",
"token_count": 100
} |
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
import { describe, expect, it } from "vitest";
import { insertLegacyConversation, insertSideBranchesConversation } from "./treeHelpers.spec";
import { addChildren } from "./addChildren";
import type { Message } from "$lib/types/Mes... | chat-ui/src/lib/utils/tree/addChildren.spec.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/addChildren.spec.ts",
"repo_id": "chat-ui",
"token_count": 1301
} |
import { json } from "@sveltejs/kit";
import { logger } from "$lib/server/logger";
import { computeAllStats } from "$lib/jobs/refresh-conversation-stats";
// Triger like this:
// curl -X POST "http://localhost:5173/chat/admin/stats/compute" -H "Authorization: Bearer <ADMIN_API_SECRET>"
export async function POST() {
... | chat-ui/src/routes/admin/stats/compute/+server.ts/0 | {
"file_path": "chat-ui/src/routes/admin/stats/compute/+server.ts",
"repo_id": "chat-ui",
"token_count": 161
} |
<script lang="ts">
import type { PageData } from "./$types";
import { env as envPublic } from "$env/dynamic/public";
import { isHuggingChat } from "$lib/utils/isHuggingChat";
import { goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/state";
import CarbonAdd from "~i... | chat-ui/src/routes/assistants/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/assistants/+page.svelte",
"repo_id": "chat-ui",
"token_count": 5369
} |
import { dev } from "$app/environment";
import { base } from "$app/paths";
import { env } from "$env/dynamic/private";
import { collections } from "$lib/server/database";
import { redirect } from "@sveltejs/kit";
export const actions = {
async default({ cookies, locals }) {
await collections.sessions.deleteOne({ se... | chat-ui/src/routes/logout/+page.server.ts/0 | {
"file_path": "chat-ui/src/routes/logout/+page.server.ts",
"repo_id": "chat-ui",
"token_count": 237
} |
<script lang="ts">
import { applyAction, enhance } from "$app/forms";
import { invalidateAll } from "$app/navigation";
import Modal from "$lib/components/Modal.svelte";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher<{ close: void }>();
let reason = $state("");
</script>
... | chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte",
"repo_id": "chat-ui",
"token_count": 596
} |
<script lang="ts">
import { afterNavigate, goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/state";
import Modal from "$lib/components/Modal.svelte";
import ToolLogo from "$lib/components/ToolLogo.svelte";
import { env as envPublic } from "$env/dynamic/public";
import ... | chat-ui/src/routes/tools/[toolId]/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/tools/[toolId]/+page.svelte",
"repo_id": "chat-ui",
"token_count": 4963
} |
import json
import os
import tempfile
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features import Array2D
from utils import generate_examples, get_duration
SHAPE_TEST_1 = (30, 487)
SHAPE_TEST_2 = (36, 1024)
SPEED_TEST_SHAPE = (100, 100)
SPEED_TEST_N_EXAMPLES = 100
DEFAULT_FEATURES = ... | datasets/benchmarks/benchmark_array_xd.py/0 | {
"file_path": "datasets/benchmarks/benchmark_array_xd.py",
"repo_id": "datasets",
"token_count": 2176
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.