当前位置: 首页 > news >正文

OpenAI GPT-2 model use with TensorFlow JS

题意:使用 TensorFlow JS 应用 OpenAI GPT-2 模型

问题背景:

Is that possible to generate texts from OpenAI GPT-2 using TensorFlowJS?

是否可以使用 TensorFlowJS 生成 OpenAI GPT-2 的文本?

If not what is the limitation, like model format or ...?

如果不能,那么限制是什么,比如模型格式或者其他因素?

问题解决:

It's possible. Maybe someone finds this useful in 2023:

这是可能的。也许有人在 2023 年会觉得这个信息有用:

  • One way to achieve this is to convert a TF model with tensorflowjs-converter as Frederik described (possible problem with this approach is missing custom layers)

一种实现方式是将 TF 模型转换为 TensorFlow.js 格式,使用 tensorflowjs-converter,正如 Frederik 描述的那样(这种方法可能存在的问题是缺少自定义层)。

  • Use gpt-tfjs - implementation of GPT model in TensorFlow.js. It's possible to load weights directly from HF (example). I developed it to experiment with model training in the browser.

使用 gpt-tfjs —— 在 TensorFlow.js 中实现 GPT 模型。可以直接从 HF 加载权重(示例)。我开发了它以在浏览器中实验模型训练。

If you just want to generate text without training, you have more options:

如果你只是想生成文本而不进行训练,你还有更多的选择:

使用 transformers.js 或 ONNX。这个库很棒,并且遵循了 Python 的 transformers 库 API。不幸的是——仅支持推理。

使用 ggml + WASM。这是一个 C/C++ 模型实现,编译为 WebAssembly(示例,讨论)。

    • Use transformers.js or ONNX in general. The lib is great and follows Python's transformers library API. Unfortunately - inference only.
    • Use ggml + WASM. It's a C/C++ model implementation compiled to WebAssembly (example, talk)
http://www.lryc.cn/news/424417.html

相关文章:

  • JVM-运行数据区(堆、栈、元空间)
  • 超详细!!! LVS(Linux virual server)负载均衡知识及其NAT模式、DR模式、火墙标记实验
  • 信息学奥赛一本通1259:【例9.3】求最长不下降序列
  • 星露谷模组开发教程#3 事件
  • C语言程序设计(初识C语言后部分)
  • 驱动基础开发
  • 从苹果AppStore看AI开发者生态
  • 【Python学习-UI界面】PyQt5 小部件1-Label
  • 【Linux详解】进度条实现 Linux下git 的远程上传
  • Android进阶之路 - res、raw、assets 资源解析、区别对比
  • 从数字化到数智化:消费零售企业如何实现门店数智化管理?
  • Linux中ES的安装
  • Redis远程字典服务器(5) —— hash类型详解
  • MySQL | 行锁——记录锁、间隙锁 、临键锁、插入意向锁
  • 【网络编程】TCP通信基础模型实现
  • css rem之2024
  • python自动化笔记:pytest框架
  • wpf 路径动画 举例
  • 【C++】classes and object 2.8 取地址及const取地址操作符重载
  • milvus helm k8s开启监控
  • 牛奶饮用学习笔记
  • php防止页面重复刷新或者重复提交
  • Springboot3 配置sql打印到控制台
  • 深入理解 GO 语言并发
  • leetcode39组合总和
  • 【JPCS独立出版,EI稳定检索】2024年工业机器人与先进制造技术国际学术会议(IRAMT 2024,9月27-29)
  • Fal.ai Flux 1-Pro/Viva.ai/哩布哩布AI:AI绘图部分免费工具+原图提示词Prompt
  • C++学习笔记----2、使用C++进行优雅编程(十)---- 格式化
  • 双指针| Java | (hot100) 力扣283, 11, 15, 42做题总结
  • matlab求解方程