mirror of
https://github.com/guillaume-be/rust-bert.git
synced 2024-09-11 12:55:34 +03:00
Merge remote-tracking branch 'remotes/origin/master' into benchmarks_generation
# Conflicts: # examples/summarization.rs
This commit is contained in:
commit
5f0a36c1f9
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rust-bert"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
authors = ["Guillaume Becquin <guillaume.becquin@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "Ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)"
|
||||
|
@ -17,7 +17,6 @@ use std::path::PathBuf;
|
||||
use tch::Device;
|
||||
use failure::err_msg;
|
||||
use rust_bert::pipelines::summarization::{SummarizationModel, SummarizationConfig};
|
||||
use std::time::Instant;
|
||||
|
||||
|
||||
fn main() -> failure::Fallible<()> {
|
||||
@ -71,19 +70,9 @@ telescope — scheduled for launch in 2021 — and the European Space Agency's 2
|
||||
about exoplanets like K2-18b."];
|
||||
|
||||
// Credits: WikiNews, CC BY 2.5 license (https://en.wikinews.org/wiki/Astronomers_find_water_vapour_in_atmosphere_of_exoplanet_K2-18b)
|
||||
|
||||
let num_iterations = 3;
|
||||
let mut all_iteration_times = Vec::with_capacity(num_iterations);
|
||||
|
||||
for _ in 0..num_iterations {
|
||||
let start_iteration = Instant::now();
|
||||
let output = summarization_model.summarize(&input);
|
||||
for sentence in output {
|
||||
println!("{:?}", sentence);
|
||||
}
|
||||
println!("iteration total time {:?}", start_iteration.elapsed().as_millis());
|
||||
all_iteration_times.push(start_iteration.elapsed().as_millis())
|
||||
let output = summarization_model.summarize(&input);
|
||||
for sentence in output {
|
||||
println!("{:?}", sentence);
|
||||
}
|
||||
println!("average total time {:?}", all_iteration_times.iter().sum::<u128>() / all_iteration_times.len() as u128);
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue
Block a user