JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

一句话解决加载模型时的CUDA out of memory

发布时间 2023-12-17 18:33:26作者: 星如雨yu

在加载模型一行后加上max_memory即可,超出显存后会自动移到内存。

model = AutoModel.from_pretrained('your_model', trust_remote_code=True, max_memory={0: "6GiB",  "cpu": "10GiB"})

记录一下,备忘。

 

本文来自博客园,作者:星如雨yu,转载请注明原文链接:https://www.cnblogs.com/tianpanyu/p/17909520.html

    本栏目推荐文章
  • cleaning of llm corpus 大模型语料清洗
  • Eloquent 模型使用详解 Has One Through 远程一对一
  • 从Bitcask存储模型谈超轻量级KV系统设计与实现
  • 开发篇1:使用原生api和Langchain调用大模型
  • darknet-yolov4训练自己的模型记录
  • 扩散模型
  • C# 方法中的 引用参数 ref out 的使用
  • 机器学习-概率图模型系列-隐含马尔科夫模型-33
  • 2024-01-13 Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. ==》引用了未使用的方法导致
  • [Maven] 02 - POM模型与常见插件
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们