TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Shakespeare in your browser – minimal AI in JavaScript

1 点作者 logicallee2 个月前
Want to train your own AI model? You&#x27;ve gotta start somewhere. If you&#x27;ve never tried it before, here is your chance!<p>Running an AI model has two parts, during the training phase you set weights, and during the inference phase you use the weights to predict words and other tokens (such as punctuation).<p>This minimal implementation in pure javascript runs right in your browser:<p><a href="https:&#x2F;&#x2F;taonexus.com&#x2F;mini-transformer-in-js.html" rel="nofollow">https:&#x2F;&#x2F;taonexus.com&#x2F;mini-transformer-in-js.html</a><p>You can provide your own training data if you want: words.txt is a dictionary of punctuation and output tokens each on their own line and input.txt is a text corpus to train on.<p>If you load them from the server, you get words.txt from the top 2000 or so words that appear in in the Project Gutenberg free public domain corpus (as well as a few punctuation marks). For input.txt we&#x27;ve used a selection of 2000 lines of Shakespeare text.<p>After you finish training (you can stop early if you are impatient), on the Inference tab you can write a few words to have the model complete it for you.<p>Congratulations! After completing these steps you can now boast that you have trained your own AI model.

暂无评论

暂无评论