Skip to content

Commit

Permalink
Include @huggingface/jinja in exported webpack build (#458)
Browse files Browse the repository at this point in the history
In future, probably a better idea to dynamically import. However, currently it affects importing from CDNs.
  • Loading branch information
xenova authored Dec 18, 2023
1 parent 81aab02 commit 61cb4f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,7 @@ export class PreTrainedTokenizer extends Callable {
// (i.e., must be installed separately), an error is thrown if it is not installed.
let Template;
try {
Template = (await import('@huggingface/jinja')).Template;
Template = (await import( /* webpackMode: "eager" */ '@huggingface/jinja')).Template;
} catch (e) {
throw new Error(
`apply_chat_template requires '@huggingface/jinja' to be installed. ` +
Expand Down
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import path from 'path';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

/**
* @type {import('webpack').Configuration}
*/
export default {
mode: 'development',
devtool: 'source-map',
Expand Down

0 comments on commit 61cb4f5

Please sign in to comment.