Comments (6)
model = AutoModel.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True).half().cuda()
改为
model = AutoModel.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True).half().to(“mps”)
from visualglm-6b.
更新torch到2.1后是能用fp16和mps跑的,但是貌似有内存泄露,问一个问题后内存就从18G涨到28G,swap一用就扛不住了。
pip list|grep torch
torch 2.1.0.dev20230606
torchaudio 2.1.0.dev20230606
torchvision 0.16.0.dev20230606
from visualglm-6b.
Traceback (most recent call last):
File "/Users/longkeyy/PycharmProjects/hf_demo/llm.py", line 4, in
model = AutoModel.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True).half().to("mps")
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 459, in from_pretrained
model_class = get_class_from_dynamic_module(
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 425, in get_class_from_dynamic_module
final_module = get_cached_module_file(
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 305, in get_cached_module_file
get_cached_module_file(
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 267, in get_cached_module_file
modules_needed = check_imports(resolved_module_file)
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 145, in check_imports
importlib.import_module(imp)
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/cpm_kernels/init.py", line 1, in
from . import library
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/cpm_kernels/library/init.py", line 1, in
from . import nvrtc
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/cpm_kernels/library/nvrtc.py", line 5, in
nvrtc = Lib("nvrtc")
File "/Users/longkeyy/miniconda3/envs/hf_demo/lib/python3.10/site-packages/cpm_kernels/library/base.py", line 59, in init
raise RuntimeError("Unknown platform: %s" % sys.platform)
RuntimeError: Unknown platform: darwin
from visualglm-6b.
看上去你使用了量化,目前只支持cuda上的量化。
from visualglm-6b.
能参考 stable-diffusion-webui 在官方代码调整下让在mps上可以跑吗?我不太懂机器学习,不知道怎么改
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/devices.py
if sys.platform == "darwin":
from modules import mac_specific
def has_mps() -> bool:
if sys.platform != "darwin":
return False
else:
return mac_specific.has_mps
def extract_device_id(args, name):
for x in range(len(args)):
if name in args[x]:
return args[x + 1]
return None
def get_cuda_device_string():
from modules import shared
if shared.cmd_opts.device_id is not None:
return f"cuda:{shared.cmd_opts.device_id}"
return "cuda"
def get_optimal_device_name():
if torch.cuda.is_available():
return get_cuda_device_string()
if has_mps():
return "mps"
return "cpu"
def get_optimal_device():
return torch.device(get_optimal_device_name())
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/mac_specific.py
from visualglm-6b.
运行python web_demo.py
用cpu跑错误是 "slow_conv2d_cpu" not implemented for 'Half'
用mps跑是
loc("varianceEps"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":228:0)):
error: input types 'tensor<1x257x1xf16>' and 'tensor<1xf32>' are not broadcast compatible
from visualglm-6b.
Related Issues (20)
- 什么时候开源基于GLM的中文CogVLM呢? HOT 1
- python cli_demo.py 下载模型时候报错 HOT 3
- 关于微调之后的模型表现问题
- [deepspeed] 0VERFLOW! Rank 0 Skipping step. Attempted os scale: 65536!!! HOT 1
- Where can I get the file visualglm-6b/300/mp_rank_00_model_states.pt HOT 4
- ERROR: assert vocab_file is not None
- AttributeError: 'ChatGLMTokenizer' object has no attribute 'sp_tokenizer'. Did you mean: '_tokenize'? HOT 1
- 加载微调后模型时报错object of type 'QuantState' has no len() HOT 8
- 您好,请问是否可以训练BLIP部分,微调代码似乎只可以微调chatglm的指定层的参数 HOT 4
- 输入路径后出现None is not in list HOT 2
- python main.py KeyError: 'type'
- AttributeError: module 'transformers_modules.hf.modeling_chatglm' has no attribute 'ChatGLMForConditionalGenerationWithImage'. Did you mean: 'ChatGLMForConditionalGeneration'? HOT 8
- huggingface模型要怎么微调,微调之后报错找不到xxxxxx.pt那个文件
- deepspeed分布式训练出现sat ValueError inconsistent HOT 1
- 请问是否支持无图片的微调,如果支持,该如何修改代码?
- No module named 'triton' HOT 7
- 'ChatGLMTokenizer' object has no attribute 'sp_tokenizer' HOT 6
- windows下微调
- AttributeError: 'FakeTokenizer' object has no attribute 'encode' HOT 12
- linux使用qloar微调遇到问题四个全部Killing subprocess,四张8G卡。out of memory该如何解决?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from visualglm-6b.