Update README.md
Browse files
README.md
CHANGED
@@ -107,11 +107,11 @@ contexts = [
|
|
107 |
|
108 |
## convert query into a format as follows:
|
109 |
## user: {user}\nagent: {agent}\nuser: {user}
|
110 |
-
formatted_query = '\n'.join([turn['role'] + ": " + turn['content'] for turn in
|
111 |
|
112 |
## get query and context embeddings
|
113 |
query_input = tokenizer(formatted_query, return_tensors='pt')
|
114 |
-
ctx_input = tokenizer(contexts, padding=True, return_tensors='pt')
|
115 |
query_emb = query_encoder(**query_input).last_hidden_state[:, 0, :]
|
116 |
ctx_emb = context_encoder(**ctx_input).last_hidden_state[:, 0, :]
|
117 |
|
|
|
107 |
|
108 |
## convert query into a format as follows:
|
109 |
## user: {user}\nagent: {agent}\nuser: {user}
|
110 |
+
formatted_query = '\n'.join([turn['role'] + ": " + turn['content'] for turn in query]).strip()
|
111 |
|
112 |
## get query and context embeddings
|
113 |
query_input = tokenizer(formatted_query, return_tensors='pt')
|
114 |
+
ctx_input = tokenizer(contexts, padding=True, truncation=True, max_length=512, return_tensors='pt')
|
115 |
query_emb = query_encoder(**query_input).last_hidden_state[:, 0, :]
|
116 |
ctx_emb = context_encoder(**ctx_input).last_hidden_state[:, 0, :]
|
117 |
|