text stringlengths 7 1.24M | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 519 |
|---|---|---|---|
# coding=utf-8
# Copyright 2022 The HuggingFace Team 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/tests/quantization/bnb/test_mixed_int8.py/0 | {
"file_path": "transformers/tests/quantization/bnb/test_mixed_int8.py",
"repo_id": "transformers",
"token_count": 16033
} | 407 |
# 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
} | 408 |
# 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/test_configuration_common.py/0 | {
"file_path": "transformers/tests/test_configuration_common.py",
"repo_id": "transformers",
"token_count": 2863
} | 409 |
# coding=utf-8
# Copyright 2018 the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/tests/trainer/test_trainer.py/0 | {
"file_path": "transformers/tests/trainer/test_trainer.py",
"repo_id": "transformers",
"token_count": 90644
} | 410 |
import unittest
import warnings
from dataclasses import dataclass
from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir
@dataclass
class FakeOriginalTokenizer:
vocab_file: str
class ConvertSlowTokenizerTest(unittest.TestCase):
def test_spm_convert... | transformers/tests/utils/test_convert_slow_tokenizer.py/0 | {
"file_path": "transformers/tests/utils/test_convert_slow_tokenizer.py",
"repo_id": "transformers",
"token_count": 524
} | 411 |
# 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/utils/test_modeling_tf_core.py/0 | {
"file_path": "transformers/tests/utils/test_modeling_tf_core.py",
"repo_id": "transformers",
"token_count": 9190
} | 412 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/check_dummies.py/0 | {
"file_path": "transformers/utils/check_dummies.py",
"repo_id": "transformers",
"token_count": 3338
} | 413 |
# coding=utf-8
# Copyright 2022 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/sort_auto_mappings.py/0 | {
"file_path": "transformers/utils/sort_auto_mappings.py",
"repo_id": "transformers",
"token_count": 1813
} | 414 |
<div style="text-align: center">
<img src="https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/trl_banner_dark.png">
</div>
# TRL - Transformer Reinforcement Learning
> Full stack library to fine-tune and align large language models.
<p align="center">
<a href="https://github.c... | trl/README.md/0 | {
"file_path": "trl/README.md",
"repo_id": "trl",
"token_count": 3018
} | 415 |
# Installation
You can install TRL either from pypi or from source:
## pypi
Install the library with pip:
```bash
pip install trl
```
### Source
You can also install the latest version from source. First clone the repo and then run the installation with `pip`:
```bash
git clone https://github.com/huggingface/trl.gi... | trl/docs/source/installation.mdx/0 | {
"file_path": "trl/docs/source/installation.mdx",
"repo_id": "trl",
"token_count": 147
} | 416 |
# Sentiment Tuning Examples
The notebooks and scripts in this examples show how to fine-tune a model with a sentiment classifier (such as `lvwerra/distilbert-imdb`).
Here's an overview of the notebooks and scripts in the [trl repository](https://github.com/huggingface/trl/tree/main/examples):
| File ... | trl/docs/source/sentiment_tuning.mdx/0 | {
"file_path": "trl/docs/source/sentiment_tuning.mdx",
"repo_id": "trl",
"token_count": 2400
} | 417 |
import sys
from dataclasses import dataclass, field
from typing import Optional
from datasets import load_dataset
from huggingface_hub import HfApi
from huggingface_hub.repocard import RepoCard
from transformers import HfArgumentParser
"""
# debug
python -i examples/datasets/tldr_preference.py --debug --push_to_hub
... | trl/examples/datasets/tldr_preference.py/0 | {
"file_path": "trl/examples/datasets/tldr_preference.py",
"repo_id": "trl",
"token_count": 3040
} | 418 |
# Fine-Tune Llama2-7b on SE paired dataset
import os
from dataclasses import dataclass, field
from typing import Optional
import torch
from accelerate import Accelerator
from datasets import load_dataset
from peft import AutoPeftModelForCausalLM, LoraConfig
from tqdm import tqdm
from transformers import (
AutoMode... | trl/examples/research_projects/stack_llama_2/scripts/sft_llama2.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama_2/scripts/sft_llama2.py",
"repo_id": "trl",
"token_count": 2723
} | 419 |
from dataclasses import dataclass, field
from typing import Optional
from datasets import load_dataset
from transformers import HfArgumentParser
from vllm import LLM, SamplingParams
from trl import HfPairwiseJudge, OpenAIPairwiseJudge
"""
Examples:
python examples/scripts/evals/judge_tldr.py --model_name_or_path v... | trl/examples/scripts/evals/judge_tldr.py/0 | {
"file_path": "trl/examples/scripts/evals/judge_tldr.py",
"repo_id": "trl",
"token_count": 1123
} | 420 |
# Copyright 2023 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
#
... | trl/scripts/stale.py/0 | {
"file_path": "trl/scripts/stale.py",
"repo_id": "trl",
"token_count": 806
} | 421 |
# 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/tests/test_ddpo_trainer.py/0 | {
"file_path": "trl/tests/test_ddpo_trainer.py",
"repo_id": "trl",
"token_count": 1784
} | 422 |
# 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_rloo_trainer.py/0 | {
"file_path": "trl/tests/test_rloo_trainer.py",
"repo_id": "trl",
"token_count": 1073
} | 423 |
import logging
from typing import Callable, Literal, Optional, Union
from datasets import Dataset, Value
from transformers import AutoTokenizer
from ..trainer.utils import ConstantLengthDataset
FORMAT_MAPPING = {
"chatml": [{"content": Value(dtype="string", id=None), "role": Value(dtype="string", id=None)}],
... | trl/trl/extras/dataset_formatting.py/0 | {
"file_path": "trl/trl/extras/dataset_formatting.py",
"repo_id": "trl",
"token_count": 1400
} | 424 |
# 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... | trl/trl/trainer/cpo_config.py/0 | {
"file_path": "trl/trl/trainer/cpo_config.py",
"repo_id": "trl",
"token_count": 1553
} | 425 |
# 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/trainer/ppo_trainer.py/0 | {
"file_path": "trl/trl/trainer/ppo_trainer.py",
"repo_id": "trl",
"token_count": 29719
} | 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 applicable law or ... | accelerate/CONTRIBUTING.md/0 | {
"file_path": "accelerate/CONTRIBUTING.md",
"repo_id": "accelerate",
"token_count": 2693
} | 0 |
# Builds CPU-only Docker image of PyTorch
# Uses multi-staged approach to reduce size
# Stage 1
FROM python:3.8-slim as compile-image
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt-get install -y --no-install-recommends \
build-essential \
git \
gcc
# Setup virtual environment for Docker
ENV V... | accelerate/docker/accelerate-cpu/Dockerfile/0 | {
"file_path": "accelerate/docker/accelerate-cpu/Dockerfile",
"repo_id": "accelerate",
"token_count": 380
} | 1 |
<!--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/concept_guides/fsdp_and_deepspeed.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/fsdp_and_deepspeed.md",
"repo_id": "accelerate",
"token_count": 3547
} | 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/fsdp.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/fsdp.md",
"repo_id": "accelerate",
"token_count": 3362
} | 3 |
# Config Zoo
This folder contains a variety of minimal configurations for `Accelerate` achieving certain goals. You can use these
direct config YAML's, or build off of them for your own YAML's.
These are highly annoted versions, aiming to teach you what each section does.
Each config can be run via `accelerate laun... | accelerate/examples/config_yaml_templates/README.md/0 | {
"file_path": "accelerate/examples/config_yaml_templates/README.md",
"repo_id": "accelerate",
"token_count": 124
} | 4 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/examples/inference/distributed/stable_diffusion.py/0 | {
"file_path": "accelerate/examples/inference/distributed/stable_diffusion.py",
"repo_id": "accelerate",
"token_count": 363
} | 5 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/manim_animations/big_model_inference/stage_2.py/0 | {
"file_path": "accelerate/manim_animations/big_model_inference/stage_2.py",
"repo_id": "accelerate",
"token_count": 2354
} | 6 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/big_modeling.py/0 | {
"file_path": "accelerate/src/accelerate/big_modeling.py",
"repo_id": "accelerate",
"token_count": 11462
} | 7 |
# Copyright 2022 The HuggingFace Team and Brian Chao. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | accelerate/src/accelerate/commands/menu/cursor.py/0 | {
"file_path": "accelerate/src/accelerate/commands/menu/cursor.py",
"repo_id": "accelerate",
"token_count": 763
} | 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 required by applicabl... | accelerate/src/accelerate/optimizer.py/0 | {
"file_path": "accelerate/src/accelerate/optimizer.py",
"repo_id": "accelerate",
"token_count": 3387
} | 9 |
# 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
} | 10 |
# 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": 13048
} | 11 |
# 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/fsdp/test_fsdp.py/0 | {
"file_path": "accelerate/tests/fsdp/test_fsdp.py",
"repo_id": "accelerate",
"token_count": 9117
} | 12 |
# 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_hooks.py/0 | {
"file_path": "accelerate/tests/test_hooks.py",
"repo_id": "accelerate",
"token_count": 6577
} | 13 |
# 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_state_checkpointing.py/0 | {
"file_path": "accelerate/tests/test_state_checkpointing.py",
"repo_id": "accelerate",
"token_count": 8972
} | 14 |
# Model arguments
model_name_or_path: HuggingFaceTB/SmolLM-360M
model_revision: main
tokenizer_name_or_path: HuggingFaceTB/SmolLM-360M-Instruct # Custom tokenizer with <|im_start|> and <|im_end|> tokens
torch_dtype: bfloat16
use_flash_attention_2: true
# Data training arguments
dataset_mixer:
HuggingFaceTB/Magpie-Pr... | alignment-handbook/recipes/smollm/sft/config.yaml/0 | {
"file_path": "alignment-handbook/recipes/smollm/sft/config.yaml",
"repo_id": "alignment-handbook",
"token_count": 589
} | 15 |
# 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... | alignment-handbook/tests/test_decontaminate.py/0 | {
"file_path": "alignment-handbook/tests/test_decontaminate.py",
"repo_id": "alignment-handbook",
"token_count": 926
} | 16 |
[package]
name = "candle-book"
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-book/Cargo.toml/0 | {
"file_path": "candle/candle-book/Cargo.toml",
"repo_id": "candle",
"token_count": 459
} | 17 |
# Installation
**With Cuda support**:
1. First, make sure that Cuda is correctly installed.
- `nvcc --version` should print information about your Cuda compiler driver.
- `nvidia-smi --query-gpu=compute_cap --format=csv` should print your GPUs compute capability, e.g. something
like:
```bash
compute_cap
8.9
```
You... | candle/candle-book/src/guide/installation.md/0 | {
"file_path": "candle/candle-book/src/guide/installation.md",
"repo_id": "candle",
"token_count": 487
} | 18 |
mod benchmarks;
use criterion::criterion_main;
criterion_main!(
benchmarks::affine::benches,
benchmarks::matmul::benches,
benchmarks::random::benches,
benchmarks::where_cond::benches,
benchmarks::conv_transpose2d::benches,
benchmarks::qmatmul::benches,
benchmarks::unary::benches
);
| candle/candle-core/benches/bench_main.rs/0 | {
"file_path": "candle/candle-core/benches/bench_main.rs",
"repo_id": "candle",
"token_count": 113
} | 19 |
use crate::{op::BackpropOp, op::Op, Error, Result, Tensor};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParamsConv1D {
pub(crate) b_size: usize,
// Maybe we should have a version without l_in as this bit depends on the input and not only on
// the weights.
pub(crate) l_in: usize,
pub(crate) c... | candle/candle-core/src/conv.rs/0 | {
"file_path": "candle/candle-core/src/conv.rs",
"repo_id": "candle",
"token_count": 5807
} | 20 |
use crate::backend::BackendDevice;
use crate::cpu_backend::CpuDevice;
use crate::{CpuStorage, DType, Result, Shape, Storage, WithDType};
/// A `DeviceLocation` represents a physical device whereas multiple `Device`
/// can live on the same location (typically for cuda devices).
#[derive(Debug, Copy, Clone, PartialEq, ... | candle/candle-core/src/device.rs/0 | {
"file_path": "candle/candle-core/src/device.rs",
"repo_id": "candle",
"token_count": 6082
} | 21 |
use super::{GgmlDType, QStorage};
use crate::quantized::k_quants::GgmlType;
use crate::{backend::BackendDevice, cuda_backend::WrapErr};
use crate::{CudaDevice, CudaStorage, Result};
use half::f16;
use cudarc::driver::{CudaSlice, CudaView, DeviceSlice};
#[derive(Clone, Debug)]
pub struct QCudaStorage {
data: CudaS... | candle/candle-core/src/quantized/cuda.rs/0 | {
"file_path": "candle/candle-core/src/quantized/cuda.rs",
"repo_id": "candle",
"token_count": 13702
} | 22 |
use crate::{Result, Shape, Tensor};
pub trait Dim: crate::shape::Dim + Copy {}
impl<T: crate::shape::Dim + Copy> Dim for T {}
/// A stream tensor is used in streaming module. It can either contain an actual tensor or be
/// empty.
#[derive(Clone)]
pub struct StreamTensor(Option<Tensor>);
impl std::fmt::Debug for Str... | candle/candle-core/src/streaming.rs/0 | {
"file_path": "candle/candle-core/src/streaming.rs",
"repo_id": "candle",
"token_count": 3115
} | 23 |
use candle_core::{test_device, test_utils, Device, IndexOp, Result, Tensor};
// https://github.com/huggingface/candle/issues/364
fn avg_pool2d(dev: &Device) -> Result<()> {
let data: Vec<f32> = vec![
1., 1., 1., 1., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
];
let t = Tensor::from_vec(data, (... | candle/candle-core/tests/pool_tests.rs/0 | {
"file_path": "candle/candle-core/tests/pool_tests.rs",
"repo_id": "candle",
"token_count": 2112
} | 24 |
//! Helper functions for the tinystories dataset. This uses the pre-tokenized version as generated
//! by the tools from https://github.com/karpathy/llama2.c
use candle::{Device, Result, Tensor};
pub struct Dataset {
valid_tokens: Vec<memmap2::Mmap>,
train_tokens: Vec<memmap2::Mmap>,
}
fn mmap_file(p: &std::p... | candle/candle-datasets/src/nlp/tinystories.rs/0 | {
"file_path": "candle/candle-datasets/src/nlp/tinystories.rs",
"repo_id": "candle",
"token_count": 2097
} | 25 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::Parser;
use candle::{DType, Device, Result, Tensor};
use candle_examples::token_output_stream::TokenOutputStream;
use candle_nn::VarBuilder;
use candle_transformers::model... | candle/candle-examples/examples/blip/main.rs/0 | {
"file_path": "candle/candle-examples/examples/blip/main.rs",
"repo_id": "candle",
"token_count": 2436
} | 26 |
// 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
} | 27 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::models::jina_bert::{BertModel, Config, PositionEmbeddingType};
use anyhow::Error as E;
use candle::{DType, Module, Tensor};
use candle_nn::VarBuilder;
use clap::Parser;
#[derive(P... | candle/candle-examples/examples/jina-bert/main.rs/0 | {
"file_path": "candle/candle-examples/examples/jina-bert/main.rs",
"repo_id": "candle",
"token_count": 3414
} | 28 |
# candle-marian-mt
`marian-mt` is a neural machine translation model. In this example it is used to
translate text from French to English. See the associated [model
card](https://huggingface.co/Helsinki-NLP/opus-mt-tc-big-fr-en) for details on
the model itself.
## Running an example
```bash
cargo run --example maria... | candle/candle-examples/examples/marian-mt/README.md/0 | {
"file_path": "candle/candle-examples/examples/marian-mt/README.md",
"repo_id": "candle",
"token_count": 497
} | 29 |
# candle-moondream
[Moondream](https://github.com/vikhyat/moondream) is a computer-vision model can answer real-world questions about images. It's tiny by today's models, with only 1.6B parameters. That enables it to run on a variety of devices, including mobile phones and edge devices.
## Running some examples
First... | candle/candle-examples/examples/moondream/README.md/0 | {
"file_path": "candle/candle-examples/examples/moondream/README.md",
"repo_id": "candle",
"token_count": 367
} | 30 |
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
} | 31 |
#[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/trocr/main.rs/0 | {
"file_path": "candle/candle-examples/examples/trocr/main.rs",
"repo_id": "candle",
"token_count": 2167
} | 32 |
// Copied from https://github.com/ruuda/bs1770/blob/master/src/lib.rs
// BS1770 -- Loudness analysis library conforming to ITU-R BS.1770
// Copyright 2020 Ruud van Asseldonk
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// A copy ... | candle/candle-examples/src/bs1770.rs/0 | {
"file_path": "candle/candle-examples/src/bs1770.rs",
"repo_id": "candle",
"token_count": 7220
} | 33 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
// #include <ATen/cuda/CUDAContext.h>
#include "error.h"
#include "static_switch.h"
#include "flash.h"
#include... | candle/candle-flash-attn/kernels/flash_fwd_launch_template.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash_fwd_launch_template.h",
"repo_id": "candle",
"token_count": 10558
} | 34 |
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/compatibility.cuh");
println!("cargo:rerun-if-changed=src/cuda_utils.cuh");
println!("cargo:rerun-if-changed=src/binary_op_macros.cuh");
let builder = bindgen_cuda::Builder::default();
println!("cargo:... | candle/candle-kernels/build.rs/0 | {
"file_path": "candle/candle-kernels/build.rs",
"repo_id": "candle",
"token_count": 177
} | 35 |
[package]
name = "candle-metal-kernels"
version = "0.6.1"
edition = "2021"
description = "Metal kernels for Candle"
repository = "https://github.com/huggingface/candle"
keywords = ["blas", "tensor", "machine-learning"]
categories = ["science"]
license = "MIT OR Apache-2.0"
[dependencies]
metal = { version = "0.27.0"... | candle/candle-metal-kernels/Cargo.toml/0 | {
"file_path": "candle/candle-metal-kernels/Cargo.toml",
"repo_id": "candle",
"token_count": 218
} | 36 |
use metal::{Buffer, ComputeCommandEncoderRef, ComputePipelineState, MTLSize};
use std::ffi::c_void;
/// Most kernels apply similarly across the tensors
/// This creates a strategy that uses the maximum amount of threads per threadgroup (capped at the
/// actual total buffer length).
/// Then kernels can just do their ... | candle/candle-metal-kernels/src/utils.rs/0 | {
"file_path": "candle/candle-metal-kernels/src/utils.rs",
"repo_id": "candle",
"token_count": 2570
} | 37 |
//! Embedding Layer.
use candle::{Result, Tensor};
#[derive(Clone, Debug)]
pub struct Embedding {
embeddings: Tensor,
hidden_size: usize,
}
impl Embedding {
pub fn new(embeddings: Tensor, hidden_size: usize) -> Self {
Self {
embeddings,
hidden_size,
}
}
pub... | candle/candle-nn/src/embedding.rs/0 | {
"file_path": "candle/candle-nn/src/embedding.rs",
"repo_id": "candle",
"token_count": 571
} | 38 |
use candle::{DType, Device, Result, Shape, Tensor, Var};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
/// A `VarMap` is a store that holds named variables. Variables can be retrieved from the stores
/// and new variables can be added by providing some initialization config in case they are
/// missing.
... | candle/candle-nn/src/var_map.rs/0 | {
"file_path": "candle/candle-nn/src/var_map.rs",
"repo_id": "candle",
"token_count": 1973
} | 39 |
import math
from typing import Any
import candle
from candle import Tensor
from .module import Module
# See https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/linear.py
class Identity(Module):
r"""A placeholder identity operator that is argument-insensitive.
Args:
args: any argument (unu... | candle/candle-pyo3/py_src/candle/nn/linear.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/linear.py",
"repo_id": "candle",
"token_count": 1947
} | 40 |
# See: https://raw.githubusercontent.com/huggingface/tokenizers/main/bindings/python/stub.py
import argparse
import inspect
import os
from typing import Optional
import black
from pathlib import Path
import re
INDENT = " " * 4
GENERATED_COMMENT = "# Generated content DO NOT EDIT\n"
TYPING = """from typing import Any,... | candle/candle-pyo3/stub.py/0 | {
"file_path": "candle/candle-pyo3/stub.py",
"repo_id": "candle",
"token_count": 3931
} | 41 |
use super::with_tracing::{layer_norm, linear, LayerNorm, Linear};
use candle::{DType, Device, Result, Tensor};
use candle_nn::{embedding, Embedding, Module, VarBuilder};
use serde::Deserialize;
pub const DTYPE: DType = DType::F32;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "lowerca... | candle/candle-transformers/src/models/bert.rs/0 | {
"file_path": "candle/candle-transformers/src/models/bert.rs",
"repo_id": "candle",
"token_count": 8444
} | 42 |
use candle::{Result, Tensor, D};
use candle_nn as nn;
use nn::{Module, VarBuilder};
// Based on the Python version from torchvision.
// https://github.com/pytorch/vision/blob/0d75d9e5516f446c9c0ef93bd4ed9fea13992d06/torchvision/models/efficientnet.py#L47
#[derive(Debug, Clone, Copy)]
pub struct MBConvConfig {
expa... | candle/candle-transformers/src/models/efficientnet.rs/0 | {
"file_path": "candle/candle-transformers/src/models/efficientnet.rs",
"repo_id": "candle",
"token_count": 5123
} | 43 |
use candle::{DType, Device, IndexOp, Result, Tensor, D};
use candle_nn::linear_no_bias as linear;
use candle_nn::{embedding, rms_norm, Embedding, Linear, Module, RmsNorm, VarBuilder};
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Config {
pub dim: usize, // transformer dimension
pub ... | candle/candle-transformers/src/models/llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llama2_c.rs",
"repo_id": "candle",
"token_count": 6478
} | 44 |
use super::fastvit;
use super::openclip::text_model;
use candle::{Result, Tensor, D};
use candle_nn::{Func, VarBuilder};
#[derive(Clone, Debug)]
pub struct MobileClipModel {
text_model: text_model::OpenClipTextTransformer,
vision_model: Func<'static>,
text_projection: Tensor,
logit_scale: Tensor,
}
#[... | candle/candle-transformers/src/models/mobileclip.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mobileclip.rs",
"repo_id": "candle",
"token_count": 1310
} | 45 |
use super::llama2_c::{Cache, Config};
use crate::quantized_nn::{linear_no_bias as linear, Embedding, Linear, RmsNorm};
pub use crate::quantized_var_builder::VarBuilder;
use candle::{DType, IndexOp, Module, Result, Tensor, D};
fn silu(xs: &Tensor) -> Result<Tensor> {
xs / (xs.neg()?.exp()? + 1.0)?
}
#[derive(Debug... | candle/candle-transformers/src/models/quantized_llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_llama2_c.rs",
"repo_id": "candle",
"token_count": 4430
} | 46 |
// This implementation is based on the python version from huggingface/transformers.
// https://github.com/huggingface/transformers/blob/b109257f4fb8b1166e7c53cc5418632014ed53a5/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py#L2
use candle::{DType, Device, IndexOp, Module, Result, Tensor, D};
use ca... | candle/candle-transformers/src/models/recurrent_gemma.rs/0 | {
"file_path": "candle/candle-transformers/src/models/recurrent_gemma.rs",
"repo_id": "candle",
"token_count": 11854
} | 47 |
use super::schedulers::{betas_for_alpha_bar, BetaSchedule, PredictionType};
use candle::{Result, Tensor};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DDPMVarianceType {
FixedSmall,
FixedSmallLog,
FixedLarge,
FixedLargeLog,
Learned,
}
impl Default for DDPMVarianceType {
fn default() -> Self... | candle/candle-transformers/src/models/stable_diffusion/ddpm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/ddpm.rs",
"repo_id": "candle",
"token_count": 3662
} | 48 |
use crate::models::with_tracing::QMatMul;
use crate::quantized_var_builder::VarBuilder;
use candle::quantized::QTensor;
use candle::{Module, Result, Tensor};
#[derive(Debug, Clone)]
pub struct Embedding {
inner: candle_nn::Embedding,
span: tracing::Span,
}
impl Embedding {
pub fn new(d1: usize, d2: usize,... | candle/candle-transformers/src/quantized_nn.rs/0 | {
"file_path": "candle/candle-transformers/src/quantized_nn.rs",
"repo_id": "candle",
"token_count": 1623
} | 49 |
//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
} | 50 |
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
} | 51 |
{{- define "name" -}}
{{- default $.Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "app.name" -}}
chat-ui
{{- end -}}
{{- define "labels.standard" -}}
release: {{ $.Release.Name | quote }}
heritage: {{ $.Release.Service | quote }}
chart: "{{ include "name" . }}"
app: "{{ include "app.name" . }}"
... | chat-ui/chart/templates/_helpers.tpl/0 | {
"file_path": "chat-ui/chart/templates/_helpers.tpl",
"repo_id": "chat-ui",
"token_count": 202
} | 52 |
# Anthropic
| Feature | Available |
| --------------------------- | --------- |
| [Tools](../tools) | No |
| [Multimodal](../multimodal) | Yes |
We also support Anthropic models (including multimodal ones via `multmodal: true`) through the official SDK. You may provide your ... | chat-ui/docs/source/configuration/models/providers/anthropic.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/providers/anthropic.md",
"repo_id": "chat-ui",
"token_count": 1541
} | 53 |
# Copy HuggingChat
The config file for HuggingChat is stored in the `chart/env/prod.yaml` file. It is the source of truth for the environment variables used for our CI/CD pipeline. For HuggingChat, as we need to customize the app color, as well as the base path, we build a custom docker image. You can find the workflo... | chat-ui/docs/source/developing/copy-huggingchat.md/0 | {
"file_path": "chat-ui/docs/source/developing/copy-huggingchat.md",
"repo_id": "chat-ui",
"token_count": 870
} | 54 |
import { env } from "$env/dynamic/private";
import { env as envPublic } from "$env/dynamic/public";
import type { Handle, HandleServerError } from "@sveltejs/kit";
import { collections } from "$lib/server/database";
import { base } from "$app/paths";
import { findUser, refreshSessionCookie, requiresUser } from "$lib/se... | chat-ui/src/hooks.server.ts/0 | {
"file_path": "chat-ui/src/hooks.server.ts",
"repo_id": "chat-ui",
"token_count": 3088
} | 55 |
<script lang="ts">
import CarbonEarth from "~icons/carbon/earth";
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
import BIMeta from "~icons/bi/meta";
import type { Model } from "$lib/types/Model";
export let model: Pick<Model, "name" | "datasetName" | "websiteUrl" | "modelUrl" | "datasetUrl">;
e... | chat-ui/src/lib/components/ModelCardMetadata.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ModelCardMetadata.svelte",
"repo_id": "chat-ui",
"token_count": 720
} | 56 |
<script lang="ts">
import { base } from "$app/paths";
import { page } from "$app/stores";
import { clickOutside } from "$lib/actions/clickOutside";
import { useSettingsStore } from "$lib/stores/settings";
import type { ToolFront } from "$lib/types/Tool";
import { isHuggingChat } from "$lib/utils/isHuggingChat";
... | chat-ui/src/lib/components/ToolsMenu.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ToolsMenu.svelte",
"repo_id": "chat-ui",
"token_count": 1987
} | 57 |
<script lang="ts">
export let classNames = "";
</script>
<div class={"inline-flex h-8 flex-none items-center gap-1 " + classNames}>
<div
class="h-1 w-1 flex-none animate-bounce rounded-full bg-gray-500 dark:bg-gray-400"
style="animation-delay: 0.25s;"
/>
<div
class="h-1 w-1 flex-none animate-bounce rounded-f... | chat-ui/src/lib/components/icons/IconLoading.svelte/0 | {
"file_path": "chat-ui/src/lib/components/icons/IconLoading.svelte",
"repo_id": "chat-ui",
"token_count": 223
} | 58 |
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
} | 59 |
import { buildPrompt } from "$lib/buildPrompt";
import { textGenerationStream } from "@huggingface/inference";
import { z } from "zod";
import type { Endpoint } from "../endpoints";
export const endpointAwsParametersSchema = z.object({
weight: z.number().int().positive().default(1),
model: z.any(),
type: z.literal(... | chat-ui/src/lib/server/endpoints/aws/endpointAws.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/aws/endpointAws.ts",
"repo_id": "chat-ui",
"token_count": 695
} | 60 |
import { randomUUID } from "$lib/utils/randomUuid";
import { timeout } from "$lib/utils/timeout";
import { logger } from "./logger";
type ExitHandler = () => void | Promise<void>;
type ExitHandlerUnsubscribe = () => void;
const listeners = new Map<string, ExitHandler>();
export function onExit(cb: ExitHandler): Exit... | chat-ui/src/lib/server/exitHandler.ts/0 | {
"file_path": "chat-ui/src/lib/server/exitHandler.ts",
"repo_id": "chat-ui",
"token_count": 402
} | 61 |
import type { ConfigTool } from "$lib/types/Tool";
import { ObjectId } from "mongodb";
import vm from "node:vm";
const calculator: ConfigTool = {
_id: new ObjectId("00000000000000000000000C"),
type: "config",
description: "Calculate the result of a mathematical expression",
color: "blue",
icon: "code",
displayNa... | chat-ui/src/lib/server/tools/calculator.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/calculator.ts",
"repo_id": "chat-ui",
"token_count": 360
} | 62 |
import type { SerializedHTMLElement } from "../../scrape/types";
import { MarkdownElementType, type MarkdownElement } from "../types";
// --- Markdown Elements ---
/** Converts markdown element to a string with formatting */
export function stringifyMarkdownElement(elem: MarkdownElement): string {
const content = el... | chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts",
"repo_id": "chat-ui",
"token_count": 1149
} | 63 |
import type { WebSearchSource } from "$lib/types/WebSearch";
import type { Message } from "$lib/types/Message";
import type { Assistant } from "$lib/types/Assistant";
import { getWebSearchProvider, searchWeb } from "./endpoints";
import { generateQuery } from "./generateQuery";
import { isURLStringLocal } from "$lib/se... | chat-ui/src/lib/server/websearch/search/search.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/search/search.ts",
"repo_id": "chat-ui",
"token_count": 873
} | 64 |
import type { Timestamps } from "./Timestamps";
export interface ConversationStats extends Timestamps {
date: {
at: Date;
span: "day" | "week" | "month";
field: "updatedAt" | "createdAt";
};
type: "conversation" | "message";
/** _id => number of conversations/messages in the month */
distinct: "sessionId" ... | chat-ui/src/lib/types/ConversationStats.ts/0 | {
"file_path": "chat-ui/src/lib/types/ConversationStats.ts",
"repo_id": "chat-ui",
"token_count": 134
} | 65 |
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
} | 66 |
type Gen<T, TReturn> = AsyncGenerator<T, TReturn, undefined>;
type GenPromiseMap<T, TReturn> = Map<
Gen<T, TReturn>,
Promise<{ gen: Gen<T, TReturn> } & IteratorResult<T, TReturn>>
>;
/** Merges multiple async generators into a single async generator that yields values from all of them in parallel. */
export async f... | chat-ui/src/lib/utils/mergeAsyncGenerators.ts/0 | {
"file_path": "chat-ui/src/lib/utils/mergeAsyncGenerators.ts",
"repo_id": "chat-ui",
"token_count": 407
} | 67 |
import type { Conversation } from "$lib/types/Conversation";
import type { Message } from "$lib/types/Message";
import { v4 } from "uuid";
export function addSibling(
conv: Pick<Conversation, "messages" | "rootMessageId">,
message: Omit<Message, "id">,
siblingId: Message["id"]
): Message["id"] {
if (conv.messages.... | chat-ui/src/lib/utils/tree/addSibling.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/addSibling.ts",
"repo_id": "chat-ui",
"token_count": 439
} | 68 |
import { collections } from "$lib/server/database";
import { authCondition } from "$lib/server/auth";
import { z } from "zod";
import { models } from "$lib/server/models";
import { ObjectId } from "mongodb";
export async function GET({ locals, params }) {
const id = z.string().parse(params.id);
const convId = new Ob... | chat-ui/src/routes/api/conversation/[id]/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/conversation/[id]/+server.ts",
"repo_id": "chat-ui",
"token_count": 478
} | 69 |
<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": 4710
} | 70 |
<script lang="ts">
import { page } from "$app/stores";
import { base } from "$app/paths";
import { goto } from "$app/navigation";
import { onMount } from "svelte";
import { env as envPublic } from "$env/dynamic/public";
import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
import { findCurrentModel } ... | chat-ui/src/routes/models/[...model]/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/models/[...model]/+page.svelte",
"repo_id": "chat-ui",
"token_count": 1103
} | 71 |
<script lang="ts">
import type { PageData, ActionData } from "./$types";
import { page } from "$app/stores";
import AssistantSettings from "$lib/components/AssistantSettings.svelte";
export let data: PageData;
export let form: ActionData;
let assistant = data.assistants.find((el) => el._id.toString() === $page.... | chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/edit/+page@settings.svelte/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/edit/+page@settings.svelte",
"repo_id": "chat-ui",
"token_count": 129
} | 72 |
import { authCondition, requiresUser } from "$lib/server/auth.js";
import { collections } from "$lib/server/database.js";
import { editableToolSchema } from "$lib/server/tools/index.js";
import { usageLimits } from "$lib/server/usageLimits.js";
import { generateSearchTokens } from "$lib/utils/searchTokens.js";
import {... | chat-ui/src/routes/tools/new/+page.server.ts/0 | {
"file_path": "chat-ui/src/routes/tools/new/+page.server.ts",
"repo_id": "chat-ui",
"token_count": 835
} | 73 |
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
... | datasets/.dvc/plots/smooth.json/0 | {
"file_path": "datasets/.dvc/plots/smooth.json",
"repo_id": "datasets",
"token_count": 569
} | 74 |
# How to contribute to Datasets?
[](CODE_OF_CONDUCT.md)
Datasets is an open source project, so all contributions and suggestions are welcome.
You can contribute in many different ways: giving ideas, answering questions, reporti... | datasets/CONTRIBUTING.md/0 | {
"file_path": "datasets/CONTRIBUTING.md",
"repo_id": "datasets",
"token_count": 1715
} | 75 |
# Process audio data
This guide shows specific methods for processing audio datasets. Learn how to:
- Resample the sampling rate.
- Use [`~Dataset.map`] with audio datasets.
For a guide on how to process any type of dataset, take a look at the <a class="underline decoration-sky-400 decoration-2 font-semibold" href="... | datasets/docs/source/audio_process.mdx/0 | {
"file_path": "datasets/docs/source/audio_process.mdx",
"repo_id": "datasets",
"token_count": 1186
} | 76 |
# Datasets
<img class="float-left !m-0 !border-0 !dark:border-0 !shadow-none !max-w-lg w-[150px]" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/datasets/datasets_logo.png"/>
🤗 Datasets is a library for easily accessing and sharing datasets for Audio, Computer Vision, and Natural ... | datasets/docs/source/index.mdx/0 | {
"file_path": "datasets/docs/source/index.mdx",
"repo_id": "datasets",
"token_count": 1014
} | 77 |
# Share a dataset using the CLI
At Hugging Face, we are on a mission to democratize good Machine Learning and we believe in the value of open source. That's why we designed 🤗 Datasets so that anyone can share a dataset with the greater ML community. There are currently thousands of datasets in over 100 languages in t... | datasets/docs/source/share.mdx/0 | {
"file_path": "datasets/docs/source/share.mdx",
"repo_id": "datasets",
"token_count": 2919
} | 78 |
__all__ = [
"DownloadConfig",
"DownloadManager",
"DownloadMode",
"StreamingDownloadManager",
]
from .download_config import DownloadConfig
from .download_manager import DownloadManager, DownloadMode
from .streaming_download_manager import StreamingDownloadManager
| datasets/src/datasets/download/__init__.py/0 | {
"file_path": "datasets/src/datasets/download/__init__.py",
"repo_id": "datasets",
"token_count": 77
} | 79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.