Giter VIP home page Giter VIP logo

Comments (8)

MikeDean2367 avatar MikeDean2367 commented on September 27, 2024

您好,您可以使用transformers包进行加载和推理,所有的过程和其他的模型加载都一致,您可以参考这个文件。如有问题,请告知我 :)

from knowlm.

HuiGe88 avatar HuiGe88 commented on September 27, 2024

from transformers import LlamaForCausalLM,LlamaTokenizer

model = LlamaForCausalLM.from_pretrained("models/knowlm-13b-zhixi",context_length=2048,max_new_tokens=1024)
tokenizer=LlamaTokenizer.from_pretrained("models/knowlm-13b-zhixi") 您好,请问这个代码可以加载吗,我想使用显卡加载运行,还需要设置哪些参数?

from knowlm.

MikeDean2367 avatar MikeDean2367 commented on September 27, 2024

您好,可以的,如果您要使用gpu,请在from_pretrained方法中传入参数device_map="auto"。建议您阅读transformers包的文档来获取更多详细的说明。

如有问题请告知我 :)

from knowlm.

HuiGe88 avatar HuiGe88 commented on September 27, 2024

您好,请问这个调用里,最大上下文长度和输出文本长度如何设置,用的哪个参数?

from knowlm.

MikeDean2367 avatar MikeDean2367 commented on September 27, 2024
  • 最大上下文长度:
    这个通常在分词的时候处理,比如tokenizer(max_length=100)
  • 输出文本长度:
    通过设置model.generate(max_new_tokens=500)来进行控制,参考代码

from knowlm.

HuiGe88 avatar HuiGe88 commented on September 27, 2024

您好,我在加载智析模型的时候显示显存不足,我的显卡是A6000,这还运行不了吗
OutOfMemoryError: CUDA out of memory. Tried to allocate 100.00 MiB (GPU 0;
47.99 GiB total capacity; 46.87 GiB already allocated; 0 bytes free; 46.87 GiB
reserved in total by PyTorch) If reserved memory is >> allocated memory try
setting max_split_size_mb to avoid fragmentation. See documentation for Memory
Management and PYTORCH_CUDA_ALLOC_CONF

from knowlm.

MikeDean2367 avatar MikeDean2367 commented on September 27, 2024

建议您使用torch_dtype=torch.bfloat16

from knowlm.

zxlzr avatar zxlzr commented on September 27, 2024

请问您还有其他问题吗?

from knowlm.

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.