Upload Orpheus_Auto_Continuations_Generator.ipynb
Browse files
inference_code/Orpheus_Auto_Continuations_Generator.ipynb
CHANGED
@@ -344,6 +344,7 @@
|
|
344 |
"temperature = 1.0\n",
|
345 |
"top_p_value = 0.96\n",
|
346 |
"num_mem_tokens = 7168 # up to 12 chunks\n",
|
|
|
347 |
"\n",
|
348 |
"# Advanced options\n",
|
349 |
"max_tok_rep_ratio = 0.95\n",
|
@@ -377,9 +378,9 @@
|
|
377 |
" \n",
|
378 |
" inp = torch.LongTensor(y).cuda()\n",
|
379 |
" \n",
|
380 |
-
"
|
381 |
" \n",
|
382 |
-
" scores = cosine_similarity(embeddings,
|
383 |
"\n",
|
384 |
" scores = [o for o in scores if o != max(scores)]\n",
|
385 |
"\n",
|
@@ -484,9 +485,9 @@
|
|
484 |
" \n",
|
485 |
" inp = torch.LongTensor([song]).cuda()\n",
|
486 |
" \n",
|
487 |
-
"
|
488 |
" \n",
|
489 |
-
" start_score = cosine_similarity(embeddings,
|
490 |
"\n",
|
491 |
" b_size = batch_size\n",
|
492 |
" stop = False\n",
|
@@ -529,8 +530,13 @@
|
|
529 |
" inp = torch.LongTensor(output).cuda()\n",
|
530 |
" \n",
|
531 |
" embs = get_embeddings(inp)\n",
|
532 |
-
"
|
533 |
-
"
|
|
|
|
|
|
|
|
|
|
|
534 |
" output_scores.extend(scores)\n",
|
535 |
" \n",
|
536 |
" scores = [o for o in output_scores if o != max(output_scores)]\n",
|
|
|
344 |
"temperature = 1.0\n",
|
345 |
"top_p_value = 0.96\n",
|
346 |
"num_mem_tokens = 7168 # up to 12 chunks\n",
|
347 |
+
"use_prime_embeddings = False\n",
|
348 |
"\n",
|
349 |
"# Advanced options\n",
|
350 |
"max_tok_rep_ratio = 0.95\n",
|
|
|
378 |
" \n",
|
379 |
" inp = torch.LongTensor(y).cuda()\n",
|
380 |
" \n",
|
381 |
+
" prime_embs = get_embeddings(inp)\n",
|
382 |
" \n",
|
383 |
+
" scores = cosine_similarity(embeddings, prime_embs).max(axis=0)\n",
|
384 |
"\n",
|
385 |
" scores = [o for o in scores if o != max(scores)]\n",
|
386 |
"\n",
|
|
|
485 |
" \n",
|
486 |
" inp = torch.LongTensor([song]).cuda()\n",
|
487 |
" \n",
|
488 |
+
" prime_embs = get_embeddings(inp)\n",
|
489 |
" \n",
|
490 |
+
" start_score = cosine_similarity(embeddings, prime_embs).max(axis=0)[0]\n",
|
491 |
"\n",
|
492 |
" b_size = batch_size\n",
|
493 |
" stop = False\n",
|
|
|
530 |
" inp = torch.LongTensor(output).cuda()\n",
|
531 |
" \n",
|
532 |
" embs = get_embeddings(inp)\n",
|
533 |
+
"\n",
|
534 |
+
" if use_prime_embeddings:\n",
|
535 |
+
" scores = cosine_similarity(prime_embs, embs).max(axis=0) \n",
|
536 |
+
"\n",
|
537 |
+
" else:\n",
|
538 |
+
" scores = cosine_similarity(embeddings, embs).max(axis=0)\n",
|
539 |
+
" \n",
|
540 |
" output_scores.extend(scores)\n",
|
541 |
" \n",
|
542 |
" scores = [o for o in output_scores if o != max(output_scores)]\n",
|