Coder Social home page Coder Social logo

Generation Issue (probability tensor contains either `inf`, `nan` or element < 0) of Flash-LLaMA with Model Parallelism about alpaca_farm HOT 6 CLOSED

tatsu-lab avatar tatsu-lab commented on July 18, 2024
Generation Issue (probability tensor contains either `inf`, `nan` or element < 0) of Flash-LLaMA with Model Parallelism

from alpaca_farm.

Comments (6)

lxuechen avatar lxuechen commented on July 18, 2024

Thanks for reporting! How was inputs.bin generated?

from alpaca_farm.

Zhiyuan-Zeng avatar Zhiyuan-Zeng commented on July 18, 2024

Thanks for reporting! How was inputs.bin generated?

@lxuechen It is a batch of input when doing PPO. PPO feeds this batch of queries to the model to get the responses.

from alpaca_farm.

Tiiiger avatar Tiiiger commented on July 18, 2024

Hi @Zhiyuan-Zeng ,

I don't think we ever use the huggingface "model parallelism" directly. So, Just chiming in for some thoughts.

According to https://huggingface.co/docs/accelerate/usage_guides/big_modeling,

By passing device_map="auto", we tell 🤗 Accelerate to determine automatically where to put each layer of the model depending on the available resources:

  • first we use the maximum space available on the GPU(s)
  • if we still need space, we store the remaining weights on the CPU
  • if there is not enough RAM, we store the remaining weights on the hard drive as memory-mapped tensors

So in your case (using 80GB A100), your code should be loading the model onto the first GPU? Can you confirm if this is the case?

from alpaca_farm.

Zhiyuan-Zeng avatar Zhiyuan-Zeng commented on July 18, 2024

Hi @Tiiiger,

  • Yes I want to use model parallelism for my own use.
  • I print the model.hf_device_map, and the result is {'model.embed_tokens': 0, 'model.layers.0': 0, 'model.layers.1': 0, 'model.layers.2': 0, 'model.layers.3': 0, 'model.layers.4': 0, 'model.layers.5': 0, 'model.layers.6': 0, 'model.layers.7': 0, 'model.layers.8': 0, 'model.layers.9': 0, 'model.layers.10': 0, 'model.layers.11': 0, 'model.layers.12': 0, 'model.layers.13': 0, 'model.layers.14': 0, 'model.layers.15': 0, 'model.layers.16': 1, 'model.layers.17': 1, 'model.layers.18': 1, 'model.layers.19': 1, 'model.layers.20': 1, 'model.layers.21': 1, 'model.layers.22': 1, 'model.layers.23': 1, 'model.layers.24': 1, 'model.layers.25': 1, 'model.layers.26': 1, 'model.layers.27': 1, 'model.layers.28': 1, 'model.layers.29': 1, 'model.layers.30': 1, 'model.layers.31': 1, 'model.norm': 1, 'lm_head': 1}. So I think the model is loaded onto the first two GPUs.

from alpaca_farm.

Tiiiger avatar Tiiiger commented on July 18, 2024

Unfortunately we have no experience with this vanilla model parallelism and unsure why it is causing trouble.

For all of this project, we used FSDP, which we find the most useful. I would suggest you look into how we used that and see if it can help.

from alpaca_farm.

Zhiyuan-Zeng avatar Zhiyuan-Zeng commented on July 18, 2024

@Tiiiger Thanks for your help! Let me close this issue.

from alpaca_farm.

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.