text stringlengths 7 328k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 459 |
|---|---|---|---|
[metadata]
license_file = LICENSE | trl/setup.cfg/0 | {
"file_path": "trl/setup.cfg",
"repo_id": "trl",
"token_count": 10
} | 423 |
# 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_iterative_sft_trainer.py/0 | {
"file_path": "trl/tests/test_iterative_sft_trainer.py",
"repo_id": "trl",
"token_count": 2176
} | 424 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | trl/trl/environment/base_environment.py/0 | {
"file_path": "trl/trl/environment/base_environment.py",
"repo_id": "trl",
"token_count": 7661
} | 425 |
# 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/trl/trainer/iterative_sft_trainer.py/0 | {
"file_path": "trl/trl/trainer/iterative_sft_trainer.py",
"repo_id": "trl",
"token_count": 7430
} | 426 |
# 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/benchmarks/measures_util.py/0 | {
"file_path": "accelerate/benchmarks/measures_util.py",
"repo_id": "accelerate",
"token_count": 1146
} | 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/concept_guides/deferring_execution.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/deferring_execution.md",
"repo_id": "accelerate",
"token_count": 1350
} | 1 |
<!--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/usage_guides/local_sgd.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/local_sgd.md",
"repo_id": "accelerate",
"token_count": 1491
} | 2 |
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py/0 | {
"file_path": "accelerate/examples/by_feature/fsdp_with_peak_mem_tracking.py",
"repo_id": "accelerate",
"token_count": 7850
} | 3 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | accelerate/examples/inference/bert.py/0 | {
"file_path": "accelerate/examples/inference/bert.py",
"repo_id": "accelerate",
"token_count": 762
} | 4 |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/setup.py/0 | {
"file_path": "accelerate/setup.py",
"repo_id": "accelerate",
"token_count": 1649
} | 5 |
#!/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": 4241
} | 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/logging.py/0 | {
"file_path": "accelerate/src/accelerate/logging.py",
"repo_id": "accelerate",
"token_count": 1789
} | 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/test_utils/scripts/test_notebook.py/0 | {
"file_path": "accelerate/src/accelerate/test_utils/scripts/test_notebook.py",
"repo_id": "accelerate",
"token_count": 502
} | 8 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | accelerate/src/accelerate/utils/megatron_lm.py/0 | {
"file_path": "accelerate/src/accelerate/utils/megatron_lm.py",
"repo_id": "accelerate",
"token_count": 26949
} | 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_accelerator.py/0 | {
"file_path": "accelerate/tests/test_accelerator.py",
"repo_id": "accelerate",
"token_count": 7862
} | 10 |
# 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_metrics.py/0 | {
"file_path": "accelerate/tests/test_metrics.py",
"repo_id": "accelerate",
"token_count": 693
} | 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/utils/log_reports.py/0 | {
"file_path": "accelerate/utils/log_reports.py",
"repo_id": "accelerate",
"token_count": 3046
} | 12 |
# Model arguments
model_name_or_path: BramVanroy/gpt2-sft-dutch
model_revision: main
torch_dtype: bfloat16
# Data training arguments
# For definitions, see: src/h4/training/config.py
dataset_mixer:
BramVanroy/ultra_feedback_dutch: 1.0
dataset_splits:
- train_prefs
- test_prefs
preprocessing_num_workers: 12
# DPOTra... | alignment-handbook/recipes/gpt2-nl/dpo/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/gpt2-nl/dpo/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 375
} | 13 |
# Model arguments
model_name_or_path: HuggingFaceH4/zephyr-7b-gemma-sft-v0.1
torch_dtype: bfloat16
# Data training arguments
# For definitions, see: src/h4/training/config.py
dataset_mixer:
argilla/dpo-mix-7k: 1.0
dataset_splits:
- train
- test
preprocessing_num_workers: 12
# DPOTrainer arguments
bf16: true
beta: 0... | alignment-handbook/recipes/zephyr-7b-gemma/dpo/config_full.yaml/0 | {
"file_path": "alignment-handbook/recipes/zephyr-7b-gemma/dpo/config_full.yaml",
"repo_id": "alignment-handbook",
"token_count": 366
} | 14 |
# Model arguments
model_name_or_path: mistralai/Mistral-7B-v0.1
model_revision: main
torch_dtype: bfloat16
use_flash_attention_2: true
# Data training arguments
dataset_mixer:
HuggingFaceH4/ultrachat_200k: 1.0
dataset_splits:
- train_sft
- test_sft
preprocessing_num_workers: 12
# SFT trainer config
bf16: true
do_ev... | 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": 357
} | 15 |
# candle
[](https://discord.gg/hugging-face-879548962464493619)
[](https://crates.io/crates/candle-core)
[](htt... | candle/README.md/0 | {
"file_path": "candle/README.md",
"repo_id": "candle",
"token_count": 7636
} | 16 |
# Pytorch cheatsheet
{{#include ../../../README.md:cheatsheet}}
| candle/candle-book/src/guide/cheatsheet.md/0 | {
"file_path": "candle/candle-book/src/guide/cheatsheet.md",
"repo_id": "candle",
"token_count": 26
} | 17 |
//! Implement conversion traits for tensors
use crate::{DType, Device, Error, Tensor, WithDType};
use half::{bf16, f16, slice::HalfFloatSliceExt};
use std::convert::TryFrom;
impl<T: WithDType> TryFrom<&Tensor> for Vec<T> {
type Error = Error;
fn try_from(tensor: &Tensor) -> Result<Self, Self::Error> {
... | candle/candle-core/src/convert.rs/0 | {
"file_path": "candle/candle-core/src/convert.rs",
"repo_id": "candle",
"token_count": 2242
} | 18 |
use crate::{Error, Tensor};
use std::ops::{
Bound, Range, RangeBounds, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
};
impl Tensor {
/// Intended to be use by the trait `.i()`
///
/// ```
/// # use candle_core::{Tensor, DType, Device, IndexOp};
/// let a = Tensor::zeros((2, ... | candle/candle-core/src/indexer.rs/0 | {
"file_path": "candle/candle-core/src/indexer.rs",
"repo_id": "candle",
"token_count": 2652
} | 19 |
use crate::{CpuStorage, Device, Result, Shape, Storage, Tensor};
use k_quants::*;
use std::borrow::Cow;
#[cfg(target_feature = "avx")]
pub mod avx;
mod dummy_cuda;
mod dummy_metal;
pub mod ggml_file;
pub mod gguf_file;
pub mod k_quants;
#[cfg(feature = "metal")]
pub mod metal;
#[cfg(not(feature = "metal"))]
mod metal ... | candle/candle-core/src/quantized/mod.rs/0 | {
"file_path": "candle/candle-core/src/quantized/mod.rs",
"repo_id": "candle",
"token_count": 8178
} | 20 |
use anyhow::Result;
use candle_core::{DType, Device::Cpu, Tensor};
#[test]
fn display_scalar() -> Result<()> {
let t = Tensor::new(1234u32, &Cpu)?;
let s = format!("{t}");
assert_eq!(&s, "[1234]\nTensor[[], u32]");
let t = t.to_dtype(DType::F32)?.neg()?;
let s = format!("{}", (&t / 10.0)?);
ass... | candle/candle-core/tests/display_tests.rs/0 | {
"file_path": "candle/candle-core/tests/display_tests.rs",
"repo_id": "candle",
"token_count": 1395
} | 21 |
[package]
name = "candle-datasets"
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]
byteorder = { workspace = true }
candle = { workspace = true }... | candle/candle-datasets/Cargo.toml/0 | {
"file_path": "candle/candle-datasets/Cargo.toml",
"repo_id": "candle",
"token_count": 201
} | 22 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::Parser;
use candle_transformers::models::bigcode::{Config, GPTBigCode};
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers:... | candle/candle-examples/examples/bigcode/main.rs/0 | {
"file_path": "candle/candle-examples/examples/bigcode/main.rs",
"repo_id": "candle",
"token_count": 2134
} | 23 |
# candle-efficientvit
[EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention](https://arxiv.org/abs/2305.07027).
This candle implementation uses a pre-trained EfficientViT (from Microsoft Research Asia) network for inference.
The classification head has been trained on the ImageNet dataset and... | candle/candle-examples/examples/efficientvit/README.md/0 | {
"file_path": "candle/candle-examples/examples/efficientvit/README.md",
"repo_id": "candle",
"token_count": 273
} | 24 |
use candle::backend::BackendStorage;
use candle::{CpuStorage, CustomOp1, DType, Device, IndexOp, Layout, Result, Shape, Tensor, D};
use candle_nn::{Embedding, Linear, Module, RmsNorm};
use cudarc::nccl::safe::{Comm, ReduceOp};
use half::f16;
use serde::Deserialize;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use sup... | candle/candle-examples/examples/llama_multiprocess/model.rs/0 | {
"file_path": "candle/candle-examples/examples/llama_multiprocess/model.rs",
"repo_id": "candle",
"token_count": 7542
} | 25 |
# candle-mobileone
[MobileOne: An Improved One millisecond Mobile Backbone](https://arxiv.org/abs/2206.04040).
This candle implementation uses a pre-trained MobileOne network for inference. The
classification head has been trained on the ImageNet dataset and returns the
probabilities for the top-5 classes.
## Runnin... | candle/candle-examples/examples/mobileone/README.md/0 | {
"file_path": "candle/candle-examples/examples/mobileone/README.md",
"repo_id": "candle",
"token_count": 254
} | 26 |
import gymnasium as gym
import numpy as np
from collections import deque
from PIL import Image
from multiprocessing import Process, Pipe
# atari_wrappers.py
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset.
No... | candle/candle-examples/examples/reinforcement-learning/atari_wrappers.py/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/atari_wrappers.py",
"repo_id": "candle",
"token_count": 4740
} | 27 |
# candle-segformer
- [HuggingFace Segformer Model Card][segformer]
- [`mit-b0` - An encoder only pretrained model][encoder]
- [`segformer-b0-finetuned-ade-512-512` - A fine tuned model for segmentation][ade512]
## How to run the example
If you want you can use the example images from this [pull request][pr], downloa... | candle/candle-examples/examples/segformer/README.md/0 | {
"file_path": "candle/candle-examples/examples/segformer/README.md",
"repo_id": "candle",
"token_count": 357
} | 28 |
use candle::{IndexOp, Result, Tensor, D};
use tokenizers::Tokenizer;
const LANGUAGES: [(&str, &str); 99] = [
("en", "english"),
("zh", "chinese"),
("de", "german"),
("es", "spanish"),
("ru", "russian"),
("ko", "korean"),
("fr", "french"),
("ja", "japanese"),
("pt", "portuguese"),
... | candle/candle-examples/examples/whisper/multilingual.rs/0 | {
"file_path": "candle/candle-examples/examples/whisper/multilingual.rs",
"repo_id": "candle",
"token_count": 1846
} | 29 |
// Copyright (c) 2023, Tri Dao.
// Splitting the different head dimensions to different files to speed up compilation.
// This file is auto-generated. See "generate_kernels.py"
#include "flash_fwd_launch_template.h"
template<>
void run_mha_fwd_<cutlass::half_t, 128>(Flash_fwd_params ¶ms, cudaStream_t stream) {
... | candle/candle-flash-attn/kernels/flash_fwd_hdim128_fp16_sm80.cu/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash_fwd_hdim128_fp16_sm80.cu",
"repo_id": "candle",
"token_count": 135
} | 30 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
#include "static_switch.h"
#include "flash.h"
#include "flash_fwd_kernel.h"
template<typename Kernel_traits, bo... | 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": 7583
} | 31 |
#include "cuda_utils.cuh"
#include<stdint.h>
template <typename S, typename T>
__device__ void cast_(
const size_t numel,
const size_t num_dims,
const size_t *info,
const S *inp,
T *out
) {
const size_t *dims = info;
const size_t *strides = info + num_dims;
if (info == nullptr || is_con... | candle/candle-kernels/src/cast.cu/0 | {
"file_path": "candle/candle-kernels/src/cast.cu",
"repo_id": "candle",
"token_count": 2171
} | 32 |
#include <metal_stdlib>
using namespace metal;
#define MAX(x, y) ((x) > (y) ? (x) : (y))
template <typename T>
METAL_FUNC void im2col(
constant size_t &dst_numel,
constant size_t &h_out,
constant size_t &w_out,
constant size_t &h_k,
constant size_t &w_k,
constant size_t &stride,
constant ... | candle/candle-metal-kernels/src/conv.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/conv.metal",
"repo_id": "candle",
"token_count": 6489
} | 33 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{DType, Device, Result, Tensor};
use candle_nn::{linear, AdamW, Linear, Module, Optimizer, ParamsAdamW, VarBuilder, VarMap};
fn gen_data() -> Result<(Tensor, Tensor)> {
// Generate some sam... | candle/candle-nn/examples/basic_optimizer.rs/0 | {
"file_path": "candle/candle-nn/examples/basic_optimizer.rs",
"repo_id": "candle",
"token_count": 595
} | 34 |
//! Recurrent Neural Networks
use candle::{DType, Device, IndexOp, Result, Tensor};
/// Trait for Recurrent Neural Networks.
#[allow(clippy::upper_case_acronyms)]
pub trait RNN {
type State: Clone;
/// A zero state from which the recurrent network is usually initialized.
fn zero_state(&self, batch_dim: us... | candle/candle-nn/src/rnn.rs/0 | {
"file_path": "candle/candle-nn/src/rnn.rs",
"repo_id": "candle",
"token_count": 4874
} | 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 ::candle::Tensor;
use pyo3::prelude::*;
#[derive(Clone, Debug)]
/// Represents an absolute shape e.g. (1, 2, 3)
pub struct PyShape(Vec<usize>);
impl<'source> pyo3::FromPyObject<'source> for PyShape {
fn extract(ob: &'source PyAny) -> PyResult<Self> {
if ob.is_none() {
return Err(PyErr::new... | candle/candle-pyo3/src/shape.rs/0 | {
"file_path": "candle/candle-pyo3/src/shape.rs",
"repo_id": "candle",
"token_count": 1646
} | 38 |
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": 7941
} | 39 |
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": 6423
} | 40 |
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": 4375
} | 41 |
use candle::{IndexOp, Result, Tensor};
use candle_nn::{Module, VarBuilder};
use super::transformer::TwoWayTransformer;
#[derive(Debug)]
struct MlpMaskDecoder {
layers: Vec<super::Linear>,
sigmoid_output: bool,
span: tracing::Span,
}
impl MlpMaskDecoder {
fn new(
input_dim: usize,
hidd... | candle/candle-transformers/src/models/segment_anything/mask_decoder.rs/0 | {
"file_path": "candle/candle-transformers/src/models/segment_anything/mask_decoder.rs",
"repo_id": "candle",
"token_count": 4213
} | 42 |
//! 2D UNet Building Blocks
//!
use super::attention::{
AttentionBlock, AttentionBlockConfig, SpatialTransformer, SpatialTransformerConfig,
};
use super::resnet::{ResnetBlock2D, ResnetBlock2DConfig};
use crate::models::with_tracing::{conv2d, Conv2d};
use candle::{Module, Result, Tensor, D};
use candle_nn as nn;
#[... | candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs",
"repo_id": "candle",
"token_count": 13815
} | 43 |
use candle::{Result, Tensor};
#[derive(Debug, Clone)]
pub struct DDPMWSchedulerConfig {
scaler: f64,
s: f64,
}
impl Default for DDPMWSchedulerConfig {
fn default() -> Self {
Self {
scaler: 1f64,
s: 0.008f64,
}
}
}
pub struct DDPMWScheduler {
init_alpha_cump... | candle/candle-transformers/src/models/wuerstchen/ddpm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/wuerstchen/ddpm.rs",
"repo_id": "candle",
"token_count": 1537
} | 44 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to Candle!</title>
<link data-trunk rel="copy-file" href="tokenizer.json" />
<link data-trunk rel="copy-file" href="model.bin" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
<l... | candle/candle-wasm-examples/llama2-c/index.html/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/index.html",
"repo_id": "candle",
"token_count": 315
} | 45 |
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
pub fn log(s: &str);
}
#[macro_export]
macro_rules! console_log {
// Note that this is using the `log` function impor... | candle/candle-wasm-examples/phi/src/lib.rs/0 | {
"file_path": "candle/candle-wasm-examples/phi/src/lib.rs",
"repo_id": "candle",
"token_count": 183
} | 46 |
//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
} | 47 |
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
} | 48 |
import { navigating } from "$app/stores";
import { tick } from "svelte";
import { get } from "svelte/store";
const detachedOffset = 10;
/**
* @param node element to snap scroll to bottom
* @param dependency pass in a dependency to update scroll on changes.
*/
export const snapScrollToBottom = (node: HTMLElement, d... | chat-ui/src/lib/actions/snapScrollToBottom.ts/0 | {
"file_path": "chat-ui/src/lib/actions/snapScrollToBottom.ts",
"repo_id": "chat-ui",
"token_count": 437
} | 49 |
<script lang="ts">
import { page } from "$app/stores";
import { getHref } from "$lib/utils/getHref";
import PaginationArrow from "./PaginationArrow.svelte";
export let classNames = "";
export let numItemsPerPage: number;
export let numTotalItems: number;
const ELLIPSIS_IDX = -1 as const;
$: numTotalPages = M... | chat-ui/src/lib/components/Pagination.svelte/0 | {
"file_path": "chat-ui/src/lib/components/Pagination.svelte",
"repo_id": "chat-ui",
"token_count": 1210
} | 50 |
<script lang="ts">
import type { Message } from "$lib/types/Message";
import { createEventDispatcher, onDestroy, tick } from "svelte";
import CarbonSendAltFilled from "~icons/carbon/send-alt-filled";
import CarbonExport from "~icons/carbon/export";
import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
... | chat-ui/src/lib/components/chat/ChatWindow.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatWindow.svelte",
"repo_id": "chat-ui",
"token_count": 5436
} | 51 |
// Shouldn't be needed if we dove into sveltekit internals, see https://github.com/huggingface/chat-ui/pull/88#issuecomment-1523173850
import { setTimeout } from "node:timers/promises";
import { collections } from "./database";
let closed = false;
process.on("SIGINT", () => {
closed = true;
});
export let abortedGe... | chat-ui/src/lib/server/abortedGenerations.ts/0 | {
"file_path": "chat-ui/src/lib/server/abortedGenerations.ts",
"repo_id": "chat-ui",
"token_count": 267
} | 52 |
import { HF_ACCESS_TOKEN, HF_TOKEN } from "$env/static/private";
import { buildPrompt } from "$lib/buildPrompt";
import { textGenerationStream } from "@huggingface/inference";
import type { Endpoint } from "../endpoints";
import { z } from "zod";
export const endpointTgiParametersSchema = z.object({
weight: z.number(... | chat-ui/src/lib/server/endpoints/tgi/endpointTgi.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/tgi/endpointTgi.ts",
"repo_id": "chat-ui",
"token_count": 526
} | 53 |
import { JSDOM, VirtualConsole } from "jsdom";
export async function searchWebLocal(query: string) {
const abortController = new AbortController();
setTimeout(() => abortController.abort(), 10000);
const htmlString = await fetch("https://www.google.com/search?hl=en&q=" + query, {
signal: abortController.signal,
... | chat-ui/src/lib/server/websearch/searchWebLocal.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/searchWebLocal.ts",
"repo_id": "chat-ui",
"token_count": 438
} | 54 |
import type { Session } from "./Session";
import type { Timestamps } from "./Timestamps";
import type { User } from "./User";
export interface MessageEvent extends Pick<Timestamps, "createdAt"> {
userId: User["_id"] | Session["sessionId"];
ip?: string;
}
| chat-ui/src/lib/types/MessageEvent.ts/0 | {
"file_path": "chat-ui/src/lib/types/MessageEvent.ts",
"repo_id": "chat-ui",
"token_count": 80
} | 55 |
import { sum } from "./sum";
export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array {
const totalLength = sum(arrays.map((a) => a.length));
const result = new Uint8Array(totalLength);
let offset = 0;
for (const array of arrays) {
result.set(array, offset);
offset += array.length;
}
return result... | chat-ui/src/lib/utils/concatUint8Arrays.ts/0 | {
"file_path": "chat-ui/src/lib/utils/concatUint8Arrays.ts",
"repo_id": "chat-ui",
"token_count": 117
} | 56 |
export async function sha256(input: string): Promise<string> {
const utf8 = new TextEncoder().encode(input);
const hashBuffer = await crypto.subtle.digest("SHA-256", utf8);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join(""... | chat-ui/src/lib/utils/sha256.ts/0 | {
"file_path": "chat-ui/src/lib/utils/sha256.ts",
"repo_id": "chat-ui",
"token_count": 119
} | 57 |
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
import { describe, expect, it } from "vitest";
// function used to insert conversations used for testing
export const insertLegacyConversation = async () => {
const res = await collections.conversations.insertOne({
_id: new Obj... | chat-ui/src/lib/utils/tree/treeHelpers.spec.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/treeHelpers.spec.ts",
"repo_id": "chat-ui",
"token_count": 1864
} | 58 |
<script lang="ts">
import type { PageData } from "./$types";
import { PUBLIC_APP_ASSETS, PUBLIC_ORIGIN } from "$env/static/public";
import { isHuggingChat } from "$lib/utils/isHuggingChat";
import { goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/stores";
import Ca... | chat-ui/src/routes/assistants/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/assistants/+page.svelte",
"repo_id": "chat-ui",
"token_count": 4279
} | 59 |
<script lang="ts">
import type { PageData } from "./$types";
import { PUBLIC_APP_NAME } from "$env/static/public";
import { isHuggingChat } from "$lib/utils/isHuggingChat";
import { base } from "$app/paths";
import { page } from "$app/stores";
import CarbonHelpFilled from "~icons/carbon/help-filled";
export ... | chat-ui/src/routes/models/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/models/+page.svelte",
"repo_id": "chat-ui",
"token_count": 1103
} | 60 |
import { collections } from "$lib/server/database";
import { error, type RequestHandler } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
export const GET: RequestHandler = async ({ params }) => {
const assistant = await collections.assistants.findOne({
_id: new ObjectId(params.assistantId),
});
if (!a... | chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/avatar.jpg/+server.ts/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/avatar.jpg/+server.ts",
"repo_id": "chat-ui",
"token_count": 385
} | 61 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
<path
fill="#2063EC"
d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z"
/>
</svg>
| chat-ui/static/chatui/logo.svg/0 | {
"file_path": "chat-ui/static/chatui/logo.svg",
"repo_id": "chat-ui",
"token_count": 125
} | 62 |
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
| datasets/.dvcignore/0 | {
"file_path": "datasets/.dvcignore",
"repo_id": "datasets",
"token_count": 40
} | 63 |
.PHONY: quality style test
check_dirs := tests src benchmarks metrics utils
# Check that source code meets quality standards
quality:
ruff check $(check_dirs) setup.py # linter
ruff format --check $(check_dirs) setup.py # formatter
# Format source code automatically
style:
ruff check --fix $(check_dirs) setup.... | datasets/Makefile/0 | {
"file_path": "datasets/Makefile",
"repo_id": "datasets",
"token_count": 149
} | 64 |
import timeit
import numpy as np
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def get_duration(func):
def wrapper(*args, **kwargs):
starttime = timeit.default_timer()
_ = func(*args, **kwargs)
delta = timeit.default_timer()... | datasets/benchmarks/utils.py/0 | {
"file_path": "datasets/benchmarks/utils.py",
"repo_id": "datasets",
"token_count": 927
} | 65 |
# Beam Datasets
<Tip warning={true}>
The Beam API is deprecated and will be removed in the next major release.
</Tip>
Some datasets are too large to be processed on a single machine. Instead, you can process them with [Apache Beam](https://beam.apache.org/), a library for parallel data processing. The processing p... | datasets/docs/source/beam.mdx/0 | {
"file_path": "datasets/docs/source/beam.mdx",
"repo_id": "datasets",
"token_count": 594
} | 66 |
# 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
} | 67 |
# Structure your repository
To host and share your dataset, create a dataset repository on the Hugging Face Hub and upload your data files.
This guide will show you how to structure your dataset repository when you upload it.
A dataset with a supported structure and file format (`.txt`, `.csv`, `.parquet`, `.jsonl`, ... | datasets/docs/source/repository_structure.mdx/0 | {
"file_path": "datasets/docs/source/repository_structure.mdx",
"repo_id": "datasets",
"token_count": 2588
} | 68 |
# Metric Card for BERT Score
## Metric description
BERTScore is an automatic evaluation metric for text generation that computes a similarity score for each token in the candidate sentence with each token in the reference sentence. It leverages the pre-trained contextual embeddings from [BERT](https://huggingface.co/... | datasets/metrics/bertscore/README.md/0 | {
"file_path": "datasets/metrics/bertscore/README.md",
"repo_id": "datasets",
"token_count": 1908
} | 69 |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets/metrics/competition_math/competition_math.py/0 | {
"file_path": "datasets/metrics/competition_math/competition_math.py",
"repo_id": "datasets",
"token_count": 1181
} | 70 |
# Metric Card for IndicGLUE
## Metric description
This metric is used to compute the evaluation metric for the [IndicGLUE dataset](https://huggingface.co/datasets/indic_glue).
IndicGLUE is a natural language understanding benchmark for Indian languages. It contains a wide variety of tasks and covers 11 major Indian ... | datasets/metrics/indic_glue/README.md/0 | {
"file_path": "datasets/metrics/indic_glue/README.md",
"repo_id": "datasets",
"token_count": 1527
} | 71 |
# Metric Card for Pearson Correlation Coefficient (pearsonr)
## Metric Description
Pearson correlation coefficient and p-value for testing non-correlation.
The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that each data... | datasets/metrics/pearsonr/README.md/0 | {
"file_path": "datasets/metrics/pearsonr/README.md",
"repo_id": "datasets",
"token_count": 1387
} | 72 |
# Metric Card for seqeval
## Metric description
seqeval is a Python framework for sequence labeling evaluation. seqeval can evaluate the performance of chunking tasks such as named-entity recognition, part-of-speech tagging, semantic role labeling and so on.
## How to use
Seqeval produces labelling scores along ... | datasets/metrics/seqeval/README.md/0 | {
"file_path": "datasets/metrics/seqeval/README.md",
"repo_id": "datasets",
"token_count": 2355
} | 73 |
# 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/wer/wer.py/0 | {
"file_path": "datasets/metrics/wer/wer.py",
"repo_id": "datasets",
"token_count": 1452
} | 74 |
from typing import List, Optional, TypeVar
from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interle... | datasets/src/datasets/combine.py/0 | {
"file_path": "datasets/src/datasets/combine.py",
"repo_id": "datasets",
"token_count": 4607
} | 75 |
import glob
import io
import os
import posixpath
import re
import tarfile
import time
import xml.dom.minidom
import zipfile
from asyncio import TimeoutError
from io import BytesIO
from itertools import chain
from pathlib import Path, PurePosixPath
from typing import Any, Callable, Dict, Generator, Iterable, List, Optio... | datasets/src/datasets/download/streaming_download_manager.py/0 | {
"file_path": "datasets/src/datasets/download/streaming_download_manager.py",
"repo_id": "datasets",
"token_count": 18436
} | 76 |
# Copyright 2020 The HuggingFace 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 agreed to... | datasets/src/datasets/formatting/tf_formatter.py/0 | {
"file_path": "datasets/src/datasets/formatting/tf_formatter.py",
"repo_id": "datasets",
"token_count": 1885
} | 77 |
# 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 a... | datasets/src/datasets/metric.py/0 | {
"file_path": "datasets/src/datasets/metric.py",
"repo_id": "datasets",
"token_count": 11908
} | 78 |
from typing import List
import datasets
from datasets.tasks import ImageClassification
from ..folder_based_builder import folder_based_builder
logger = datasets.utils.logging.get_logger(__name__)
class ImageFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""BuilderConfig for ImageFolder."""
... | datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py",
"repo_id": "datasets",
"token_count": 883
} | 79 |
from .parallel import parallel_backend, parallel_map, ParallelBackendConfig # noqa F401
| datasets/src/datasets/parallel/__init__.py/0 | {
"file_path": "datasets/src/datasets/parallel/__init__.py",
"repo_id": "datasets",
"token_count": 25
} | 80 |
from typing import Any, Dict, List, Optional, Union
from .. import config
from ..exceptions import DatasetsError
from .file_utils import (
get_authentication_headers_for_url,
http_get,
)
from .logging import get_logger
logger = get_logger(__name__)
class DatasetsServerError(DatasetsError):
"""Dataset-s... | datasets/src/datasets/utils/_datasets_server.py/0 | {
"file_path": "datasets/src/datasets/utils/_datasets_server.py",
"repo_id": "datasets",
"token_count": 1946
} | 81 |
# 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/utils/py_utils.py/0 | {
"file_path": "datasets/src/datasets/utils/py_utils.py",
"repo_id": "datasets",
"token_count": 10570
} | 82 |
---
YAML tags (full spec here: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1):
- copy-paste the tags obtained with the online tagging app: https://huggingface.co/spaces/huggingface/datasets-tagging
---
# Dataset Card Creation Guide
## Table of Contents
- [Dataset Card Creation Guide](#datas... | datasets/templates/README_guide.md/0 | {
"file_path": "datasets/templates/README_guide.md",
"repo_id": "datasets",
"token_count": 3254
} | 83 |
import io
import json
import fsspec
import pytest
from datasets import Dataset, DatasetDict, Features, NamedSplit, Value
from datasets.io.json import JsonDatasetReader, JsonDatasetWriter
from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases
def _check_json_dataset(dataset, expected... | datasets/tests/io/test_json.py/0 | {
"file_path": "datasets/tests/io/test_json.py",
"repo_id": "datasets",
"token_count": 5153
} | 84 |
import copy
import os
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import pytest
from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
from datasets.features import Array... | datasets/tests/test_arrow_writer.py/0 | {
"file_path": "datasets/tests/test_arrow_writer.py",
"repo_id": "datasets",
"token_count": 6236
} | 85 |
from urllib.parse import quote
import pytest
from datasets.utils.hub import hf_hub_url
@pytest.mark.parametrize("repo_id", ["canonical_dataset_name", "org-name/dataset-name"])
@pytest.mark.parametrize("filename", ["filename.csv", "filename with blanks.csv"])
@pytest.mark.parametrize("revision", [None, "v2"])
def te... | datasets/tests/test_hub.py/0 | {
"file_path": "datasets/tests/test_hub.py",
"repo_id": "datasets",
"token_count": 219
} | 86 |
import pytest
from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
"split_dict",
[
SplitDict(),
SplitDict({"train": SplitInfo(name="train", num_bytes=1337, num_examples=42, dataset_name="my_dataset")}),
SplitDict({"train... | datasets/tests/test_splits.py/0 | {
"file_path": "datasets/tests/test_splits.py",
"repo_id": "datasets",
"token_count": 622
} | 87 |
# Setup [[setup]]
After all this information, it's time to get started. We're going to do two things:
1. **Create your Hugging Face account** if it's not already done
2. **Sign up to Discord and introduce yourself** (don't be shy 🤗)
### Let's create my Hugging Face account
(If it's not already done) create an acco... | deep-rl-class/units/en/unit0/setup.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit0/setup.mdx",
"repo_id": "deep-rl-class",
"token_count": 389
} | 88 |
# Conclusion [[conclusion]]
Congrats on finishing this chapter! There was a lot of information. And congrats on finishing the tutorials. You’ve just implemented your first RL agent from scratch and shared it on the Hub 🥳.
Implementing from scratch when you study a new architecture **is important to understand how it... | deep-rl-class/units/en/unit2/conclusion.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit2/conclusion.mdx",
"repo_id": "deep-rl-class",
"token_count": 337
} | 89 |
# The Deep Q-Network (DQN) [[deep-q-network]]
This is the architecture of our Deep Q-Learning network:
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit4/deep-q-network.jpg" alt="Deep Q Network"/>
As input, we take a **stack of 4 frames** passed through the netwo... | deep-rl-class/units/en/unit3/deep-q-network.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit3/deep-q-network.mdx",
"repo_id": "deep-rl-class",
"token_count": 888
} | 90 |
# Bonus: Learn to create your own environments with Unity and MLAgents
**You can create your own reinforcement learning environments with Unity and MLAgents**. Using a game engine such as Unity can be intimidating at first, but here are the steps you can take to learn smoothly.
## Step 1: Know how to use Unity
- The... | deep-rl-class/units/en/unit5/bonus.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit5/bonus.mdx",
"repo_id": "deep-rl-class",
"token_count": 360
} | 91 |
# Additional Readings [[additional-readings]]
## An introduction to multi-agents
- [Multi-agent reinforcement learning: An overview](https://www.dcsc.tudelft.nl/~bdeschutter/pub/rep/10_003.pdf)
- [Multiagent Reinforcement Learning, Marc Lanctot](https://rlss.inria.fr/files/2019/07/RLSS_Multiagent.pdf)
- [Example of ... | deep-rl-class/units/en/unit7/additional-readings.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit7/additional-readings.mdx",
"repo_id": "deep-rl-class",
"token_count": 432
} | 92 |
# The intuition behind PPO [[the-intuition-behind-ppo]]
The idea with Proximal Policy Optimization (PPO) is that we want to improve the training stability of the policy by limiting the change you make to the policy at each training epoch: **we want to avoid having too large of a policy update.**
For two reasons:
- W... | deep-rl-class/units/en/unit8/intuition-behind-ppo.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit8/intuition-behind-ppo.mdx",
"repo_id": "deep-rl-class",
"token_count": 426
} | 93 |
# Language models in RL
## LMs encode useful knowledge for agents
**Language models** (LMs) can exhibit impressive abilities when manipulating text such as question-answering or even step-by-step reasoning. Additionally, their training on massive text corpora allowed them to **encode various types of knowledge includi... | deep-rl-class/units/en/unitbonus3/language-models.mdx/0 | {
"file_path": "deep-rl-class/units/en/unitbonus3/language-models.mdx",
"repo_id": "deep-rl-class",
"token_count": 1011
} | 94 |
import argparse
import csv
import gc
import os
from dataclasses import dataclass
from typing import Dict, List, Union
import torch
import torch.utils.benchmark as benchmark
GITHUB_SHA = os.getenv("GITHUB_SHA", None)
BENCHMARK_FIELDS = [
"pipeline_cls",
"ckpt_id",
"batch_size",
"num_inference_steps",
... | diffusers/benchmarks/utils.py/0 | {
"file_path": "diffusers/benchmarks/utils.py",
"repo_id": "diffusers",
"token_count": 1254
} | 95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.