Fixed Clippy warnings, addition of GPT-Neo to integration tests

This commit is contained in:
Guillaume B 2021-05-06 16:59:03 +02:00
parent a9518c94fa
commit 777460bd7e
4 changed files with 8 additions and 9 deletions

View File

@ -95,6 +95,7 @@ jobs:
--test xlnet
--test longformer
--test pegasus
--test gpt_neo
convert-model:
name: Model conversion test

View File

@ -581,9 +581,11 @@ impl GptNeoAttention {
let output = attention.forward_t(
hidden_states,
layer_state,
attention_mask.ok_or(RustBertError::ValueError(
"Attention mask must be provided for Local self attention".to_string(),
))?,
attention_mask.ok_or_else(|| {
RustBertError::ValueError(
"Attention mask must be provided for Local self attention".to_string(),
)
})?,
train,
)?;
let new_layer_state = if let Some(old_layer_state) = layer_state {

View File

@ -92,11 +92,7 @@ impl GptNeoBlock {
..Default::default()
};
let ln_1 = nn::layer_norm(
p / "ln_1",
vec![config.hidden_size],
layer_norm_config.clone(),
);
let ln_1 = nn::layer_norm(p / "ln_1", vec![config.hidden_size], layer_norm_config);
let ln_2 = nn::layer_norm(p / "ln_2", vec![config.hidden_size], layer_norm_config);
let attention = GptNeoAttention::new(p / "attn", config, layer_id)?;

View File

@ -382,7 +382,7 @@ impl GptNeoModel {
};
hidden_state = hidden_state.apply_t(&self.dropout, train);
let mut output_shape = input_shape.clone();
let mut output_shape = input_shape;
output_shape.push(*hidden_state.size().last().unwrap());
let mut all_hidden_states: Option<Vec<Tensor>> = if self.output_hidden_states {