You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.py 601 B

3 years ago
123456789101112131415
  1. from modelscope.models import SbertForNLI
  2. from modelscope.pipelines import pipeline
  3. from modelscope.preprocessors import NLIPreprocessor
  4. model = SbertForNLI('../nlp_structbert_nli_chinese-base')
  5. print(model)
  6. tokenizer = NLIPreprocessor(model.model_dir)
  7. semantic_cls = pipeline('nli', model=model, preprocessor=tokenizer)
  8. print(type(semantic_cls))
  9. print(
  10. semantic_cls(
  11. input=('我想还有一件事也伤害到了老师的招聘,那就是他们在课堂上失去了很多的权威',
  12. '教师在课堂上失去权威,导致想要进入这一职业的人减少了。')))