Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/supported_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@

'sentence-transformers/all-distilroberta-v1',
'sentence-transformers/all-roberta-large-v1',
'julien-c/EsperBERTo-small-pos',
],
'sam': [
'facebook/sam-vit-base',
Expand Down
17 changes: 17 additions & 0 deletions src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,22 @@ export class RobertaForSequenceClassification extends RobertaPreTrainedModel {
}
}

/**
* RobertaForTokenClassification class for performing token classification on Roberta models.
* @extends RobertaPreTrainedModel
*/
export class RobertaForTokenClassification extends RobertaPreTrainedModel {
/**
* Calls the model on new inputs.
*
* @param {Object} model_inputs The inputs to the model.
* @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
*/
async _call(model_inputs) {
return new TokenClassifierOutput(await super._call(model_inputs));
}
}

/**
* RobertaForQuestionAnswering class for performing question answering on Roberta models.
* @extends RobertaPreTrainedModel
Expand Down Expand Up @@ -2514,6 +2530,7 @@ const MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES = new Map([
const MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES = new Map([
['bert', BertForTokenClassification],
['distilbert', DistilBertForTokenClassification],
['roberta', RobertaForTokenClassification],
]);

const MODEL_FOR_SEQ_2_SEQ_MAPPING_NAMES = new Map([
Expand Down