logo
Browse Source

Remove dc2 for towhee1.0

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 1 year ago
parent
commit
df54044de5
  1. 4
      README.md
  2. 4
      s_bert.py

4
README.md

@ -20,7 +20,7 @@ to generate a text embedding for the sentence "This is a sentence.".
*Write a pipeline with explicit inputs/outputs name specifications:*
```python
from towhee.dc2 import pipe, ops, DataCollection
from towhee import pipe, ops, DataCollection
p = (
pipe.input('sentence')
@ -140,4 +140,4 @@ new_op = towhee.ops.sentence_embedding.sbert(model_name=model_path).get_op()
### Dive deep and customize your training
You can change the [training script](https://towhee.io/sentence-embedding/sbert/src/branch/main/train_sts_task.py) in your customer way.
Or your can refer to the original [sbert training guide](https://www.sbert.net/docs/training/overview.html) and [code example](https://github.com/UKPLab/sentence-transformers/tree/master/examples/training) for more information.
Or your can refer to the original [sbert training guide](https://www.sbert.net/docs/training/overview.html) and [code example](https://github.com/UKPLab/sentence-transformers/tree/master/examples/training) for more information.

4
s_bert.py

@ -85,6 +85,8 @@ class STransformers(NNOperator):
else:
sentences = txt
inputs = self.tokenize(sentences)
for k, v in inputs.items():
inputs[k] = v.to(self.device)
embs = self.model(**inputs).cpu().detach().numpy()
if isinstance(txt, str):
embs = embs.squeeze(0)
@ -271,4 +273,4 @@ if __name__ == '__main__':
'num_epochs': 4,
'model_save_path': './output'
}
op.train(training_config)
op.train(training_config)

Loading…
Cancel
Save