Giter VIP home page Giter VIP logo

Comments (7)

shesung avatar shesung commented on May 18, 2024 1

quantizer.py里面的kernel有问题,可以用chatglm2的代码进行替换。
https://gist.github.com/shesung/3acd80c22a19d3e019553ad7e497a707

from baichuan-13b.

sun1092469590 avatar sun1092469590 commented on May 18, 2024

我也遇到这个问题,用官方的方式int4量化,推理有问题

from baichuan-13b.

jameswu2014 avatar jameswu2014 commented on May 18, 2024

能不能贴一下你的代码?

from baichuan-13b.

landxman avatar landxman commented on May 18, 2024
def init_model():
    print("init model ...")
    model = AutoModelForCausalLM.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
        torch_dtype=torch.float16,
        trust_remote_code=True
    )
    model = model.quantize(4).cuda()
    model.generation_config = GenerationConfig.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat"
    )
    tokenizer = AutoTokenizer.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
    #    use_fast=False,
        trust_remote_code=True
    )
    return model, tokenizer

from baichuan-13b.

jameswu2014 avatar jameswu2014 commented on May 18, 2024
def init_model():
    print("init model ...")
    model = AutoModelForCausalLM.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
        torch_dtype=torch.float16,
        trust_remote_code=True
    )
    model = model.quantize(4).cuda()
    model.generation_config = GenerationConfig.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat"
    )
    tokenizer = AutoTokenizer.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
    #    use_fast=False,
        trust_remote_code=True
    )
    return model, tokenizer

我的代码和你差不多:
def init_model():
model = AutoModelForCausalLM.from_pretrained(
"baichuan-inc/Baichuan-13B-Chat",
torch_dtype=torch.float16,
# device_map="auto",
trust_remote_code=True
)
model = model.quantize(4).cuda()
model.generation_config = GenerationConfig.from_pretrained(
"baichuan-inc/Baichuan-13B-Chat"
)
tokenizer = AutoTokenizer.from_pretrained(
"baichuan-inc/Baichuan-13B-Chat",
use_fast=False,
trust_remote_code=True
)
return model, tokenizer

可以正常运行

from baichuan-13b.

bxjxxyy avatar bxjxxyy commented on May 18, 2024
def init_model():
    print("init model ...")
    model = AutoModelForCausalLM.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
        torch_dtype=torch.float16,
        trust_remote_code=True
    )
    model = model.quantize(4).cuda()
    model.generation_config = GenerationConfig.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat"
    )
    tokenizer = AutoTokenizer.from_pretrained(
        "/data/baichuan/Baichuan-13B-Chat",
    #    use_fast=False,
        trust_remote_code=True
    )
    return model, tokenizer

我的代码和你差不多: def init_model(): model = AutoModelForCausalLM.from_pretrained( "baichuan-inc/Baichuan-13B-Chat", torch_dtype=torch.float16, # device_map="auto", trust_remote_code=True ) model = model.quantize(4).cuda() model.generation_config = GenerationConfig.from_pretrained( "baichuan-inc/Baichuan-13B-Chat" ) tokenizer = AutoTokenizer.from_pretrained( "baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True ) return model, tokenizer

可以正常运行

我的和你一样 无法运行,报错跟楼主一样。
image

from baichuan-13b.

dalong2hongmei avatar dalong2hongmei commented on May 18, 2024

解决了吗 遇到一样的问题

from baichuan-13b.

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.