Skip to content

Commit

Permalink
- Replaced instances of '@xenova/transformers' with '@huggingface/tra…
Browse files Browse the repository at this point in the history
…nsformers' in multiple files to ensure consistency and compatibility with the latest version.

- Updated the version of the @huggingface/transformers dependency from 3.1.1 to 3.1.2 in the transformers adapter and related connectors.
- Enhanced the settings configuration in SmartEntities to clarify the minimum length description.
- Removed the smart-instruct-model directory, including its package.json, README.md, and associated files, as part of a cleanup effort.
  • Loading branch information
Brian Joseph Petro committed Dec 8, 2024
1 parent 6b630d1 commit d9ddcc7
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 392 deletions.
2 changes: 1 addition & 1 deletion smart-embed-model/adapters/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class SmartEmbedTransformersAdapter extends SmartEmbedAdapter {
* @returns {Promise<void>}
*/
async load_transformers() {
const { pipeline, env, AutoTokenizer } = await import('@xenova/transformers');
const { pipeline, env, AutoTokenizer } = await import('@huggingface/transformers');

env.allowLocalModels = false;
const pipeline_opts = {
Expand Down
4 changes: 2 additions & 2 deletions smart-embed-model/adapters/transformers_iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class SmartEmbedTransformersIframeAdapter extends SmartEmbedIframeAdapter
this.connector = transformers_connector;
if(this.settings.legacy_transformers || !this.use_gpu){
this.connector = this.connector
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]')
.replace('@huggingface/transformers', 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]')
;
this.use_gpu = false;
}
else this.connector = this.connector
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected].1')
.replace('@huggingface/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected].2')
;
}

Expand Down
6 changes: 3 additions & 3 deletions smart-embed-model/build/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function build_transformers_iframe_connector() {
target: 'es2020',
outfile: join(__dirname, '../connectors/transformers_iframe.js'),
write: false,
external: ['@xenova/transformers'],
external: ['@huggingface/transformers'],
});

const outputContent = result.outputFiles[0].text;
Expand All @@ -37,11 +37,11 @@ async function build_transformers_worker_connector() {
target: 'es2020',
outfile: join(__dirname, '../connectors/transformers_worker.js'),
write: false,
external: ['@xenova/transformers'],
external: ['@huggingface/transformers'],
});

const connector = result.outputFiles[0].text
.replace('@xenova/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected].1')
.replace('@huggingface/transformers', 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected].2')
;
writeFileSync(join(__dirname, '../connectors/transformers_worker.js'), connector);
console.log('Build worker completed successfully.');
Expand Down
2 changes: 1 addition & 1 deletion smart-embed-model/connectors/transformers_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ var SmartEmbedTransformersAdapter = class extends SmartEmbedAdapter {
* @returns {Promise<void>}
*/
async load_transformers() {
const { pipeline, env, AutoTokenizer } = await import("https://cdn.jsdelivr.net/npm/@huggingface/[email protected].1");
const { pipeline, env, AutoTokenizer } = await import("https://cdn.jsdelivr.net/npm/@huggingface/[email protected].2");
env.allowLocalModels = false;
const pipeline_opts = {
quantized: true
Expand Down
4 changes: 2 additions & 2 deletions smart-entities/smart_entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,9 @@ export class SmartEntities extends Collection {
*/
export const settings_config = {
"min_chars": {
name: 'Minimum length of entity to embed',
name: 'Minimum length',
type: "number",
description: "Minimum length of entity to embed.",
description: "Minimum length of entity to embed (in characters).",
placeholder: "Enter number ex. 300",
default: 300,
},
Expand Down
1 change: 0 additions & 1 deletion smart-instruct-model/README.md

This file was deleted.

30 changes: 0 additions & 30 deletions smart-instruct-model/package.json

This file was deleted.

165 changes: 0 additions & 165 deletions smart-instruct-model/smart_instruct_model.js

This file was deleted.

Loading

0 comments on commit d9ddcc7

Please sign in to comment.