text
stringlengths
7
1.24M
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
519
# 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_config.py/0
{ "file_path": "trl/trl/trainer/ppo_config.py", "repo_id": "trl", "token_count": 2874 }
451
<!--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/basic_tutorials/troubleshooting.md/0
{ "file_path": "accelerate/docs/source/basic_tutorials/troubleshooting.md", "repo_id": "accelerate", "token_count": 3049 }
0
<!--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/deepspeed.md/0
{ "file_path": "accelerate/docs/source/usage_guides/deepspeed.md", "repo_id": "accelerate", "token_count": 10169 }
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 ...
accelerate/examples/README.md/0
{ "file_path": "accelerate/examples/README.md", "repo_id": "accelerate", "token_count": 4684 }
2
#!/bin/bash #SBATCH --job-name=multinode #SBATCH -D . #SBATCH --output=O-%x.%j #SBATCH --error=E-%x.%j #SBATCH --nodes=4 # number of nodes #SBATCH --ntasks-per-node=1 # number of MP tasks #SBATCH --gres=gpu:4 # number of GPUs per node #SBATCH --cpus-per-task=160 # numbe...
accelerate/examples/slurm/submit_multinode.sh/0
{ "file_path": "accelerate/examples/slurm/submit_multinode.sh", "repo_id": "accelerate", "token_count": 547 }
3
# 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/setup.py/0
{ "file_path": "accelerate/setup.py", "repo_id": "accelerate", "token_count": 1720 }
4
#!/usr/bin/env python # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
accelerate/src/accelerate/commands/estimate.py/0
{ "file_path": "accelerate/src/accelerate/commands/estimate.py", "repo_id": "accelerate", "token_count": 4976 }
5
# 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...
accelerate/src/accelerate/local_sgd.py/0
{ "file_path": "accelerate/src/accelerate/local_sgd.py", "repo_id": "accelerate", "token_count": 1554 }
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/utils/environment.py/0
{ "file_path": "accelerate/src/accelerate/utils/environment.py", "repo_id": "accelerate", "token_count": 3941 }
7
{ "fp16": { "enabled": "auto", "loss_scale": 0, "loss_scale_window": 1000, "initial_scale_power": 16, "hysteresis": 2, "min_loss_scale": 1 }, "bf16": { "enabled": "auto" }, "optimizer": { "type": "AdamW", "params": { ...
accelerate/tests/deepspeed/ds_config_zero2.json/0
{ "file_path": "accelerate/tests/deepspeed/ds_config_zero2.json", "repo_id": "accelerate", "token_count": 680 }
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/tests/test_data_loader.py/0
{ "file_path": "accelerate/tests/test_data_loader.py", "repo_id": "accelerate", "token_count": 16443 }
9
# Welcome to the RLHF Handbook! Stay tuned for more details 🤗
alignment-handbook/chapters/en/chapter0/introduction.mdx/0
{ "file_path": "alignment-handbook/chapters/en/chapter0/introduction.mdx", "repo_id": "alignment-handbook", "token_count": 18 }
10
# Model arguments model_name_or_path: alignment-handbook/zephyr-7b-sft-full torch_dtype: null # Data training arguments dataset_mixer: HuggingFaceH4/ultrafeedback_binarized: 1.0 dataset_splits: - train_prefs - test_prefs preprocessing_num_workers: 12 # Training arguments with sensible defaults bf16: true beta: 0.01...
alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml/0
{ "file_path": "alignment-handbook/recipes/pref_align_scan/dpo/config_zephyr.yaml", "repo_id": "alignment-handbook", "token_count": 358 }
11
# Model arguments model_name_or_path: google/gemma-7b model_revision: main tokenizer_name_or_path: philschmid/gemma-tokenizer-chatml # Custom tokenizer with <|im_start|> and <|im_end|> tokens torch_dtype: bfloat16 attn_implementation: flash_attention_2 # Data training arguments dataset_mixer: HuggingFaceH4/deita-10k...
alignment-handbook/recipes/zephyr-7b-gemma/sft/config_full.yaml/0
{ "file_path": "alignment-handbook/recipes/zephyr-7b-gemma/sft/config_full.yaml", "repo_id": "alignment-handbook", "token_count": 481 }
12
# Model arguments model_name_or_path: mistralai/Mistral-7B-v0.1 model_revision: main torch_dtype: bfloat16 attn_implementation: flash_attention_2 # Data training arguments dataset_mixer: HuggingFaceH4/ultrachat_200k: 1.0 dataset_splits: - train_sft - test_sft preprocessing_num_workers: 12 # SFT trainer config bf16:...
alignment-handbook/tests/fixtures/config_sft_full.yaml/0
{ "file_path": "alignment-handbook/tests/fixtures/config_sft_full.yaml", "repo_id": "alignment-handbook", "token_count": 358 }
13
.PHONY: clean-ptx clean test clean-ptx: find target -name "*.ptx" -type f -delete echo "" > candle-kernels/src/lib.rs touch candle-kernels/build.rs touch candle-examples/build.rs touch candle-flash-attn/build.rs clean: cargo clean test: cargo test all: test
candle/Makefile/0
{ "file_path": "candle/Makefile", "repo_id": "candle", "token_count": 107 }
14
[package] name = "candle-core" 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 } byteorder =...
candle/candle-core/Cargo.toml/0
{ "file_path": "candle/candle-core/Cargo.toml", "repo_id": "candle", "token_count": 490 }
15
#![allow(dead_code)] use libc::{c_char, c_double, c_float, c_int, c_long, c_ulong}; mod ffi { use super::*; extern "C" { // It would be nice to be able to switch to the NEWLAPACK version of the function but this // seems to trigger some link error. Available function names can be seen here: ...
candle/candle-core/src/accelerate.rs/0
{ "file_path": "candle/candle-core/src/accelerate.rs", "repo_id": "candle", "token_count": 7639 }
16
use crate::backend::{BackendDevice, BackendStorage}; use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Layout, Result, Shape, WithDType}; pub use candle_kernels as kernels; pub use cudarc; use cudarc::cublas::{Gemm, GemmConfig, StridedBatchedConfig}; use cudarc::driver::{ CudaSli...
candle/candle-core/src/cuda_backend/mod.rs/0
{ "file_path": "candle/candle-core/src/cuda_backend/mod.rs", "repo_id": "candle", "token_count": 41770 }
17
#![allow(clippy::redundant_closure_call)] use crate::Tensor; use half::{bf16, f16}; use num_traits::float::Float; #[derive(Clone, Copy, PartialEq, Eq)] pub enum CmpOp { Eq, Ne, Le, Ge, Lt, Gt, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ReduceOp { Sum, Min, Max, Arg...
candle/candle-core/src/op.rs/0
{ "file_path": "candle/candle-core/src/op.rs", "repo_id": "candle", "token_count": 13498 }
18
//! The shape of a tensor is a tuple with the size of each of its dimensions. #![allow(clippy::redundant_closure_call)] use crate::{Error, Result}; #[derive(Clone, PartialEq, Eq)] pub struct Shape(Vec<usize>); pub const SCALAR: Shape = Shape(vec![]); impl std::fmt::Debug for Shape { fn fmt(&self, f: &mut std::fm...
candle/candle-core/src/shape.rs/0
{ "file_path": "candle/candle-core/src/shape.rs", "repo_id": "candle", "token_count": 9929 }
19
use candle::{test_device, Device, IndexOp, Result, Tensor}; use candle_core as candle; fn contiguous(device: &Device) -> Result<()> { let tensor = Tensor::arange(0u32, 24u32, device)?.reshape((2, 3, 4))?; assert_eq!( tensor.to_vec3::<u32>()?, &[ [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 1...
candle/candle-core/tests/layout_tests.rs/0
{ "file_path": "candle/candle-core/tests/layout_tests.rs", "repo_id": "candle", "token_count": 2819 }
20
use hf_hub::{ api::sync::{Api, ApiRepo}, Repo, RepoType, }; use parquet::file::reader::SerializedFileReader; use std::fs::File; #[derive(thiserror::Error, Debug)] pub enum Error { #[error("ApiError : {0}")] ApiError(#[from] hf_hub::api::sync::ApiError), #[error("IoError : {0}")] IoError(#[from...
candle/candle-datasets/src/hub.rs/0
{ "file_path": "candle/candle-datasets/src/hub.rs", "repo_id": "candle", "token_count": 900 }
21
# candle-starcoder: code generation model [StarCoder/BigCode](https://huggingface.co/bigcode/starcoderbase-1b) is a LLM model specialized to code generation. The initial model was trained on 80 programming languages. ## Running some example ```bash cargo run --example bigcode --release -- --prompt "fn fact(n: u64) -...
candle/candle-examples/examples/bigcode/README.md/0
{ "file_path": "candle/candle-examples/examples/bigcode/README.md", "repo_id": "candle", "token_count": 180 }
22
# candle-dinov2 [Depth Anything V2] is a model for Monocular Depth Estimation (MDE, i.e. just using a single image) which builds on the [DINOv2](https://github.com/facebookresearch/dinov2) vision transformer. This example first instantiates the DINOv2 model and then proceeds to create DepthAnythingV2 and run it. ## ...
candle/candle-examples/examples/depth_anything_v2/README.md/0
{ "file_path": "candle/candle-examples/examples/depth_anything_v2/README.md", "repo_id": "candle", "token_count": 168 }
23
# hiera [Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles](https://arxiv.org/abs/2306.00989) This candle implementation uses pre-trained Hiera models from timm for inference. The classification head has been trained on the ImageNet dataset and returns the probabilities for the top-5 classes. ##...
candle/candle-examples/examples/hiera/README.md/0
{ "file_path": "candle/candle-examples/examples/hiera/README.md", "repo_id": "candle", "token_count": 260 }
24
/// 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 }
25
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use clap::{Parser, ValueEnum}; use candle::{DType, IndexOp, D}; use candle_nn::{Module, VarBuilder}; use candle_transformers::models::mobilenetv4; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { ...
candle/candle-examples/examples/mobilenetv4/main.rs/0
{ "file_path": "candle/candle-examples/examples/mobilenetv4/main.rs", "repo_id": "candle", "token_count": 1443 }
26
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use anyhow::{Error as E, Result}; use clap::{Parser, ValueEnum}; use candle_examples::token_output_stream::TokenOutputStream; use candle_transformers::models::mixformer::{Config, MixFormerSequentialForCaus...
candle/candle-examples/examples/phi/main.rs/0
{ "file_path": "candle/candle-examples/examples/phi/main.rs", "repo_id": "candle", "token_count": 9478 }
27
use std::collections::VecDeque; use rand::distributions::Uniform; use rand::{thread_rng, Rng}; use candle::{DType, Device, Module, Result, Tensor}; use candle_nn::loss::mse; use candle_nn::{linear, seq, Activation, AdamW, Optimizer, VarBuilder, VarMap}; use crate::gym_env::GymEnv; const DEVICE: Device = Device::Cpu...
candle/candle-examples/examples/reinforcement-learning/dqn.rs/0
{ "file_path": "candle/candle-examples/examples/reinforcement-learning/dqn.rs", "repo_id": "candle", "token_count": 2032 }
28
use candle::Device; use candle::Module; use candle_nn::VarBuilder; use candle_transformers::models::segformer::{ Config, ImageClassificationModel, SemanticSegmentationModel, }; use clap::{Args, Parser, Subcommand}; use imageproc::image::Rgb; use imageproc::integral_image::ArrayData; use std::collections::HashMap; u...
candle/candle-examples/examples/segformer/main.rs/0
{ "file_path": "candle/candle-examples/examples/segformer/main.rs", "repo_id": "candle", "token_count": 2229 }
29
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once #include <cuda.h> #include <vector> // #ifdef OLD_GENERATOR_PATH // #include <ATen/CUDAGeneratorImpl.h> // #els...
candle/candle-flash-attn/kernels/flash.h/0
{ "file_path": "candle/candle-flash-attn/kernels/flash.h", "repo_id": "candle", "token_count": 2364 }
30
use anyhow::Result; use candle::{DType, Device, IndexOp, Tensor, D}; fn to_vec3_round(t: Tensor, digits: i32) -> Result<Vec<Vec<Vec<f32>>>> { let b = 10f32.powi(digits); let t = t.to_vec3::<f32>()?; let t = t .iter() .map(|t| { t.iter() .map(|t| t.iter().map(|t| ...
candle/candle-flash-attn/tests/flash_attn_tests.rs/0
{ "file_path": "candle/candle-flash-attn/tests/flash_attn_tests.rs", "repo_id": "candle", "token_count": 2787 }
31
// Adapted from https://github.com/ggerganov/llama.cpp/blob/master/ggml-cuda/argsort.cu #define SORT_ORDER_ASC 1 #define SORT_ORDER_DESC 0 #include "cuda_utils.cuh" #include<stdint.h> template<typename T> static inline __device__ void ggml_cuda_swap(T & a, T & b) { T tmp = a; a = b; b = tmp; } template<in...
candle/candle-kernels/src/sort.cu/0
{ "file_path": "candle/candle-kernels/src/sort.cu", "repo_id": "candle", "token_count": 1469 }
32
#include <metal_stdlib> using namespace metal; METAL_FUNC uint get_strided_index( uint idx, constant size_t &num_dims, constant size_t *dims, constant size_t *strides ) { uint strided_i = 0; for (uint d = 0; d < num_dims; d++) { uint dim_idx = num_dims - 1 - d; strided_i += (idx...
candle/candle-metal-kernels/src/ternary.metal/0
{ "file_path": "candle/candle-metal-kernels/src/ternary.metal", "repo_id": "candle", "token_count": 2256 }
33
use candle::{Result, Tensor}; use serde::Deserialize; #[derive(Debug, Clone, Copy, PartialEq, Deserialize, Default)] #[serde(rename_all = "lowercase")] pub enum Activation { #[default] #[serde(alias = "gelu")] Gelu, #[serde(alias = "gelu_new")] NewGelu, Relu, Relu2, Relu6, Silu, ...
candle/candle-nn/src/activation.rs/0
{ "file_path": "candle/candle-nn/src/activation.rs", "repo_id": "candle", "token_count": 1656 }
34
use candle::{CpuStorage, Layout, Result, Shape, Tensor, D}; use rayon::prelude::*; /// Interleaved variant of rotary embeddings. /// The x0 and x1 value are interleaved on the n_embd (= head_dim) dimension. /// The resulting y0 and y1 are also interleaved with: /// y0 = x0*cos - x1*sin /// y1 = x0*sin + x1*cos #[d...
candle/candle-nn/src/rotary_emb.rs/0
{ "file_path": "candle/candle-nn/src/rotary_emb.rs", "repo_id": "candle", "token_count": 15510 }
35
use candle::Result; use prost::Message; pub mod onnx { include!(concat!(env!("OUT_DIR"), "/onnx.rs")); } pub mod eval; pub use eval::{dtype, simple_eval}; pub fn read_file<P: AsRef<std::path::Path>>(p: P) -> Result<onnx::ModelProto> { let buf = std::fs::read(p)?; onnx::ModelProto::decode(buf.as_slice())....
candle/candle-onnx/src/lib.rs/0
{ "file_path": "candle/candle-onnx/src/lib.rs", "repo_id": "candle", "token_count": 154 }
36
from .module import Module from .container import Sequential, ModuleList, ModuleDict from .sparse import Embedding from .normalization import LayerNorm from .linear import Linear
candle/candle-pyo3/py_src/candle/nn/__init__.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/nn/__init__.py", "repo_id": "candle", "token_count": 43 }
37
use std::collections::HashMap; use crate::utils::wrap_err; use crate::{PyDType, PyTensor}; use candle_onnx::eval::{dtype, get_tensor, simple_eval}; use candle_onnx::onnx::tensor_proto::DataType; use candle_onnx::onnx::tensor_shape_proto::dimension::Value; use candle_onnx::onnx::type_proto::{Tensor as ONNXTensor, Value...
candle/candle-pyo3/src/onnx.rs/0
{ "file_path": "candle/candle-pyo3/src/onnx.rs", "repo_id": "candle", "token_count": 3268 }
38
pub mod generation; pub mod models; pub mod object_detection; pub mod pipelines; pub mod quantized_nn; pub mod quantized_var_builder; pub mod utils;
candle/candle-transformers/src/lib.rs/0
{ "file_path": "candle/candle-transformers/src/lib.rs", "repo_id": "candle", "token_count": 47 }
39
use candle::{IndexOp, Result, Tensor, D}; use candle_nn::{layer_norm, LayerNorm, Linear, Module, VarBuilder}; const IMG_SIZE: usize = 518; const PATCH_SIZE: usize = 14; const NUM_CLASSES: usize = 1000; fn linear(vb: VarBuilder, in_dim: usize, out_dim: usize, bias: bool) -> Result<Linear> { if bias { candl...
candle/candle-transformers/src/models/dinov2.rs/0
{ "file_path": "candle/candle-transformers/src/models/dinov2.rs", "repo_id": "candle", "token_count": 5803 }
40
//! Hiera inference implementation based on timm. //! //! See "Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles" //! https://arxiv.org/abs/2306.00989 //! //! https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/hiera.py use candle::{Result, D}; use candle_nn::{conv2d, layer_...
candle/candle-transformers/src/models/hiera.rs/0
{ "file_path": "candle/candle-transformers/src/models/hiera.rs", "repo_id": "candle", "token_count": 4434 }
41
pub mod blocks; pub mod embedding; pub mod model; pub mod projections;
candle/candle-transformers/src/models/mmdit/mod.rs/0
{ "file_path": "candle/candle-transformers/src/models/mmdit/mod.rs", "repo_id": "candle", "token_count": 21 }
42
use super::quantized_blip_text as blip_text; use crate::quantized_nn::{layer_norm, linear, Linear}; pub use crate::quantized_var_builder::VarBuilder; use candle::{Module, Result, Tensor, D}; use candle_nn::{Conv2d, Conv2dConfig, LayerNorm}; pub type VisionConfig = super::blip::VisionConfig; pub type Config = super::bl...
candle/candle-transformers/src/models/quantized_blip.rs/0
{ "file_path": "candle/candle-transformers/src/models/quantized_blip.rs", "repo_id": "candle", "token_count": 4013 }
43
//! Attention Based Building Blocks use candle::{DType, IndexOp, Result, Tensor, D}; use candle_nn as nn; use candle_nn::Module; #[derive(Debug)] struct GeGlu { proj: nn::Linear, span: tracing::Span, } impl GeGlu { fn new(vs: nn::VarBuilder, dim_in: usize, dim_out: usize) -> Result<Self> { let pro...
candle/candle-transformers/src/models/stable_diffusion/attention.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/attention.rs", "repo_id": "candle", "token_count": 9458 }
44
use crate::models::vit::{Config, Embeddings, Encoder}; use candle::{DType, Result, Tensor}; use candle_nn::{ embedding, layer_norm, linear_no_bias, Embedding, LayerNorm, Linear, Module, VarBuilder, }; fn default_tie_word_embeddings() -> bool { true } fn default_use_learned_position_embeddings() -> bool { t...
candle/candle-transformers/src/models/trocr.rs/0
{ "file_path": "candle/candle-transformers/src/models/trocr.rs", "repo_id": "candle", "token_count": 8465 }
45
/// A bounding box around an object. #[derive(Debug, Clone)] pub struct Bbox<D> { pub xmin: f32, pub ymin: f32, pub xmax: f32, pub ymax: f32, pub confidence: f32, pub data: D, } #[derive(Debug, Clone, Copy, PartialEq)] pub struct KeyPoint { pub x: f32, pub y: f32, pub mask: f32, } ...
candle/candle-transformers/src/object_detection.rs/0
{ "file_path": "candle/candle-transformers/src/object_detection.rs", "repo_id": "candle", "token_count": 1884 }
46
use candle::{Device, Tensor}; use candle_transformers::generation::LogitsProcessor; use candle_wasm_example_llama2::worker::{Model as M, ModelData}; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub struct Model { inner: M, logits_processor: LogitsProcessor, tokens: Vec<u32>, repeat_penalty: f32, } im...
candle/candle-wasm-examples/llama2-c/src/bin/m.rs/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/src/bin/m.rs", "repo_id": "candle", "token_count": 1807 }
47
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle Phi 1.5 / Phi 2.0 Rust/WASM</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> ...
candle/candle-wasm-examples/phi/index.html/0
{ "file_path": "candle/candle-wasm-examples/phi/index.html", "repo_id": "candle", "token_count": 9818 }
48
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle T5</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <style> @import ur...
candle/candle-wasm-examples/t5/index.html/0
{ "file_path": "candle/candle-wasm-examples/t5/index.html", "repo_id": "candle", "token_count": 4724 }
49
pub const LANGUAGES: [(&str, &str); 99] = [ ("en", "english"), ("zh", "chinese"), ("de", "german"), ("es", "spanish"), ("ru", "russian"), ("ko", "korean"), ("fr", "french"), ("ja", "japanese"), ("pt", "portuguese"), ("tr", "turkish"), ("pl", "polish"), ("ca", "catalan"), ...
candle/candle-wasm-examples/whisper/src/languages.rs/0
{ "file_path": "candle/candle-wasm-examples/whisper/src/languages.rs", "repo_id": "candle", "token_count": 1175 }
50
use crate::model::{report_detect, report_pose, Bbox, Multiples, YoloV8, YoloV8Pose}; use candle::{DType, Device, Result, Tensor}; use candle_nn::{Module, VarBuilder}; use serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::*; use yew_agent::{HandlerId, Public, WorkerLink}; #[wasm_bindgen] extern "C" { // U...
candle/candle-wasm-examples/yolo/src/worker.rs/0
{ "file_path": "candle/candle-wasm-examples/yolo/src/worker.rs", "repo_id": "candle", "token_count": 4075 }
51
--- 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 load_balancing_strategy: random --- # Chat UI **Find the docs at [hf.co/docs/chat-ui](https://huggingface.co/docs/chat-ui/index).** ![Chat UI reposit...
chat-ui/README.md/0
{ "file_path": "chat-ui/README.md", "repo_id": "chat-ui", "token_count": 13474 }
52
# Metrics The server can expose prometheus metrics on port `5565` but is off by default. You may enable the metrics server with `METRICS_ENABLED=true` and change the port with `METRICS_PORT=1234`. <Tip> In development with `npm run dev`, the metrics server does not shutdown gracefully due to Sveltekit not providing ...
chat-ui/docs/source/configuration/metrics.md/0
{ "file_path": "chat-ui/docs/source/configuration/metrics.md", "repo_id": "chat-ui", "token_count": 111 }
53
# Theming You can use a few environment variables to customize the look and feel of Chat UI. These are by default: ```ini PUBLIC_APP_NAME=ChatUI PUBLIC_APP_ASSETS=chatui PUBLIC_APP_COLOR=blue PUBLIC_APP_DESCRIPTION="Making the community's best AI chat models available to everyone." PUBLIC_APP_DATA_SHARING= PUBLIC_APP...
chat-ui/docs/source/configuration/theming.md/0
{ "file_path": "chat-ui/docs/source/configuration/theming.md", "repo_id": "chat-ui", "token_count": 286 }
54
declare module "*.ttf" { const value: ArrayBuffer; export default value; }
chat-ui/src/ambient.d.ts/0
{ "file_path": "chat-ui/src/ambient.d.ts", "repo_id": "chat-ui", "token_count": 26 }
55
<script lang="ts"> import { base } from "$app/paths"; import { page } from "$app/stores"; import { env as envPublic } from "$env/dynamic/public"; import LogoHuggingFaceBorderless from "$lib/components/icons/LogoHuggingFaceBorderless.svelte"; import Modal from "$lib/components/Modal.svelte"; import { useSettingsSt...
chat-ui/src/lib/components/LoginModal.svelte/0
{ "file_path": "chat-ui/src/lib/components/LoginModal.svelte", "repo_id": "chat-ui", "token_count": 974 }
56
<script lang="ts"> import type { Model } from "$lib/types/Model"; import { getTokenizer } from "$lib/utils/getTokenizer"; import type { PreTrainedTokenizer } from "@huggingface/transformers"; export let classNames = ""; export let prompt = ""; export let modelTokenizer: Exclude<Model["tokenizer"], undefined>; e...
chat-ui/src/lib/components/TokensCounter.svelte/0
{ "file_path": "chat-ui/src/lib/components/TokensCounter.svelte", "repo_id": "chat-ui", "token_count": 459 }
57
<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 }
58
import type { Migration } from "."; import { collections } from "$lib/server/database"; import { ObjectId } from "mongodb"; const updateAssistantsModels: Migration = { _id: new ObjectId("5f9f3f3f3f3f3f3f3f3f3f3f"), name: "Update deprecated models in assistants with the default model", up: async () => { const mode...
chat-ui/src/lib/migrations/routines/02-update-assistants-models.ts/0
{ "file_path": "chat-ui/src/lib/migrations/routines/02-update-assistants-models.ts", "repo_id": "chat-ui", "token_count": 286 }
59
import { z } from "zod"; import type { Endpoint } from "../endpoints"; import { env } from "$env/dynamic/private"; import type { TextGenerationStreamOutput } from "@huggingface/inference"; import { createImageProcessorOptionsValidator } from "../images"; import { endpointMessagesToAnthropicMessages } from "./utils"; e...
chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts/0
{ "file_path": "chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts", "repo_id": "chat-ui", "token_count": 1138 }
60
import type { TextGenerationStreamOutput } from "@huggingface/inference"; import type OpenAI from "openai"; import type { Stream } from "openai/streaming"; /** * Transform a stream of OpenAI.Completions.Completion into a stream of TextGenerationStreamOutput */ export async function* openAICompletionToTextGenerationS...
chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts/0
{ "file_path": "chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts", "repo_id": "chat-ui", "token_count": 325 }
61
import { env } from "$env/dynamic/private"; import { generateFromDefaultEndpoint } from "$lib/server/generateFromDefaultEndpoint"; import type { EndpointMessage } from "../endpoints/endpoints"; import { logger } from "$lib/server/logger"; import { MessageUpdateType, type MessageUpdate } from "$lib/types/MessageUpdate";...
chat-ui/src/lib/server/textGeneration/title.ts/0
{ "file_path": "chat-ui/src/lib/server/textGeneration/title.ts", "repo_id": "chat-ui", "token_count": 1028 }
62
/* eslint-disable-next-line no-shadow */ export enum MarkdownElementType { Header = "HEADER", Paragraph = "PARAGRAPH", BlockQuote = "BLOCKQUOTE", CodeBlock = "CODE_BLOCK", UnorderedList = "UNORDERED_LIST", OrderedList = "ORDERED_LIST", UnorderedListItem = "UNORDERED_LIST_ITEM", OrderedListItem = "ORDERED_LIST_...
chat-ui/src/lib/server/websearch/markdown/types.ts/0
{ "file_path": "chat-ui/src/lib/server/websearch/markdown/types.ts", "repo_id": "chat-ui", "token_count": 541 }
63
import { JSDOM, VirtualConsole } from "jsdom"; import { isURL } from "$lib/utils/isUrl"; import type { WebSearchSource } from "$lib/types/WebSearch"; export default async function searchWebLocal(query: string): Promise<WebSearchSource[]> { const abortController = new AbortController(); setTimeout(() => abortControll...
chat-ui/src/lib/server/websearch/search/endpoints/webLocal.ts/0
{ "file_path": "chat-ui/src/lib/server/websearch/search/endpoints/webLocal.ts", "repo_id": "chat-ui", "token_count": 439 }
64
import type { Timestamps } from "./Timestamps"; import type { Assistant } from "./Assistant"; export interface AssistantStats extends Timestamps { assistantId: Assistant["_id"]; date: { at: Date; span: "hour"; }; count: number; }
chat-ui/src/lib/types/AssistantStats.ts/0
{ "file_path": "chat-ui/src/lib/types/AssistantStats.ts", "repo_id": "chat-ui", "token_count": 80 }
65
import type { Timestamps } from "./Timestamps"; export interface TokenCache extends Timestamps { tokenHash: string; // sha256 of the bearer token userId: string; // the matching hf user id }
chat-ui/src/lib/types/TokenCache.ts/0
{ "file_path": "chat-ui/src/lib/types/TokenCache.ts", "repo_id": "chat-ui", "token_count": 57 }
66
// Approximate width from which we disable autofocus const TABLET_VIEWPORT_WIDTH = 768; export function isDesktop(window: Window) { const { innerWidth } = window; return innerWidth > TABLET_VIEWPORT_WIDTH; }
chat-ui/src/lib/utils/isDesktop.ts/0
{ "file_path": "chat-ui/src/lib/utils/isDesktop.ts", "repo_id": "chat-ui", "token_count": 67 }
67
import { collections } from "$lib/server/database"; import { ObjectId } from "mongodb"; import { describe, expect, it } from "vitest"; import { insertLegacyConversation, insertSideBranchesConversation } from "./treeHelpers.spec"; import { addChildren } from "./addChildren"; import type { Message } from "$lib/types/Mes...
chat-ui/src/lib/utils/tree/addChildren.spec.ts/0
{ "file_path": "chat-ui/src/lib/utils/tree/addChildren.spec.ts", "repo_id": "chat-ui", "token_count": 1301 }
68
import { json } from "@sveltejs/kit"; import { logger } from "$lib/server/logger"; import { computeAllStats } from "$lib/jobs/refresh-conversation-stats"; // Triger like this: // curl -X POST "http://localhost:5173/chat/admin/stats/compute" -H "Authorization: Bearer <ADMIN_API_SECRET>" export async function POST() { ...
chat-ui/src/routes/admin/stats/compute/+server.ts/0
{ "file_path": "chat-ui/src/routes/admin/stats/compute/+server.ts", "repo_id": "chat-ui", "token_count": 161 }
69
<script lang="ts"> import type { PageData } from "./$types"; import { env as envPublic } from "$env/dynamic/public"; import { isHuggingChat } from "$lib/utils/isHuggingChat"; import { goto } from "$app/navigation"; import { base } from "$app/paths"; import { page } from "$app/stores"; import CarbonAdd from "~...
chat-ui/src/routes/assistants/+page.svelte/0
{ "file_path": "chat-ui/src/routes/assistants/+page.svelte", "repo_id": "chat-ui", "token_count": 4777 }
70
import { dev } from "$app/environment"; import { base } from "$app/paths"; import { env } from "$env/dynamic/private"; import { collections } from "$lib/server/database"; import { redirect } from "@sveltejs/kit"; export const actions = { async default({ cookies, locals }) { await collections.sessions.deleteOne({ se...
chat-ui/src/routes/logout/+page.server.ts/0
{ "file_path": "chat-ui/src/routes/logout/+page.server.ts", "repo_id": "chat-ui", "token_count": 237 }
71
<script lang="ts"> import { applyAction, enhance } from "$app/forms"; import { invalidateAll } from "$app/navigation"; import Modal from "$lib/components/Modal.svelte"; import { createEventDispatcher } from "svelte"; const dispatch = createEventDispatcher<{ close: void }>(); let reason = ""; </script> <Modal o...
chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte/0
{ "file_path": "chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte", "repo_id": "chat-ui", "token_count": 592 }
72
<script lang="ts"> import { afterNavigate, goto } from "$app/navigation"; import { base } from "$app/paths"; import { page } from "$app/stores"; import Modal from "$lib/components/Modal.svelte"; import ToolLogo from "$lib/components/ToolLogo.svelte"; import { env as envPublic } from "$env/dynamic/public"; import...
chat-ui/src/routes/tools/[toolId]/+page.svelte/0
{ "file_path": "chat-ui/src/routes/tools/[toolId]/+page.svelte", "repo_id": "chat-ui", "token_count": 3297 }
73
{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "values": "<DVC_METRIC_DATA>" }, "title": "<DVC_METRIC_TITLE>", "mark": "rect", "encoding": { "x": { "field": "<DVC_METRIC_X>", "type": "nominal", "sort": "ascending", ...
datasets/.dvc/plots/confusion.json/0
{ "file_path": "datasets/.dvc/plots/confusion.json", "repo_id": "datasets", "token_count": 450 }
74
# This is the list of HuggingFace Datasets authors for copyright purposes. # # This does not necessarily list everyone who has contributed code, since in # some cases, their employer may be the copyright holder. To see the full list # of contributors, see the revision history in source control. Google Inc. HuggingFac...
datasets/AUTHORS/0
{ "file_path": "datasets/AUTHORS", "repo_id": "datasets", "token_count": 78 }
75
# Know your dataset There are two types of dataset objects, a regular [`Dataset`] and then an ✨ [`IterableDataset`] ✨. A [`Dataset`] provides fast random access to the rows, and memory-mapping so that loading even large datasets only uses a relatively small amount of device memory. But for really, really big datasets ...
datasets/docs/source/access.mdx/0
{ "file_path": "datasets/docs/source/access.mdx", "repo_id": "datasets", "token_count": 2274 }
76
# Process image data This guide shows specific methods for processing image datasets. Learn how to: - Use [`~Dataset.map`] with image dataset. - Apply data augmentations to a dataset with [`~Dataset.set_transform`]. For a guide on how to process any type of dataset, take a look at the <a class="underline decoration-...
datasets/docs/source/image_process.mdx/0
{ "file_path": "datasets/docs/source/image_process.mdx", "repo_id": "datasets", "token_count": 1031 }
77
<!--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...
datasets/docs/source/quickstart.mdx/0
{ "file_path": "datasets/docs/source/quickstart.mdx", "repo_id": "datasets", "token_count": 6102 }
78
[tool.ruff] line-length = 119 [tool.ruff.lint] # Ignored rules: # "E501" -> line length violation # "F821" -> undefined named in type annotation (e.g. Literal["something"]) # "C901" -> `function_name` is too complex ignore = ["E501", "F821", "C901"] select = ["C", "E", "F", "I", "W"] [tool.ruff.lint.isort] line...
datasets/pyproject.toml/0
{ "file_path": "datasets/pyproject.toml", "repo_id": "datasets", "token_count": 274 }
79
import os import re from functools import partial from glob import has_magic from pathlib import Path, PurePath from typing import Callable, Dict, List, Optional, Set, Tuple, Union import huggingface_hub from fsspec.core import url_to_fs from fsspec.implementations.http import HTTPFileSystem from huggingface_hub impor...
datasets/src/datasets/data_files.py/0
{ "file_path": "datasets/src/datasets/data_files.py", "repo_id": "datasets", "token_count": 13790 }
80
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow 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 # # U...
datasets/src/datasets/formatting/__init__.py/0
{ "file_path": "datasets/src/datasets/formatting/__init__.py", "repo_id": "datasets", "token_count": 1892 }
81
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class SparkDatasetReader(AbstractDatasetReader): """A dataset reader that reads from a Spark DataFrame. ...
datasets/src/datasets/io/spark.py/0
{ "file_path": "datasets/src/datasets/io/spark.py", "repo_id": "datasets", "token_count": 787 }
82
from typing import Callable def is_documented_by(function_with_docstring: Callable): """Decorator to share docstrings across common functions. Args: function_with_docstring (`Callable`): Name of the function with the docstring. """ def wrapper(target_function): target_function.__doc_...
datasets/src/datasets/utils/doc_utils.py/0
{ "file_path": "datasets/src/datasets/utils/doc_utils.py", "repo_id": "datasets", "token_count": 137 }
83
[ "unknown", "n<1K", "1K<n<10K", "10K<n<100K", "100K<n<1M", "1M<n<10M", "10M<n<100M", "100M<n<1B", "1B<n<10B", "10B<n<100B", "100B<n<1T", "n>1T" ]
datasets/src/datasets/utils/resources/size_categories.json/0
{ "file_path": "datasets/src/datasets/utils/resources/size_categories.json", "repo_id": "datasets", "token_count": 124 }
84
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict _TestCommandArgs = namedtuple( "_TestCommandArgs", [ "dataset", "name",...
datasets/tests/commands/test_test.py/0
{ "file_path": "datasets/tests/commands/test_test.py", "repo_id": "datasets", "token_count": 1546 }
85
import contextlib import csv import json import os import sqlite3 import tarfile import textwrap import zipfile import pandas as pd import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config # dataset + arrow_file @pytest.fixture(scope="session") def dataset(): n = ...
datasets/tests/fixtures/files.py/0
{ "file_path": "datasets/tests/fixtures/files.py", "repo_id": "datasets", "token_count": 8339 }
86
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.builder import InvalidConfigName from datasets.data_files import DataFilesList from datasets.packaged_modules.csv.csv import Csv, CsvConfig from ..utils import require_pil @pytest.fixture def...
datasets/tests/packaged_modules/test_csv.py/0
{ "file_path": "datasets/tests/packaged_modules/test_csv.py", "repo_id": "datasets", "token_count": 1880 }
87
from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class DatasetListTest(TestCase): def _create_example_records(self): return [ {"col_1": 3, "col_2": "a"}, {"col_1": 2, "col_2": "b"}, {"col_1": 1, "col_2": "c"}...
datasets/tests/test_dataset_list.py/0
{ "file_path": "datasets/tests/test_dataset_list.py", "repo_id": "datasets", "token_count": 875 }
88
import importlib import os import pickle import shutil import tempfile import time from hashlib import sha256 from multiprocessing import Pool from pathlib import Path from unittest import TestCase from unittest.mock import patch import dill import pyarrow as pa import pytest import requests import datasets from data...
datasets/tests/test_load.py/0
{ "file_path": "datasets/tests/test_load.py", "repo_id": "datasets", "token_count": 34804 }
89
- title: Unit 0. Welcome to the course sections: - local: unit0/introduction title: Welcome to the course 🤗 - local: unit0/setup title: Setup - local: unit0/discord101 title: Discord 101 - title: Unit 1. Introduction to Deep Reinforcement Learning sections: - local: unit1/introduction title...
deep-rl-class/units/en/_toctree.yml/0
{ "file_path": "deep-rl-class/units/en/_toctree.yml", "repo_id": "deep-rl-class", "token_count": 2897 }
90
# Summary [[summary]] That was a lot of information! Let's summarize: - Reinforcement Learning is a computational approach of learning from actions. We build an agent that learns from the environment **by interacting with it through trial and error** and receiving rewards (negative or positive) as feedback. - The go...
deep-rl-class/units/en/unit1/summary.mdx/0
{ "file_path": "deep-rl-class/units/en/unit1/summary.mdx", "repo_id": "deep-rl-class", "token_count": 382 }
91
# Second Quiz [[quiz2]] The best way to learn and [to avoid the illusion of competence](https://www.coursera.org/lecture/learning-how-to-learn/illusions-of-competence-BuFzf) **is to test yourself.** This will help you to find **where you need to reinforce your knowledge**. ### Q1: What is Q-Learning? <Question ch...
deep-rl-class/units/en/unit2/quiz2.mdx/0
{ "file_path": "deep-rl-class/units/en/unit2/quiz2.mdx", "repo_id": "deep-rl-class", "token_count": 1097 }
92
# Hands on <CourseFloatingBanner classNames="absolute z-10 right-0 top-0" notebooks={[ {label: "Google Colab", value: "https://colab.research.google.com/github/huggingface/deep-rl-class/blob/main/notebooks/unit4/unit4.ipynb"} ]} askForHelpUrl="http://hf.co/join/discord" /> Now ...
deep-rl-class/units/en/unit4/hands-on.mdx/0
{ "file_path": "deep-rl-class/units/en/unit4/hands-on.mdx", "repo_id": "deep-rl-class", "token_count": 13495 }
93
# Advantage Actor-Critic (A2C) [[advantage-actor-critic]] ## Reducing variance with Actor-Critic methods The solution to reducing the variance of the Reinforce algorithm and training our agent faster and better is to use a combination of Policy-Based and Value-Based methods: *the Actor-Critic method*. To understand ...
deep-rl-class/units/en/unit6/advantage-actor-critic.mdx/0
{ "file_path": "deep-rl-class/units/en/unit6/advantage-actor-critic.mdx", "repo_id": "deep-rl-class", "token_count": 1384 }
94
# Conclusion That's all for today. Congrats on finishing this Unit and the tutorial! ⭐️ Now that you've successfully trained your Doom agent, why not try deathmatch? Remember, that's a much more complex level than the one you've just trained, **but it's a nice experiment and I advise you to try it.** If you do it, d...
deep-rl-class/units/en/unit8/conclusion-sf.mdx/0
{ "file_path": "deep-rl-class/units/en/unit8/conclusion-sf.mdx", "repo_id": "deep-rl-class", "token_count": 188 }
95
# (Automatic) Curriculum Learning for RL While most of the RL methods seen in this course work well in practice, there are some cases where using them alone fails. This can happen, for instance, when: - the task to learn is hard and requires an **incremental acquisition of skills** (for instance when one wants to mak...
deep-rl-class/units/en/unitbonus3/curriculum-learning.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus3/curriculum-learning.mdx", "repo_id": "deep-rl-class", "token_count": 1058 }
96
# Introduction: <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit13/thumbnail.png" alt="Unit bonus 4 thumbnail"/> Welcome to this bonus unit, where you will **train a robot agent to complete a mini-game level using imitation learning.** At the end of the unit, **...
deep-rl-class/units/en/unitbonus5/introduction.mdx/0
{ "file_path": "deep-rl-class/units/en/unitbonus5/introduction.mdx", "repo_id": "deep-rl-class", "token_count": 454 }
97
cff-version: 1.2.0 title: 'Diffusers: State-of-the-art diffusion models' message: >- If you use this software, please cite it using the metadata from this file. type: software authors: - given-names: Patrick family-names: von Platen - given-names: Suraj family-names: Patil - given-names: Anton fam...
diffusers/CITATION.cff/0
{ "file_path": "diffusers/CITATION.cff", "repo_id": "diffusers", "token_count": 460 }
98