Skip to content

Commit

Permalink
Add CLS pooling option to feature-extraction pipeline (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova authored Dec 11, 2023
1 parent 8e49e5e commit 2cd2997
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ export class FeatureExtractionPipeline extends Pipeline {
// Skip pooling
} else if (pooling === 'mean') {
result = mean_pooling(result, inputs.attention_mask);
} else if (pooling === 'cls') {
result = result.slice(null, 0);
} else {
throw Error(`Pooling method '${pooling}' not supported.`);
}
Expand Down

0 comments on commit 2cd2997

Please sign in to comment.