Skip to content

hchiam/learning-transformersjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Learning Transformers.js

Just one of the things I'm learning. https://github.com/hchiam/learning

https://huggingface.co/docs/transformers.js

https://github.com/huggingface/transformers

import { pipeline } from '@huggingface/transformers';
const type = 'sentiment-analysis';
const pipe = await pipeline(type);
const out = await pipe('I love transformers!');
console.log(out);

Notes on [Transformers.js: State-of-the-art Machine Learning for the web](https://www.youtube.com/watch?v=n18Lrbo8VU8] video

import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.8.0';
const type = 'automatic-speech-recognition';
const model = 'Xenova/whisper-tiny.en';
const transcriber = await pipeline(type, model, /* { device: 'webgpu', } */);
const file = 'mlk.wav';
const output = await transcriber(file);
console.log(output);
// continuing the code above
const outputWithWordLevelTimestamps = await transcriber('mlk.wav', { return_timestamps: 'word' });
console.log(outputWithWordLevelTimestamps);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published