text stringlengths 7 324k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 463 |
|---|---|---|---|
# 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_tokenization_common.py/0 | {
"file_path": "transformers/tests/test_tokenization_common.py",
"repo_id": "transformers",
"token_count": 106541
} | 437 |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/tools/test_text_to_speech.py/0 | {
"file_path": "transformers/tests/tools/test_text_to_speech.py",
"repo_id": "transformers",
"token_count": 745
} | 438 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/utils/test_backbone_utils.py/0 | {
"file_path": "transformers/tests/utils/test_backbone_utils.py",
"repo_id": "transformers",
"token_count": 4934
} | 439 |
# 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
} | 440 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/check_support_list.py/0 | {
"file_path": "transformers/utils/check_support_list.py",
"repo_id": "transformers",
"token_count": 1443
} | 441 |
import argparse
import os
past_versions_testing = {
"pytorch": {
"1.13": {
"torch": "1.13.1",
"torchvision": "0.14.1",
"torchaudio": "0.13.1",
"python": 3.9,
"cuda": "cu116",
"install": (
"python3 -m pip install --no-c... | transformers/utils/past_ci_versions.py/0 | {
"file_path": "transformers/utils/past_ci_versions.py",
"repo_id": "transformers",
"token_count": 2774
} | 442 |
{
"opsets": {
"1": [
"Abs",
"Add",
"AddV2",
"ArgMax",
"ArgMin",
"AvgPool",
"AvgPool3D",
"BatchMatMul",
"BatchMatMulV2",
"BatchToSpaceND",
"BiasAdd",
"BiasAddV1",
... | transformers/utils/tf_ops/onnx.json/0 | {
"file_path": "transformers/utils/tf_ops/onnx.json",
"repo_id": "transformers",
"token_count": 4081
} | 443 |
.PHONY: test precommit benchmark_core benchmark_aux common_tests slow_tests test_examples tests_gpu
check_dirs := examples tests trl
ACCELERATE_CONFIG_PATH = `pwd`/examples/accelerate_configs
COMMAND_FILES_PATH = `pwd`/commands
test:
python -m pytest -n auto --dist=loadfile -s -v ./tests/
precommit:
pre-commit ru... | trl/Makefile/0 | {
"file_path": "trl/Makefile",
"repo_id": "trl",
"token_count": 452
} | 444 |
# Logging
As reinforcement learning algorithms are historically challenging to debug, it's important to pay careful attention to logging.
By default, the TRL [`PPOTrainer`] saves a lot of relevant information to `wandb` or `tensorboard`.
Upon initialization, pass one of these two options to the [`PPOConfig`]:
```
con... | trl/docs/source/logging.mdx/0 | {
"file_path": "trl/docs/source/logging.mdx",
"repo_id": "trl",
"token_count": 1961
} | 445 |
import argparse
import os
from accelerate import Accelerator
from datasets import load_dataset
from peft import LoraConfig
from tqdm import tqdm
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, logging, set_seed
from trl import SFTTrainer
from trl.trainer import ConstantLengthDataset
... | trl/examples/research_projects/stack_llama/scripts/supervised_finetuning.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/supervised_finetuning.py",
"repo_id": "trl",
"token_count": 2908
} | 446 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | trl/examples/scripts/reward_modeling.py/0 | {
"file_path": "trl/examples/scripts/reward_modeling.py",
"repo_id": "trl",
"token_count": 1819
} | 447 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | trl/tests/test_data_collator_completion_only.py/0 | {
"file_path": "trl/tests/test_data_collator_completion_only.py",
"repo_id": "trl",
"token_count": 1973
} | 448 |
# flake8: noqa
__version__ = "0.7.12.dev0"
from .core import set_seed
from .environment import TextEnvironment, TextHistory
from .extras import BestOfNSampler
from .import_utils import (
is_bitsandbytes_available,
is_diffusers_available,
is_npu_available,
is_peft_available,
is_wandb_available,
... | trl/trl/__init__.py/0 | {
"file_path": "trl/trl/__init__.py",
"repo_id": "trl",
"token_count": 451
} | 449 |
import os
import sys
import warnings
from dataclasses import dataclass, field
from typing import Literal, Optional
from ..core import flatten_dict
from ..import_utils import is_bitsandbytes_available, is_torchvision_available
@dataclass
class DDPOConfig:
"""
Configuration class for DDPOTrainer
"""
#... | trl/trl/trainer/ddpo_config.py/0 | {
"file_path": "trl/trl/trainer/ddpo_config.py",
"repo_id": "trl",
"token_count": 1776
} | 450 |
# Builds GPU docker image of PyTorch specifically
# Uses multi-staged approach to reduce size
# Stage 1
# Use base conda image to reduce time
FROM continuumio/miniconda3:latest AS compile-image
# Specify py version
ENV PYTHON_VERSION=3.9
# Install apt libs
RUN apt-get update && \
apt-get install -y curl git wget &&... | accelerate/docker/accelerate-gpu/Dockerfile/0 | {
"file_path": "accelerate/docker/accelerate-gpu/Dockerfile",
"repo_id": "accelerate",
"token_count": 539
} | 0 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/concept_guides/low_precision_training.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/low_precision_training.md",
"repo_id": "accelerate",
"token_count": 1466
} | 1 |
<!--Copyright 2021 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/package_reference/state.md/0 | {
"file_path": "accelerate/docs/source/package_reference/state.md",
"repo_id": "accelerate",
"token_count": 291
} | 2 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/usage_guides/model_size_estimator.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/model_size_estimator.md",
"repo_id": "accelerate",
"token_count": 2030
} | 3 |
# Copyright 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": 10893
} | 4 |
# 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
} | 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/src/accelerate/scheduler.py/0 | {
"file_path": "accelerate/src/accelerate/scheduler.py",
"repo_id": "accelerate",
"token_count": 1577
} | 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/test_utils/scripts/test_sync.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_sync.py",
"repo_id": "accelerate",
"token_count": 7702
} | 7 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/utils/offload.py/0 | {
"file_path": "accelerate/src/accelerate/utils/offload.py",
"repo_id": "accelerate",
"token_count": 3177
} | 8 |
compute_environment: LOCAL_MACHINE
deepspeed_config: {}
distributed_type: 'NO'
fsdp_config: {}
machine_rank: 0
main_process_ip: null
main_process_port: null
main_training_function: main
mixed_precision: 'no'
num_machines: 1
num_processes: 1
use_cpu: false | accelerate/tests/test_configs/0_11_0.yaml/0 | {
"file_path": "accelerate/tests/test_configs/0_11_0.yaml",
"repo_id": "accelerate",
"token_count": 95
} | 9 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/tests/test_offload.py/0 | {
"file_path": "accelerate/tests/test_offload.py",
"repo_id": "accelerate",
"token_count": 1981
} | 10 |
#!/bin/bash
#SBATCH --ntasks-per-node=1
#SBATCH --exclusive
#SBATCH --gres=gpu:8
#SBATCH --partition=hopper-prod # Adjust this for your cluster
#SBATCH --output=/fsx/h4/logs/%x-%j.out # Adjust this for your cluster
#SBATCH --err=/fsx/h4/logs/%x-%j.err # Adjust this for your cluster
set -x -e
source ~/.bashrc
cond... | alignment-handbook/recipes/launch.slurm/0 | {
"file_path": "alignment-handbook/recipes/launch.slurm",
"repo_id": "alignment-handbook",
"token_count": 1135
} | 11 |
# Scripts to Train and Evaluate Chat Models
## Fine-tuning
In the handbook, we provide three main ways to align LLMs for chat:
- Full fine-tuning on a multi-GPU machine with DeepSpeed ZeRO-3 (tested on an 8 x A100 (80GB) node).
- LoRA or QLoRA fine-tuning on a single consumer 24GB GPU (tested on an RTX 4090).
- LoR... | alignment-handbook/scripts/README.md/0 | {
"file_path": "alignment-handbook/scripts/README.md",
"repo_id": "alignment-handbook",
"token_count": 2967
} | 12 |
# coding=utf-8
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | alignment-handbook/tests/test_data.py/0 | {
"file_path": "alignment-handbook/tests/test_data.py",
"repo_id": "alignment-handbook",
"token_count": 4201
} | 13 |
# Hello world!
We will now create the hello world of the ML world, building a model capable of solving MNIST dataset.
Open `src/main.rs` and fill in this content:
```rust
# extern crate candle_core;
use candle_core::{Device, Result, Tensor};
struct Model {
first: Tensor,
second: Tensor,
}
impl Model {
... | candle/candle-book/src/guide/hello_world.md/0 | {
"file_path": "candle/candle-book/src/guide/hello_world.md",
"repo_id": "candle",
"token_count": 2069
} | 14 |
# candle
Minimalist ML framework for Rust
| candle/candle-core/README.md/0 | {
"file_path": "candle/candle-core/README.md",
"repo_id": "candle",
"token_count": 11
} | 15 |
use super::{Cpu, CpuF16};
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
use half::f16;
pub struct CurrentCpu {}
const STEP: usize = 32;
const EPR: usize = 8;
const ARR: usize = STEP / EPR;
impl Cpu<ARR> for CurrentCpu {
type Unit = __m256;
type... | candle/candle-core/src/cpu/avx.rs/0 | {
"file_path": "candle/candle-core/src/cpu/avx.rs",
"repo_id": "candle",
"token_count": 2094
} | 16 |
use crate::{Error, Result, Shape};
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Layout {
shape: Shape,
// The strides are given in number of elements and not in bytes.
stride: Vec<usize>,
start_offset: usize,
}
impl Layout {
pub fn new(shape: Shape, stride: Vec<usize>, start_offset: usize) ->... | candle/candle-core/src/layout.rs/0 | {
"file_path": "candle/candle-core/src/layout.rs",
"repo_id": "candle",
"token_count": 4349
} | 17 |
use super::k_quants::{
BlockQ2K, BlockQ3K, BlockQ4K, BlockQ4_0, BlockQ5K, BlockQ6K, BlockQ8K, BlockQ8_0, QK8_0, QK_K,
};
use crate::Result;
use byteorder::{ByteOrder, LittleEndian};
#[allow(unused_imports)]
#[cfg(target_arch = "arm")]
use core::arch::arm::*;
#[allow(unused_imports)]
#[cfg(target_arch = "aarch64")... | candle/candle-core/src/quantized/neon.rs/0 | {
"file_path": "candle/candle-core/src/quantized/neon.rs",
"repo_id": "candle",
"token_count": 15290
} | 18 |
use anyhow::{Context, Result};
use candle_core::{test_device, test_utils, Device, Shape, Tensor, Var};
fn simple_grad(device: &Device) -> Result<()> {
let x = Var::new(&[3f32, 1., 4.], device)?;
let x = x.as_tensor();
let y = (((x * x)? + x * 5f64)? + 4f64)?;
let grads = y.backward()?;
let grad_x =... | candle/candle-core/tests/grad_tests.rs/0 | {
"file_path": "candle/candle-core/tests/grad_tests.rs",
"repo_id": "candle",
"token_count": 9094
} | 19 |
use candle::{Result, Tensor};
pub struct Batcher<I> {
inner: I,
batch_size: usize,
return_last_incomplete_batch: bool,
}
impl<I> Batcher<I> {
fn new(inner: I) -> Self {
Self {
inner,
batch_size: 16,
return_last_incomplete_batch: false,
}
}
p... | candle/candle-datasets/src/batcher.rs/0 | {
"file_path": "candle/candle-datasets/src/batcher.rs",
"repo_id": "candle",
"token_count": 2660
} | 20 |
#[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": 2437
} | 21 |
# candle-endocec
[EnCodec](https://huggingface.co/facebook/encodec_24khz) is a high-quality audio
compression model using an encoder/decoder architecture with residual vector
quantization.
## Running one example
```bash
cargo run --example encodec --features symphonia --release -- code-to-audio \
candle-examples... | candle/candle-examples/examples/encodec/README.md/0 | {
"file_path": "candle/candle-examples/examples/encodec/README.md",
"repo_id": "candle",
"token_count": 255
} | 22 |
/// This follows the lines of:
/// https://github.com/johnma2006/mamba-minimal/blob/master/model.py
/// Simple, minimal implementation of Mamba in one file of PyTorch.
use candle::{IndexOp, Module, Result, Tensor, D};
use candle_nn::{RmsNorm, VarBuilder};
use candle_transformers::models::with_tracing::{linear, linear_... | candle/candle-examples/examples/mamba-minimal/model.rs/0 | {
"file_path": "candle/candle-examples/examples/mamba-minimal/model.rs",
"repo_id": "candle",
"token_count": 3488
} | 23 |
use candle::{DType, Device, Result, Tensor, D};
use candle_nn::{
embedding, layer_norm, linear_no_bias, Activation, Embedding, LayerNorm, Linear, Module,
VarBuilder,
};
use candle_transformers::models::{encodec, t5};
// https://github.com/huggingface/transformers/blob/cd4584e3c809bb9e1392ccd3fe38b40daba5519a/s... | candle/candle-examples/examples/musicgen/musicgen_model.rs/0 | {
"file_path": "candle/candle-examples/examples/musicgen/musicgen_model.rs",
"repo_id": "candle",
"token_count": 7592
} | 24 |
#![allow(unused)]
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::Result;
use clap::{Parser, Subcommand};
mod gym_env;
mod vec_gym_env;
mod ddpg;
mod policy_gradient;
#[derive(Parser)]
struct Args {
#[command(subcommand)]
command:... | candle/candle-examples/examples/reinforcement-learning/main.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/main.rs",
"repo_id": "candle",
"token_count": 252
} | 25 |
# candle-trocr
`TrOCR` is a transformer OCR Model. In this example it is used to
transcribe image text. See the associated [model
card](https://huggingface.co/microsoft/trocr-base-printed) for details on
the model itself.
Supported models include:
- `--which base`: small handwritten OCR model.
- `--which large`: lar... | candle/candle-examples/examples/trocr/readme.md/0 | {
"file_path": "candle/candle-examples/examples/trocr/readme.md",
"repo_id": "candle",
"token_count": 360
} | 26 |
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use candle_transformers::models::stable_diffusion;
use candle_transformers::models::wuerstchen;
use anyhow::{Error as E, Result};
use candle::{DType, Device, IndexOp, Tensor};
use clap::Parser;
use tokeniz... | candle/candle-examples/examples/wuerstchen/main.rs/0 | {
"file_path": "candle/candle-examples/examples/wuerstchen/main.rs",
"repo_id": "candle",
"token_count": 6372
} | 27 |
use candle::{Device, Result, Tensor};
/// Loads an image from disk using the image crate, this returns a tensor with shape
/// (3, 224, 224). imagenet normalization is applied.
pub fn load_image224<P: AsRef<std::path::Path>>(p: P) -> Result<Tensor> {
let img = image::io::Reader::open(p)?
.decode()
... | candle/candle-examples/src/imagenet.rs/0 | {
"file_path": "candle/candle-examples/src/imagenet.rs",
"repo_id": "candle",
"token_count": 12586
} | 28 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
#include <cmath>
#include <cute/tensor.hpp>
#include <cutlass/numeric_types.h>
#include "philox.cuh"
#include... | candle/candle-flash-attn/kernels/softmax.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/softmax.h",
"repo_id": "candle",
"token_count": 7224
} | 29 |
#include<stdint.h>
#include "cuda_fp16.h"
template<typename T>
__device__ void fill_with(T *buf, T value, const size_t numel) {
for (unsigned int i = blockIdx.x * blockDim.x + threadIdx.x; i < numel; i += blockDim.x * gridDim.x) {
buf[i] = value;
}
}
extern "C" __global__ void fill_u8(uint8_t *buf, uin... | candle/candle-kernels/src/fill.cu/0 | {
"file_path": "candle/candle-kernels/src/fill.cu",
"repo_id": "candle",
"token_count": 472
} | 30 |
#include <metal_stdlib>
using namespace metal;
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define SWAP(x, y) { auto tmp = (x); (x) = (y); (y) = tmp; }
#define QK4_0 32
#define QR4_0 2
typedef struct {
half d; // delta
uint8_t qs[QK4_0 / 2]; // nibbles /... | candle/candle-metal-kernels/src/quantized.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/quantized.metal",
"repo_id": "candle",
"token_count": 97268
} | 31 |
//! Convolution Layers.
use crate::BatchNorm;
use candle::{Result, Tensor};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Conv1dConfig {
pub padding: usize,
pub stride: usize,
pub dilation: usize,
pub groups: usize,
}
impl Default for Conv1dConfig {
fn default() -> Self {
Self {
... | candle/candle-nn/src/conv.rs/0 | {
"file_path": "candle/candle-nn/src/conv.rs",
"repo_id": "candle",
"token_count": 5891
} | 32 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use candle::{test_utils, DType, Device, Tensor};
use candle_nn::BatchNorm;
/* The test below has been generated using the following PyTorch code:
import torch
torch.manual_seed(19551105... | candle/candle-nn/tests/batch_norm.rs/0 | {
"file_path": "candle/candle-nn/tests/batch_norm.rs",
"repo_id": "candle",
"token_count": 2474
} | 33 |
[package]
name = "candle-pyo3"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
readme = "README.md"
[lib]
name = "candle"
crate-type = ["cdylib"]
[dependencies]
accelerate-src = { ... | candle/candle-pyo3/Cargo.toml/0 | {
"file_path": "candle/candle-pyo3/Cargo.toml",
"repo_id": "candle",
"token_count": 315
} | 34 |
import candle
from candle import Tensor
from .module import Module
from typing import Union, List, Tuple, Optional, Any
_shape_t = Union[int, List[int]]
import numbers
class LayerNorm(Module):
r"""Applies Layer Normalization over a mini-batch of inputs as described in
the paper `Layer Normalization <https://... | candle/candle-pyo3/py_src/candle/nn/normalization.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/normalization.py",
"repo_id": "candle",
"token_count": 803
} | 35 |
import candle
import torch
# convert from candle tensor to torch tensor
t = candle.randn((3, 512, 512))
torch_tensor = t.to_torch()
print(torch_tensor)
print(type(torch_tensor))
# convert from torch tensor to candle tensor
t = torch.randn((3, 512, 512))
candle_tensor = candle.Tensor(t)
print(candle_tensor)
print(type... | candle/candle-pyo3/test_pytorch.py/0 | {
"file_path": "candle/candle-pyo3/test_pytorch.py",
"repo_id": "candle",
"token_count": 126
} | 36 |
use crate::models::with_tracing::{linear_b as linear, Linear};
use candle::{DType, Device, IndexOp, Module, Result, Tensor, D};
use candle_nn::VarBuilder;
#[derive(Debug, Clone)]
pub struct Config {
pub num_layers: usize,
pub padded_vocab_size: usize,
pub hidden_size: usize,
pub ffn_hidden_size: usize,... | candle/candle-transformers/src/models/chatglm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/chatglm.rs",
"repo_id": "candle",
"token_count": 10342
} | 37 |
use candle::{DType, Device, Error as E, IndexOp, Module, Result, Tensor, D};
use candle_nn::{embedding, linear_b, rms_norm, Embedding, Linear, RmsNorm, VarBuilder};
// Equivalent to torch.repeat_interleave
pub(crate) fn repeat_interleave(img: &Tensor, repeats: usize, dim: usize) -> Result<Tensor> {
let img = img.u... | candle/candle-transformers/src/models/metavoice.rs/0 | {
"file_path": "candle/candle-transformers/src/models/metavoice.rs",
"repo_id": "candle",
"token_count": 21694
} | 38 |
use crate::quantized_nn::{layer_norm_no_bias, linear_no_bias, Embedding, Linear};
pub use crate::quantized_var_builder::VarBuilder;
/// MPT model used by replit-code-v1_5-3b
/// https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/modeling_mpt.py
use candle::{IndexOp, Module, Result, Tensor, D};
use candle_nn::L... | candle/candle-transformers/src/models/quantized_mpt.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_mpt.rs",
"repo_id": "candle",
"token_count": 3728
} | 39 |
// Adapted from:
// https://github.com/ChaoningZhang/MobileSAM/blob/master/mobile_sam/modeling/tiny_vit_sam.py
use candle::{IndexOp, Result, Tensor, D};
use candle_nn::{Conv2dConfig, Module, VarBuilder};
const MBCONV_EXPAND_RATIO: usize = 4;
const MLP_RATIO: usize = 4;
const LOCAL_CONV_SIZE: usize = 3;
const IMG_SIZE:... | candle/candle-transformers/src/models/segment_anything/tiny_vit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/segment_anything/tiny_vit.rs",
"repo_id": "candle",
"token_count": 10372
} | 40 |
#![allow(unused)]
use candle::{DType, Device, Module, Result, Tensor, D};
use candle_nn::{layer_norm, linear_b, LayerNorm, Linear, VarBuilder};
use std::sync::Arc;
#[derive(Debug, Clone, serde::Deserialize)]
pub struct Config {
vocab_size: usize,
hidden_size: usize,
intermediate_size: usize,
num_hidden... | candle/candle-transformers/src/models/starcoder2.rs/0 | {
"file_path": "candle/candle-transformers/src/models/starcoder2.rs",
"repo_id": "candle",
"token_count": 6129
} | 41 |
use super::common::{AttnBlock, ResBlock, TimestepBlock};
use candle::{DType, Result, Tensor, D};
use candle_nn::VarBuilder;
#[derive(Debug)]
struct Block {
res_block: ResBlock,
ts_block: TimestepBlock,
attn_block: AttnBlock,
}
#[derive(Debug)]
pub struct WPrior {
projection: candle_nn::Conv2d,
con... | candle/candle-transformers/src/models/wuerstchen/prior.rs/0 | {
"file_path": "candle/candle-transformers/src/models/wuerstchen/prior.rs",
"repo_id": "candle",
"token_count": 1920
} | 42 |
export async function getEmbeddings(
worker,
weightsURL,
tokenizerURL,
configURL,
modelID,
sentences,
updateStatus = null
) {
return new Promise((resolve, reject) => {
worker.postMessage({
weightsURL,
tokenizerURL,
configURL,
modelID,
sentences,
});
function mes... | candle/candle-wasm-examples/bert/utils.js/0 | {
"file_path": "candle/candle-wasm-examples/bert/utils.js",
"repo_id": "candle",
"token_count": 1250
} | 43 |
fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
console_error_panic_hook::set_once();
yew::Renderer::<candle_wasm_example_llama2::App>::new().render();
}
| candle/candle-wasm-examples/llama2-c/src/bin/app.rs/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/src/bin/app.rs",
"repo_id": "candle",
"token_count": 83
} | 44 |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle Segment Anything Model (SAM) Rust/WASM</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1... | candle/candle-wasm-examples/segment-anything/lib-example.html/0 | {
"file_path": "candle/candle-wasm-examples/segment-anything/lib-example.html",
"repo_id": "candle",
"token_count": 10333
} | 45 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to Candle!</title>
<link data-trunk rel="copy-file" href="yolov8s.safetensors" />
<link data-trunk rel="copy-file" href="bike.jpeg" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
... | candle/candle-wasm-examples/yolo/index.html/0 | {
"file_path": "candle/candle-wasm-examples/yolo/index.html",
"repo_id": "candle",
"token_count": 322
} | 46 |
backend-test:J
xytest"Relu
SingleReluZ
x
b
y
B | candle/test.onnx/0 | {
"file_path": "candle/test.onnx",
"repo_id": "candle",
"token_count": 76
} | 47 |
---
title: chat-ui
emoji: 🔥
colorFrom: purple
colorTo: purple
sdk: docker
pinned: false
license: apache-2.0
base_path: /chat
app_port: 3000
failure_strategy: rollback
---
# Chat UI

A c... | chat-ui/README.md/0 | {
"file_path": "chat-ui/README.md",
"repo_id": "chat-ui",
"token_count": 8700
} | 48 |
<script lang="ts">
import type { readAndCompressImage } from "browser-image-resizer";
import type { Model } from "$lib/types/Model";
import type { Assistant } from "$lib/types/Assistant";
import { onMount } from "svelte";
import { applyAction, enhance } from "$app/forms";
import { base } from "$app/paths";
impo... | chat-ui/src/lib/components/AssistantSettings.svelte/0 | {
"file_path": "chat-ui/src/lib/components/AssistantSettings.svelte",
"repo_id": "chat-ui",
"token_count": 3699
} | 49 |
<script lang="ts">
import CarbonRotate360 from "~icons/carbon/rotate-360";
export let classNames = "";
</script>
<button
type="button"
on:click
class="btn flex h-8 rounded-lg border bg-white px-3 py-1 text-gray-500 shadow-sm transition-all hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-30... | chat-ui/src/lib/components/RetryBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/RetryBtn.svelte",
"repo_id": "chat-ui",
"token_count": 157
} | 50 |
<script lang="ts">
export let classNames = "";
</script>
<svg
class={classNames}
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
fill="currentColor"
focusable="false"
role="img"
width="1em"
height="1em"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 32 32"
>
<path
d="M28,10V28H10V10H28m0-2H10a2,2... | chat-ui/src/lib/components/icons/IconCopy.svelte/0 | {
"file_path": "chat-ui/src/lib/components/icons/IconCopy.svelte",
"repo_id": "chat-ui",
"token_count": 299
} | 51 |
import { z } from "zod";
import {
embeddingEndpointTei,
embeddingEndpointTeiParametersSchema,
} from "./tei/embeddingEndpoints";
import {
embeddingEndpointTransformersJS,
embeddingEndpointTransformersJSParametersSchema,
} from "./transformersjs/embeddingEndpoints";
import {
embeddingEndpointOpenAI,
embeddingEndpo... | chat-ui/src/lib/server/embeddingEndpoints/embeddingEndpoints.ts/0 | {
"file_path": "chat-ui/src/lib/server/embeddingEndpoints/embeddingEndpoints.ts",
"repo_id": "chat-ui",
"token_count": 478
} | 52 |
import {
HF_TOKEN,
HF_API_ROOT,
MODELS,
OLD_MODELS,
TASK_MODEL,
HF_ACCESS_TOKEN,
} from "$env/static/private";
import type { ChatTemplateInput } from "$lib/types/Template";
import { compileTemplate } from "$lib/utils/template";
import { z } from "zod";
import endpoints, { endpointSchema, type Endpoint } from "./e... | chat-ui/src/lib/server/models.ts/0 | {
"file_path": "chat-ui/src/lib/server/models.ts",
"repo_id": "chat-ui",
"token_count": 2057
} | 53 |
import { browser } from "$app/environment";
import { invalidate } from "$app/navigation";
import { base } from "$app/paths";
import { UrlDependency } from "$lib/types/UrlDependency";
import type { ObjectId } from "mongodb";
import { getContext, setContext } from "svelte";
import { type Writable, writable, get } from "s... | chat-ui/src/lib/stores/settings.ts/0 | {
"file_path": "chat-ui/src/lib/stores/settings.ts",
"repo_id": "chat-ui",
"token_count": 983
} | 54 |
import type { ObjectId } from "bson";
import type { Timestamps } from "./Timestamps";
import type { User } from "./User";
export interface Session extends Timestamps {
_id: ObjectId;
sessionId: string;
userId: User["_id"];
userAgent?: string;
ip?: string;
expiresAt: Date;
}
| chat-ui/src/lib/types/Session.ts/0 | {
"file_path": "chat-ui/src/lib/types/Session.ts",
"repo_id": "chat-ui",
"token_count": 97
} | 55 |
export function getHref(
url: URL | string,
modifications: {
newKeys?: Record<string, string | undefined | null>;
existingKeys?: { behaviour: "delete_except" | "delete"; keys: string[] };
}
) {
const newUrl = new URL(url);
const { newKeys, existingKeys } = modifications;
// exsiting keys logic
if (existingK... | chat-ui/src/lib/utils/getHref.ts/0 | {
"file_path": "chat-ui/src/lib/utils/getHref.ts",
"repo_id": "chat-ui",
"token_count": 373
} | 56 |
import type { Conversation } from "$lib/types/Conversation";
import type { Message } from "$lib/types/Message";
import { v4 } from "uuid";
export function addChildren(
conv: Pick<Conversation, "messages" | "rootMessageId">,
message: Omit<Message, "id">,
parentId?: Message["id"]
): Message["id"] {
// if this is the... | chat-ui/src/lib/utils/tree/addChildren.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/addChildren.ts",
"repo_id": "chat-ui",
"token_count": 501
} | 57 |
import { collections } from "$lib/server/database";
import { authCondition } from "$lib/server/auth";
import { z } from "zod";
import { ObjectId } from "mongodb";
export async function GET({ locals, params }) {
const id = z.string().parse(params.id);
const convId = new ObjectId(id);
if (locals.user?._id || locals.... | 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": 396
} | 58 |
import { authCondition } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
import { z } from "zod";
import type { RequestHandler } from "./$types";
import { downloadFile } from "$lib/server/files/downloadFile";
export... | chat-ui/src/routes/conversation/[id]/output/[sha256]/+server.ts/0 | {
"file_path": "chat-ui/src/routes/conversation/[id]/output/[sha256]/+server.ts",
"repo_id": "chat-ui",
"token_count": 439
} | 59 |
<script lang="ts">
import { onMount } from "svelte";
import { base } from "$app/paths";
import { afterNavigate, goto } from "$app/navigation";
import { page } from "$app/stores";
import { useSettingsStore } from "$lib/stores/settings";
import CarbonClose from "~icons/carbon/close";
import CarbonArrowUpRight from... | chat-ui/src/routes/settings/(nav)/+layout.svelte/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/+layout.svelte",
"repo_id": "chat-ui",
"token_count": 2052
} | 60 |
@import "highlight.js/styles/atom-one-dark";
| chat-ui/src/styles/highlight-js.css/0 | {
"file_path": "chat-ui/src/styles/highlight-js.css",
"repo_id": "chat-ui",
"token_count": 17
} | 61 |
const defaultTheme = require("tailwindcss/defaultTheme");
const colors = require("tailwindcss/colors");
import dotenv from "dotenv";
dotenv.config({ path: "./.env" });
/** @type {import('tailwindcss').Config} */
export default {
darkMode: "class",
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {
... | chat-ui/tailwind.config.cjs/0 | {
"file_path": "chat-ui/tailwind.config.cjs",
"repo_id": "chat-ui",
"token_count": 276
} | 62 |
import json
import os
import tempfile
import datasets
from utils import generate_example_dataset, get_duration
SPEED_TEST_N_EXAMPLES = 500_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))
@get_d... | datasets/benchmarks/benchmark_indices_mapping.py/0 | {
"file_path": "datasets/benchmarks/benchmark_indices_mapping.py",
"repo_id": "datasets",
"token_count": 677
} | 63 |
# The cache
The cache is one of the reasons why 🤗 Datasets is so efficient. It stores previously downloaded and processed datasets so when you need to use them again, they are reloaded directly from the cache. This avoids having to download a dataset all over again, or reapplying processing functions. Even after you ... | datasets/docs/source/about_cache.mdx/0 | {
"file_path": "datasets/docs/source/about_cache.mdx",
"repo_id": "datasets",
"token_count": 909
} | 64 |
# Search index
[FAISS](https://github.com/facebookresearch/faiss) and [Elasticsearch](https://www.elastic.co/elasticsearch/) enables searching for examples in a dataset. This can be useful when you want to retrieve specific examples from a dataset that are relevant to your NLP task. For example, if you are working on ... | datasets/docs/source/faiss_es.mdx/0 | {
"file_path": "datasets/docs/source/faiss_es.mdx",
"repo_id": "datasets",
"token_count": 1830
} | 65 |
# Process text data
This guide shows specific methods for processing text datasets. Learn how to:
- Tokenize a dataset with [`~Dataset.map`].
- Align dataset labels with label ids for NLI datasets.
For a guide on how to process any type of dataset, take a look at the <a class="underline decoration-sky-400 decoration... | datasets/docs/source/nlp_process.mdx/0 | {
"file_path": "datasets/docs/source/nlp_process.mdx",
"repo_id": "datasets",
"token_count": 1109
} | 66 |
# Overview
Welcome to the 🤗 Datasets tutorials! These beginner-friendly tutorials will guide you through the fundamentals of working with 🤗 Datasets. You'll load and prepare a dataset for training with your machine learning framework of choice. Along the way, you'll learn how to load different dataset configurations... | datasets/docs/source/tutorial.md/0 | {
"file_path": "datasets/docs/source/tutorial.md",
"repo_id": "datasets",
"token_count": 311
} | 67 |
# Copyright 2021 The HuggingFace Datasets Authors.
#
# 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 ... | datasets/metrics/cer/cer.py/0 | {
"file_path": "datasets/metrics/cer/cer.py",
"repo_id": "datasets",
"token_count": 2133
} | 68 |
# Metric Card for Exact Match
## Metric Description
A given predicted string's exact match score is 1 if it is the exact same as its reference string, and is 0 otherwise.
- **Example 1**: The exact match score of prediction "Happy Birthday!" is 0, given its reference is "Happy New Year!".
- **Example 2**: The exact ... | datasets/metrics/exact_match/README.md/0 | {
"file_path": "datasets/metrics/exact_match/README.md",
"repo_id": "datasets",
"token_count": 1508
} | 69 |
# Metric Card for Matthews Correlation Coefficient
## Metric Description
The Matthews correlation coefficient is used in machine learning as a
measure of the quality of binary and multiclass classifications. It takes
into account true and false positives and negatives and is generally
regarded as a balanced measure wh... | datasets/metrics/matthews_correlation/README.md/0 | {
"file_path": "datasets/metrics/matthews_correlation/README.md",
"repo_id": "datasets",
"token_count": 1251
} | 70 |
# Metric Card for Recall
## Metric Description
Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:
Recall = TP / (TP + FN)
Where TP is the number of true positives and FN is the number of false negatives.
## How to Use
At mini... | datasets/metrics/recall/README.md/0 | {
"file_path": "datasets/metrics/recall/README.md",
"repo_id": "datasets",
"token_count": 1704
} | 71 |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# 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 ... | datasets/metrics/squad/squad.py/0 | {
"file_path": "datasets/metrics/squad/squad.py",
"repo_id": "datasets",
"token_count": 1933
} | 72 |
# Copyright 2022 The HuggingFace Datasets Authors.
#
# 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 ... | datasets/metrics/xtreme_s/xtreme_s.py/0 | {
"file_path": "datasets/metrics/xtreme_s/xtreme_s.py",
"repo_id": "datasets",
"token_count": 4467
} | 73 |
import os
from argparse import ArgumentParser
from pathlib import Path
from shutil import copyfile
from typing import List
from datasets import config
from datasets.builder import DatasetBuilder
from datasets.commands import BaseDatasetsCLICommand
from datasets.download.download_config import DownloadConfig
from datas... | datasets/src/datasets/commands/run_beam.py/0 | {
"file_path": "datasets/src/datasets/commands/run_beam.py",
"repo_id": "datasets",
"token_count": 3238
} | 74 |
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
import pyarrow as pa
if TYPE_CHECKING:
from .features import FeatureType
@dataclass
class Translation:
"""`FeatureConnector` for translations with fixed languages per example.
Here for ... | datasets/src/datasets/features/translation.py/0 | {
"file_path": "datasets/src/datasets/features/translation.py",
"repo_id": "datasets",
"token_count": 1680
} | 75 |
import multiprocessing
import os
from typing import BinaryIO, Optional, Union
import fsspec
from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.csv.csv import Csv
from ..utils import tqdm as hf_tqdm
from ..utils.typing import NestedDataStructureLike, PathL... | datasets/src/datasets/io/csv.py/0 | {
"file_path": "datasets/src/datasets/io/csv.py",
"repo_id": "datasets",
"token_count": 2556
} | 76 |
from typing import List
import datasets
from datasets.tasks import AudioClassification
from ..folder_based_builder import folder_based_builder
logger = datasets.utils.logging.get_logger(__name__)
class AudioFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""Builder Config for AudioFolder."""
... | datasets/src/datasets/packaged_modules/audiofolder/audiofolder.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/audiofolder/audiofolder.py",
"repo_id": "datasets",
"token_count": 618
} | 77 |
import itertools
from dataclasses import dataclass
from typing import List, Optional
import pyarrow as pa
import pyarrow.parquet as pq
import datasets
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class ParquetConfig(datasets.BuilderConfig):
"""BuilderCo... | datasets/src/datasets/packaged_modules/parquet/parquet.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/parquet/parquet.py",
"repo_id": "datasets",
"token_count": 2193
} | 78 |
from typing import Optional
from ..utils.logging import get_logger
from .audio_classification import AudioClassification
from .automatic_speech_recognition import AutomaticSpeechRecognition
from .base import TaskTemplate
from .image_classification import ImageClassification
from .language_modeling import LanguageModel... | datasets/src/datasets/tasks/__init__.py/0 | {
"file_path": "datasets/src/datasets/tasks/__init__.py",
"repo_id": "datasets",
"token_count": 506
} | 79 |
# deprecated, please use datasets.download.download_manager
| datasets/src/datasets/utils/download_manager.py/0 | {
"file_path": "datasets/src/datasets/utils/download_manager.py",
"repo_id": "datasets",
"token_count": 13
} | 80 |
name: "" # Filename comes here
allow_empty: false
allow_empty_text: true
subsections:
- name: "Dataset Card for X" # First-level markdown heading
allow_empty: false
allow_empty_text: true
subsections:
- name: "Table of Contents"
allow_empty: false
allow_empty_text: false
subs... | datasets/src/datasets/utils/resources/readme_structure.yaml/0 | {
"file_path": "datasets/src/datasets/utils/resources/readme_structure.yaml",
"repo_id": "datasets",
"token_count": 1924
} | 81 |
import os
import tarfile
import warnings
import numpy as np
import pandas as pd
import pyarrow as pa
import pytest
from datasets import Dataset, Features, Image, Sequence, Value, concatenate_datasets, load_dataset
from datasets.features.image import encode_np_array, image_to_bytes
from ..utils import require_pil
@... | datasets/tests/features/test_image.py/0 | {
"file_path": "datasets/tests/features/test_image.py",
"repo_id": "datasets",
"token_count": 11376
} | 82 |
from pathlib import Path
import pytest
from datasets import load_dataset
from datasets.packaged_modules.cache.cache import Cache
SAMPLE_DATASET_TWO_CONFIG_IN_METADATA = "hf-internal-testing/audiofolder_two_configs_in_metadata"
def test_cache(text_dir: Path):
ds = load_dataset(str(text_dir))
hash = Path(ds... | datasets/tests/packaged_modules/test_cache.py/0 | {
"file_path": "datasets/tests/packaged_modules/test_cache.py",
"repo_id": "datasets",
"token_count": 1243
} | 83 |
import os
import sys
from pathlib import Path
import pytest
from datasets import Dataset, IterableDataset
from datasets.distributed import split_dataset_by_node
from .utils import execute_subprocess_async, get_torch_dist_unique_port, require_torch
def test_split_dataset_by_node_map_style():
full_ds = Dataset.f... | datasets/tests/test_distributed.py/0 | {
"file_path": "datasets/tests/test_distributed.py",
"repo_id": "datasets",
"token_count": 1926
} | 84 |
import re
import sys
import tempfile
import unittest
from pathlib import Path
import pytest
import yaml
from huggingface_hub import DatasetCard, DatasetCardData
from datasets.config import METADATA_CONFIGS_FIELD
from datasets.info import DatasetInfo
from datasets.utils.metadata import MetadataConfigs
def _dedent(st... | datasets/tests/test_metadata_util.py/0 | {
"file_path": "datasets/tests/test_metadata_util.py",
"repo_id": "datasets",
"token_count": 5453
} | 85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.