mirror of
https://github.com/modelscope/modelscope.git
synced 2026-07-11 21:09:08 +02:00
[to #42322933] init
This commit is contained in:
@@ -31,8 +31,8 @@ class NLIPipeline(Pipeline):
|
||||
"""
|
||||
assert isinstance(model, str) or isinstance(model, SbertForNLI), \
|
||||
'model must be a single str or SbertForNLI'
|
||||
sc_model = model if isinstance(model,
|
||||
SbertForNLI) else SbertForNLI(model)
|
||||
sc_model = model if isinstance(
|
||||
model, SbertForNLI) else Model.from_pretrained(model)
|
||||
if preprocessor is None:
|
||||
preprocessor = NLIPreprocessor(
|
||||
sc_model.model_dir,
|
||||
|
||||
5
test.py
5
test.py
@@ -9,4 +9,7 @@ tokenizer = NLIPreprocessor(model.model_dir)
|
||||
semantic_cls = pipeline('nli', model=model, preprocessor=tokenizer)
|
||||
print(type(semantic_cls))
|
||||
|
||||
print(semantic_cls(input=('相反,这表明克林顿的敌人是疯子。', '四川商务职业学院商务管理在哪个校区?')))
|
||||
print(
|
||||
semantic_cls(
|
||||
input=('我想还有一件事也伤害到了老师的招聘,那就是他们在课堂上失去了很多的权威',
|
||||
'教师在课堂上失去权威,导致想要进入这一职业的人减少了。')))
|
||||
|
||||
Reference in New Issue
Block a user