Giter VIP home page Giter VIP logo

Comments (4)

tuteng0915 avatar tuteng0915 commented on May 28, 2024 5

gradio 的文件映射由 tempfile._TemporaryFileWrapper 实现,
请在shell中尝试:

> python
import tempfile
tempfile.gettempdir()

预期输出为

/tmp/

你可以选择在代码中加入:

tempfile.tempdir = "./tmp"

来临时将 tempfile 制定到项目根目录,或者其他你有权限的位置

from visualglm-6b.

Lukangkang123 avatar Lukangkang123 commented on May 28, 2024 1
tempfile.tempdir = "./tmp"

你好,我用了你说的方法,但是一直报FileNotFoundError,创建了文件夹后又报新的: FileNotFoundError [Errno 2] No such file or directory: './tmp/tmpg4o6naoc'

from visualglm-6b.

yangxingrui avatar yangxingrui commented on May 28, 2024

非常棒,你的办法有效,感谢你的解答

from visualglm-6b.

Assassin-King avatar Assassin-King commented on May 28, 2024
tempfile.tempdir = "./tmp"

你好,我用了你说的方法,但是一直报FileNotFoundError,创建了文件夹后又报新的: FileNotFoundError [Errno 2] No such file or directory: './tmp/tmpg4o6naoc'

from transformers import AutoModel, AutoTokenizer
import gradio as gr
import mdtex2html
import tempfile
import os
os.makedirs("./tmp", exist_ok=True)
tempfile.tempdir = "./tmp"

tokenizer = AutoTokenizer.from_pretrained("model/chatglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("model/chatglm-6b", trust_remote_code=True).half().cuda()
model = model.eval()

这样试试呢

from visualglm-6b.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.