mirror of
https://github.com/guillaume-be/rust-bert.git
synced 2024-09-11 12:55:34 +03:00
Fixed Clippy warnings, addition of GPT-Neo to integration tests
This commit is contained in:
parent
a9518c94fa
commit
777460bd7e
1
.github/workflows/continuous-integration.yml
vendored
1
.github/workflows/continuous-integration.yml
vendored
@ -95,6 +95,7 @@ jobs:
|
||||
--test xlnet
|
||||
--test longformer
|
||||
--test pegasus
|
||||
--test gpt_neo
|
||||
|
||||
convert-model:
|
||||
name: Model conversion test
|
||||
|
@ -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 {
|
||||
|
@ -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)?;
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user