运行 moss_cli_demo.py 出现错误,请问这是提示我cpu内存不够吗?
D:\UserSoftware\Anaconda3\envs\Moss\python.exe E:/MOSS-main/moss_cli_demo.py
┌───────────────────── Traceback (most recent call last) ─────────────────────┐
│ E:\MOSS-main\moss_cli_demo.py:47 in from_pt │
│ 2632 │ │ if use_keep_in_fp32_modules: │
│ │
│ E:\MOSS-main\models\modeling_moss.py:607 in init │
│ │
│ 604 │ │ │ torch.set_default_dtype(torch.half) │
│ 605 │ │ │ transformers.modeling_utils._init_weights = False │
│ 606 │ │ │ torch.set_default_dtype(torch.half) │
│ > 607 │ │ self.transformer = MossModel(config) │
│ 608 │ │ self.lm_head = nn.Linear(config.n_embd, config.vocab_size) │
│ 609 │ │ if config.wbits in [4, 8]: │
│ 610 │ │ │ torch.set_default_dtype(torch.float) │
│ │
│ E:\MOSS-main\models\modeling_moss.py:401 in init │
│ │
│ 398 │ │ self.vocab_size = config.vocab_size │
│ 399 │ │ self.wte = nn.Embedding(config.vocab_size, self.embed_dim) │
│ 400 │ │ self.drop = nn.Dropout(config.embd_pdrop) │
│ > 401 │ │ self.h = nn.ModuleList([MossBlock(config) for _ in range(conf │
│ 402 │ │ self.ln_f = nn.LayerNorm(self.embed_dim, eps=config.layer_nor │
│ 403 │ │ self.rotary_dim = min(config.rotary_dim, config.n_ctx // conf │
│ 404 │
│ │
│ E:\MOSS-main\models\modeling_moss.py:401 in num_attention_heads: {self.num_attention_heads}) │
│ 83 │ │ │ ) │
│ 84 │ │ self.scale_attn = torch.sqrt(torch.tensor(self.head_dim, dtyp │
│ > 85 │ │ self.qkv_proj = nn.Linear(self.embed_dim, self.embed_dim * 3, │
│ 86 │ │ │
│ 87 │ │ self.out_proj = nn.Linear(self.embed_dim, self.embed_dim, bia │
│ 88 │ │ self.rotary_dim = config.rotary_dim │
│ │
│ D:\UserSoftware\Anaconda3\envs\Moss\lib\site-packages\torch\nn\modules\line │
│ ar.py:96 in init │
│ │
│ 93 │ │ super().init() │
│ 94 │ │ self.in_features = in_features │
│ 95 │ │ self.out_features = out_features │
│ > 96 │ │ self.weight = Parameter(torch.empty((out_features, in_feature │
│ 97 │ │ if bias: │
│ 98 │ │ │ self.bias = Parameter(torch.empty(out_features, **factory │
│ 99 │ │ else: │
└─────────────────────────────────────────────────────────────────────────────┘
RuntimeError: [enforce fail at
C:\cb\pytorch_1000000000000\work\c10\core\impl\alloc_cpu.cpp:72] data.
DefaultCPUAllocator: not enough memory: you tried to allocate 226492416 bytes.
是的