Skip to content

Commit

Permalink
feat: support camembert (huggingface#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierDehaene authored Oct 26, 2023
1 parent d123a5a commit c202507
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ such as:

### Supported Models

You can use any BERT or XLM-RoBERTa model with absolute positions in `text-embeddings-inference`.
You can use any BERT, CamemBERT or XLM-RoBERTa model with absolute positions in `text-embeddings-inference`.

**Support for other model types will be added in the future.**

Expand Down
1 change: 1 addition & 0 deletions backends/candle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl CandleBackend {
// Check model type
if config.model_type != Some("bert".to_string())
&& config.model_type != Some("xlm-roberta".to_string())
&& config.model_type != Some("camembert".to_string())
{
return Err(BackendError::Start(format!(
"Model {:?} is not supported",
Expand Down
13 changes: 7 additions & 6 deletions router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,13 @@ async fn main() -> Result<()> {
);
tokenizer.with_padding(None);

// Position IDs offset. Used for Roberta.
let position_offset = if &config.model_type == "xlm-roberta" {
config.pad_token_id + 1
} else {
0
};
// Position IDs offset. Used for Roberta and camembert.
let position_offset =
if &config.model_type == "xlm-roberta" || &config.model_type == "camembert" {
config.pad_token_id + 1
} else {
0
};
let max_input_length = config.max_position_embeddings - position_offset;

let tokenization_workers = args
Expand Down

0 comments on commit c202507

Please sign in to comment.