Skip to content

Commit c2e325c

Browse files
authored
Dependencies update & Clippy fixes (#483)
* wip dep & clippy updates * clippy (2) * pin ndarray to 0.15 * fmt * clippy warnings * clippy (3)
1 parent 411c224 commit c2e325c

64 files changed

Lines changed: 1685 additions & 1690 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,30 @@ rust_tokenizers = "8.1.1"
7979
tch = { version = "0.17.0", features = ["download-libtorch"] }
8080
serde_json = "1"
8181
serde = { version = "1", features = ["derive"] }
82-
ordered-float = "4.2.0"
82+
ordered-float = "5"
8383
uuid = { version = "1", features = ["v4"] }
84-
thiserror = "1"
84+
thiserror = "2"
8585
half = "2"
86-
regex = "1.10"
86+
regex = "1.11"
8787

88-
cached-path = { version = "0.6", default-features = false, optional = true }
89-
dirs = { version = "5", optional = true }
88+
cached-path = { version = "0.8", default-features = false, optional = true }
89+
dirs = { version = "6", optional = true }
9090
lazy_static = { version = "1", optional = true }
9191
ort = { version = "1.16.3", optional = true, default-features = false, features = [
9292
"half",
9393
] }
9494
ndarray = { version = "0.15", optional = true }
95-
tokenizers = { version = "0.20", optional = true, default-features = false, features = [
95+
tokenizers = { version = "0.21", optional = true, default-features = false, features = [
9696
"onig",
9797
] }
9898

9999
[dev-dependencies]
100100
anyhow = "1"
101101
csv = "1"
102-
criterion = "0.5"
103-
tokio = { version = "1.35", features = ["sync", "rt-multi-thread", "macros"] }
102+
criterion = "0.6"
103+
tokio = { version = "1.45", features = ["sync", "rt-multi-thread", "macros"] }
104104
tempfile = "3"
105-
itertools = "0.13.0"
105+
itertools = "0.14.0"
106106
tracing-subscriber = { version = "0.3", default-features = false, features = [
107107
"env-filter",
108108
"fmt",

benches/generation_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#[macro_use]
22
extern crate criterion;
33

4-
use criterion::{black_box, Criterion};
4+
use criterion::Criterion;
55
use rust_bert::gpt2::{
66
Gpt2ConfigResources, Gpt2MergesResources, Gpt2ModelResources, Gpt2VocabResources,
77
};
88
use rust_bert::pipelines::common::{ModelResource, ModelType};
99
use rust_bert::pipelines::text_generation::{TextGenerationConfig, TextGenerationModel};
1010
use rust_bert::resources::RemoteResource;
11+
use std::hint::black_box;
1112
use std::time::{Duration, Instant};
1213
use tch::Device;
1314

benches/squad_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#[macro_use]
22
extern crate criterion;
33

4-
use criterion::{black_box, Criterion};
4+
use criterion::Criterion;
55
use rust_bert::bert::{BertConfigResources, BertModelResources, BertVocabResources};
66
use rust_bert::pipelines::common::{ModelResource, ModelType};
77
use rust_bert::pipelines::question_answering::{
88
squad_processor, QaInput, QuestionAnsweringConfig, QuestionAnsweringModel,
99
};
1010
use rust_bert::resources::RemoteResource;
1111
use std::env;
12+
use std::hint::black_box;
1213
use std::path::PathBuf;
1314
use std::time::{Duration, Instant};
1415

benches/summarization_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#[macro_use]
22
extern crate criterion;
33

4-
use criterion::{black_box, Criterion};
4+
use criterion::Criterion;
55
use rust_bert::pipelines::summarization::{SummarizationConfig, SummarizationModel};
6+
use std::hint::black_box;
67
use std::time::{Duration, Instant};
78
use tch::Device;
89

benches/tensor_operations_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#[macro_use]
22
extern crate criterion;
33

4-
use criterion::{black_box, Criterion};
4+
use criterion::Criterion;
5+
use std::hint::black_box;
56
use std::time::{Duration, Instant};
67
use tch::kind::Kind;
78
use tch::{Device, Tensor};

benches/token_classification_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
1+
use criterion::{criterion_group, criterion_main, Criterion};
22
use rust_bert::pipelines::token_classification::{
33
TokenClassificationConfig, TokenClassificationModel,
44
};
5+
use std::hint::black_box;
56
use tch::Device;
67

78
fn create_model() -> TokenClassificationModel {

benches/translation_benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#[macro_use]
22
extern crate criterion;
33

4-
use criterion::{black_box, Criterion};
4+
use criterion::Criterion;
5+
use std::hint::black_box;
56
// use rust_bert::pipelines::common::ModelType;
67
// use rust_bert::pipelines::translation::TranslationOption::{Marian, T5};
78
use rust_bert::pipelines::common::ModelType;

examples/generation_gptj.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ use tch::Device;
2323
/// inputs = tokenizer(prompts, return_tensors="pt", padding=True, truncation=True).to(device)
2424
///
2525
/// with torch.no_grad():
26-
/// gen_tokens = model.generate(
27-
/// **inputs,
28-
/// min_length=0,
29-
/// max_length=32,
30-
/// do_sample=False,
31-
/// early_stopping=True,
32-
/// num_beams=1,
33-
/// num_return_sequences=1
34-
/// )
26+
/// gen_tokens = model.generate(
27+
/// **inputs,
28+
/// min_length=0,
29+
/// max_length=32,
30+
/// do_sample=False,
31+
/// early_stopping=True,
32+
/// num_beams=1,
33+
/// num_return_sequences=1
34+
/// )
3535
///
3636
/// gen_texts = tokenizer.batch_decode(gen_tokens, skip_special_tokens=True)
3737
/// ````

src/common/resources/local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl ResourceProvider for LocalResource {
2222
/// use rust_bert::resources::{LocalResource, ResourceProvider};
2323
/// use std::path::PathBuf;
2424
/// let config_resource = LocalResource {
25-
/// local_path: PathBuf::from("path/to/config.json"),
25+
/// local_path: PathBuf::from("path/to/config.json"),
2626
/// };
2727
/// let config_path = config_resource.get_local_path();
2828
/// ```
@@ -42,7 +42,7 @@ impl ResourceProvider for LocalResource {
4242
/// use rust_bert::resources::{LocalResource, ResourceProvider};
4343
/// use std::path::PathBuf;
4444
/// let config_resource = LocalResource {
45-
/// local_path: PathBuf::from("path/to/config.json"),
45+
/// local_path: PathBuf::from("path/to/config.json"),
4646
/// };
4747
/// let config_path = config_resource.get_resource();
4848
/// ```

src/common/resources/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! - LocalResource: points to a local file
1313
//! - RemoteResource: points to a remote file via a URL
1414
//! - BufferResource: refers to a buffer that contains file contents for a resource (currently only
15-
//! usable for weights)
15+
//! usable for weights)
1616
//!
1717
//! For `LocalResource` and `RemoteResource`, the local location of the file can be retrieved using
1818
//! `get_local_path`, allowing to reference the resource file location regardless if it is a remote
@@ -52,7 +52,7 @@ pub trait ResourceProvider: Debug + Send + Sync {
5252
/// use rust_bert::resources::{LocalResource, ResourceProvider};
5353
/// use std::path::PathBuf;
5454
/// let config_resource = LocalResource {
55-
/// local_path: PathBuf::from("path/to/config.json"),
55+
/// local_path: PathBuf::from("path/to/config.json"),
5656
/// };
5757
/// let config_path = config_resource.get_local_path();
5858
/// ```

0 commit comments

Comments
 (0)