Skip to content

Commit

Permalink
Use versioned links (#Closes #114)
Browse files Browse the repository at this point in the history
Prevents issues where users copy-paste the import code, and then a future update breaks it.

Also ensures that the default wasm files match the target version
  • Loading branch information
xenova committed May 29, 2023
1 parent ac23bc5 commit 2f20922
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/snippets/2_installation.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ npm i @xenova/transformers
Alternatively, you can use it in vanilla JS, without any bundler, by using a CDN or static hosting. For example, using [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), you can import the library with:
```html
<script type="module">
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers';
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.0.2';
</script>
```
2 changes: 1 addition & 1 deletion docs/snippets/4_custom-usage.snippet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@xenova/transformers/dist/), which should work out-of-the-box. You can customize this as follows:
By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@xenova/transformers@2.0.2/dist/), which should work out-of-the-box. You can customize this as follows:


### Settings
Expand Down
2 changes: 1 addition & 1 deletion src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const localModelPath = RUNNING_LOCALLY
// In practice, users should probably self-host the necessary .wasm files.
onnx_env.wasm.wasmPaths = RUNNING_LOCALLY
? path.join(__dirname, '/dist/')
: 'https://cdn.jsdelivr.net/npm/@xenova/transformers/dist/';
: 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.0.2/dist/';


/**
Expand Down

0 comments on commit 2f20922

Please sign in to comment.