Justus-Jonas commited on
Commit
7d050cf
·
1 Parent(s): ab7434f

adding examples

Browse files
Files changed (1) hide show
  1. README.md +43 -1
README.md CHANGED
@@ -4,4 +4,46 @@ license: cc-by-nc-sa-4.0
4
 
5
  Imaginary Embeddings utilize Curved Contrastive Learning (see paper [Imagination Is All You Need!](https://arxiv.org/pdf/2211.07591.pdf) (ACL 2023)) on [Sentence Transformers](https://sbert.net/) for long-short term dialogue planning and efficient abstract sequence modeling.
6
 
7
- This model does not use speaker tokens and was evaluated in the Long-Term planning and sequence modeling experiments
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  Imaginary Embeddings utilize Curved Contrastive Learning (see paper [Imagination Is All You Need!](https://arxiv.org/pdf/2211.07591.pdf) (ACL 2023)) on [Sentence Transformers](https://sbert.net/) for long-short term dialogue planning and efficient abstract sequence modeling.
6
 
7
+ This model does not use speaker tokens and was evaluated in the Long-Term planning and sequence modeling experiments.
8
+
9
+ ## Usage Sequence Modeling:
10
+
11
+ ```python
12
+ from imaginaryNLP.ImaginaryEmbeddingsForSequenceModeling import EvalImaginaryEmbeddingsForSequenceModeling
13
+
14
+ # Load the model
15
+ seq = EvalImaginaryEmbeddingsForSequenceModeling('Justus-Jonas/Imaginary-Embeddings-Classic', speaker_token=False)
16
+
17
+ # add candidates and context
18
+ seq.load_candidates_from_strings(["I'm fine, thanks. How are you?", "Where did you go?", "ACL is an interesting conference"])
19
+ seq.create_context(["Hi!",'Hey, how are you?'], precompute_top_p=0.8)
20
+
21
+ # pre-compute and keep 80% of utterances
22
+ seq.sequence_modeling_with_precompute("I am doing good. Today I went for a walk. ")
23
+ ```
24
+
25
+ ## Long-Term-Planning
26
+
27
+ ```python
28
+ from imaginaryNLP.ImaginaryEmbeddingsForLTP import ImaginaryEmbeddingsForLTP
29
+
30
+ ltp = ImaginaryEmbeddingsForLTP('Justus-Jonas/Imaginary-Embeddings-Classic', speaker_token=False)
31
+
32
+ # add a contex
33
+ ltp.create_context([' Hello', 'Hi , great to meet you ! '])
34
+
35
+ # add goals
36
+ ltp.add_goal(" great to hear that ! ")
37
+ ltp.add_goal(" Want to go for a walk ? ")
38
+ ltp.add_goal(" Bye !")
39
+
40
+ # greedy curving
41
+ ltp.greedy_curving()
42
+
43
+ # imaginary embedding chains
44
+ ltp.imaginary_embedding_chains()
45
+
46
+ # imaginary embedding chains with curving
47
+ ltp.imaginary_embedding_chains_with_curving()
48
+ ```
49
+