-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to switch between v2/v3 transformers in SMart EMbed
- Loading branch information
1 parent
bb3674e
commit 4830b56
Showing
4 changed files
with
22 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,14 @@ export class SmartEmbedTransformersIframeAdapter extends SmartEmbedIframeAdapter | |
constructor(smart_embed) { | ||
super(smart_embed); | ||
this.connector = transformers_connector; | ||
if(this.smart_embed.env.settings.legacy_transformers){ | ||
this.connector = this.connector | ||
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]') | ||
; | ||
this.smart_embed.opts.use_gpu = false; | ||
} | ||
else this.connector = this.connector | ||
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]') | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ async function build_transformers_iframe_connector() { | |
|
||
const outputContent = result.outputFiles[0].text; | ||
const wrappedContent = `export const transformers_connector = ${JSON.stringify(outputContent)};` | ||
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]') | ||
// .replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]') | ||
// escape ${} | ||
// .replace(/\$\{([\w.]+)\}/g, '\\`+$1+\\`') | ||
; | ||
|
Oops, something went wrong.