GithubHelp home page GithubHelp logo

Comments (10)

Jeru2023 avatar Jeru2023 commented on July 24, 2024 1

修改 device_map 参数来指定设备。如果你想使用 GPU,将 device_map="auto" 修改为 device_map="cuda"。如果你想使用 CPU,将其修改为 device_map="cpu"

In my case, device_map needs to be set to cuda:0 instead of cuda

from chatglm3-finetune.

Jeru2023 avatar Jeru2023 commented on July 24, 2024

Same here, PyTorch reserved too much memory...

from chatglm3-finetune.

Jeru2023 avatar Jeru2023 commented on July 24, 2024

Try to modify finetune line 38 to set load_in_8bit to true:
model = AutoModel.from_pretrained(
"{your model path}", load_in_8bit=True, trust_remote_code=True, device_map="auto"
).cuda()

from chatglm3-finetune.

freecow avatar freecow commented on July 24, 2024

finetune.py line 34 to set load_in_8bit to true and delete half():
Original:
model = ChatGLMForConditionalGeneration.from_pretrained(
"model", load_in_8bit=False, trust_remote_code=False, device_map="auto"
).half()

Modified:
model = ChatGLMForConditionalGeneration.from_pretrained(
"model", load_in_8bit=True, trust_remote_code=False, device_map="auto"
)

Error Message:
File "/root/miniconda3/envs/chatglm3-finetune/lib/python3.10/site-packages/torch/nn/functional.py", line 2210, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking argument for argument index in method wrapper__index_select)

from chatglm3-finetune.

xxw1995 avatar xxw1995 commented on July 24, 2024

修改 device_map 参数来指定设备。如果你想使用 GPU,将 device_map="auto" 修改为 device_map="cuda"。如果你想使用 CPU,将其修改为 device_map="cpu"

from chatglm3-finetune.

chenmins avatar chenmins commented on July 24, 2024

刚刚测试了,需要 26GB GPU 显存。
Mon Oct 30 11:36:26 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.105.01 Driver Version: 515.105.01 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA A100-SXM... On | 00000000:A1:00.0 Off | 0 |
| N/A 51C P0 327W / 400W | 26305MiB / 81920MiB | 95% Default |
| | | Disabled |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 713 C python 26303MiB |
+-----------------------------------------------------------------------------+

from chatglm3-finetune.

freecow avatar freecow commented on July 24, 2024

刚刚测试了,需要 26GB GPU 显存。 Mon Oct 30 11:36:26 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.105.01 Driver Version: 515.105.01 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA A100-SXM... On | 00000000:A1:00.0 Off | 0 | | N/A 51C P0 327W / 400W | 26305MiB / 81920MiB | 95% Default | | | | Disabled | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 713 C python 26303MiB | +-----------------------------------------------------------------------------+

那看来不是3090这种24G能玩起来的,毕竟好像也不能多卡FineTune

from chatglm3-finetune.

Jeru2023 avatar Jeru2023 commented on July 24, 2024

24G够了,我是4090单卡,一个epoch10秒,还挺快

from chatglm3-finetune.

Jeru2023 avatar Jeru2023 commented on July 24, 2024

刚刚测试了,需要 26GB GPU 显存。 Mon Oct 30 11:36:26 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.105.01 Driver Version: 515.105.01 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA A100-SXM... On | 00000000:A1:00.0 Off | 0 | | N/A 51C P0 327W / 400W | 26305MiB / 81920MiB | 95% Default | | | | Disabled | +-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 713 C python 26303MiB | +-----------------------------------------------------------------------------+

那看来不是3090这种24G能玩起来的,毕竟好像也不能多卡FineTune

今天用3090也试了一下,没问题的

from chatglm3-finetune.

sukibean163 avatar sukibean163 commented on July 24, 2024

刚刚测试了,需要 26GB GPU 显存。 Mon Oct 30 11:36:26 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.105.01 Driver Version: 515.105.01 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA A100-SXM... On | 00000000:A1:00.0 Off | 0 | | N/A 51C P0 327W / 400W | 26305MiB / 81920MiB | 95% Default | | | | Disabled | +-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 713 C python 26303MiB | +-----------------------------------------------------------------------------+

那看来不是3090这种24G能玩起来的,毕竟好像也不能多卡FineTune

今天用3090也试了一下,没问题的

为什么我用24G的4090跑,也是出了同样的问题?
image
image

from chatglm3-finetune.

Related Issues (19)

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.