You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you point me in the right direction on how to setup the ZeroShotClassificationModel for DeBERTaV2?
This might be a good time to add an example for this, this would likely help #425 as well. (I would be happy to propose a PR once I got the hang of it)
Thanks in advance.
Best regards,
Philipp-Sc
The text was updated successfully, but these errors were encountered:
use rust_bert::pipelines::common::{ModelResource,ModelType,ONNXModelResources};use rust_bert::pipelines::zero_shot_classification::ZeroShotClassificationModel;use rust_bert::pipelines::zero_shot_classification::ZeroShotClassificationConfig;use rust_bert::resources::LocalResource;use std::path::PathBuf;fnmodel(base_path:&str){let model_path = PathBuf::from(base_path.to_owned() + "onnx/model.onnx");let config_path = PathBuf::from(base_path.to_owned() + "config.json");let vocab_path = PathBuf::from(base_path.to_owned() + "spm.model");let classification_model = ZeroShotClassificationModel::new(ZeroShotClassificationConfig::new(ModelType::DebertaV2,ModelResource::ONNX(ONNXModelResources{encoder_resource:Some(Box::new(LocalResource::from(model_path))),
..Default::default()}),LocalResource::from(config_path),LocalResource::from(vocab_path),None,false,None,None,)).expect("could not create zero_shot_classification model");let input = ["Who are you voting for in 2020?","The prime minister has announced a stimulus package which was widely criticized by the opposition."];let labels = &["politics","public health","economics","sports"];let output = classification_model.predict_multilabel(&input,
labels,None,128);println!("{:?}", output);}
Hi @jondot @guillaume-be
I work on a llm-fraud-detection library using rust-bert and llama.cpp.
In the process of updating the repo, I like to test DeBERTaV2 for my zero shot classification task.
Currently I am using BERT which is very simple to setup due to the provided
Default
implementation.See
Do I need to download the model on my own and convert it to rust and provide the paths like this? See #406
Can you point me in the right direction on how to setup the
ZeroShotClassificationModel
for DeBERTaV2?This might be a good time to add an example for this, this would likely help #425 as well. (I would be happy to propose a PR once I got the hang of it)
Thanks in advance.
Best regards,
Philipp-Sc
The text was updated successfully, but these errors were encountered: