-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdump
51 lines (38 loc) · 1.53 KB
/
dump
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//const embeddings = await getEmbeddings(inputs,use_model);
//console.log("embeddings made with shape");
//console.log(embeddings.print(true));
//const inputsDataset = tf.data.array(embeddings);
//console.log(inputsDataset);
// const Dataset = tf.data.zip(inputsDataset,labelsDataset);
// await Dataset.take(3).forEachAsync(e=>console.log(e));
// return await model.embed(inputs).then(embeddings => {
// // console.log(inputs);
// return new Promise((resolve,reject) => {
// resolve(embeddings.array());
// });
// });
// await flatdataset.take(3).forEachAsync(e=>console.log(e));
//const inputs = flatdataset.map(values => { return values.xs;});
//const labels = flatdataset.map(values => { return values.ys;});
//console.log(inputs);
//const labelsDataset = tf.data.array(labels);
//const embedDataset = await flatdataset.mapAsync(value => await Promise.resolve({xs:getEmbeddings(value.xs,model),ys:value.ys}));
// // Playground
// use.load().then(model => {
// // Embed an array of sentences.
// const sentences = [
// 'Hello.',
// 'How are you?'
// ];
// let zxc = await model.embed(sentences);
// zxc.print(true);
// model.embed(sentences).then(embeddings => {
// // `embeddings` is a 2D tensor consisting of the 512-dimensional embeddings for each sentence.
// // So in this example `embeddings` has the shape [2, 512].
// embeddings.print(true /* verbose */);
// });
// });
// //END of playground
// return new Promise((resolve,reject) =>{
// resolve({xs:embeds_array,ys:data.ys});
// });