mirror of https://github.com/tracel-ai/burn.git
ci/Speed up typos checks (#907)
This commit is contained in:
parent
35df31f700
commit
8c80c9b94a
|
@ -116,5 +116,19 @@ jobs:
|
|||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: caching
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: ${{ runner.os }}-typos-${{ hashFiles('**/Cargo.toml') }}
|
||||
prefix-key: "v5-rust"
|
||||
|
||||
- name: Install typos
|
||||
env:
|
||||
TYPOS_LINK: https://github.com/crate-ci/typos/releases/download
|
||||
TYPOS_VERSION: v1.16.20
|
||||
run: |
|
||||
curl -L "$TYPOS_LINK/$TYPOS_VERSION/typos-$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz" |
|
||||
tar xz -C $HOME/.cargo/bin
|
||||
|
||||
- name: run spelling checks using typos
|
||||
run: cargo xtask run-checks typos
|
||||
run: CI_RUN=1 cargo xtask run-checks typos
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Graph {
|
|||
/// This is a owned method, so the current graph will be freed. However, the steps can
|
||||
/// be shared with other graphs, therefore they are going to be cleared.
|
||||
///
|
||||
/// This is usefull, since the graph is supposed to be consumed only once for backprop, and
|
||||
/// This is useful, since the graph is supposed to be consumed only once for backprop, and
|
||||
/// keeping all the tensors alive for multiple backward call is a heavy waste of resources.
|
||||
pub fn steps(self) -> NodeSteps {
|
||||
let mut map_drain = HashMap::new();
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::graph::NodeRef;
|
|||
///
|
||||
/// # Notes
|
||||
///
|
||||
/// This is usefull since you don't have to keep N cloned references alive event if just 1 node
|
||||
/// This is useful since you don't have to keep N cloned references alive event if just 1 node
|
||||
/// will be updated.
|
||||
///
|
||||
/// If the object is a tensor and if one reference exists, it can be updated inplace.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
mod base;
|
||||
pub use base::*;
|
||||
|
||||
// Not needed for now, usefull for different tensor memory layout
|
||||
// Not needed for now, useful for different tensor memory layout
|
||||
// pub mod conversion;
|
||||
|
|
|
@ -67,7 +67,7 @@ pub trait Adaptor<T> {
|
|||
|
||||
/// Declare a metric to be numeric.
|
||||
///
|
||||
/// This is usefull to plot the values of a metric during training.
|
||||
/// This is useful to plot the values of a metric during training.
|
||||
pub trait Numeric {
|
||||
/// Returns the numeric value of the metric.
|
||||
fn value(&self) -> f64;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::metric::{format_float, MetricEntry, Numeric};
|
||||
|
||||
/// Usefull utility to implement numeric metrics.
|
||||
/// Useful utility to implement numeric metrics.
|
||||
///
|
||||
/// # Notes
|
||||
///
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Run `run-checks` using this command:
|
||||
#
|
||||
# ./scripts/run-checks environment
|
||||
# ./run-checks.ps1 environment
|
||||
#
|
||||
# where `environment` can assume **ONLY** the following values:
|
||||
#
|
||||
|
|
|
@ -8,7 +8,7 @@ set -e
|
|||
#
|
||||
# Run `run-checks` using this command:
|
||||
#
|
||||
# ./scripts/run-checks environment
|
||||
# ./run-checks.sh environment
|
||||
#
|
||||
# where `environment` can assume **ONLY** the following values:
|
||||
#
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
//! This script publishes a crate on `crates.io`.
|
||||
//!
|
||||
//! To build this script, run the following command:
|
||||
//!
|
||||
//! rustc scripts/publish.rs --crate-type bin --out-dir scripts
|
||||
//!
|
||||
//! To run the script:
|
||||
//!
|
||||
//! ./scripts/publish crate_name
|
||||
//! cargo xtask publish INPUT_CRATE
|
||||
|
||||
use std::env;
|
||||
use std::process::{Command, Stdio};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//! It is used to check that the code compiles and passes all tests.
|
||||
//!
|
||||
//! It is also used to check that the code is formatted correctly and passes clippy.
|
||||
|
||||
use std::env;
|
||||
use std::process::{Child, Command, Stdio};
|
||||
use std::str;
|
||||
|
@ -289,8 +290,18 @@ fn std_checks() {
|
|||
}
|
||||
|
||||
fn check_typos() {
|
||||
// This path defines where typos-cl is installed on different
|
||||
// operating systems.
|
||||
let typos_cli_path = std::env::var("CARGO_HOME")
|
||||
.map(|v| std::path::Path::new(&v).join("bin/typos-cli"))
|
||||
.unwrap();
|
||||
|
||||
// Do not run cargo install on CI to speed up the computation.
|
||||
// Check whether the file has been installed on
|
||||
if std::env::var("CI_RUN").is_err() && !typos_cli_path.exists() {
|
||||
// Install typos-cli
|
||||
cargo_install(["typos-cli", "--version", "1.16.5"].into());
|
||||
}
|
||||
|
||||
println!("Running typos check \n\n");
|
||||
|
||||
|
|
Loading…
Reference in New Issue