OpenMOSS / OpenMOSS/MOSS

扩展文本长度失败

Open
#322 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.3k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

在config配置中更新相关参数

config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
config.update({"n_positions": 4000})
config.update({"max_position_embeddings": 4000})
model = AutoModelForCausalLM.from_pretrained(
    model_path, 
    trust_remote_code=True, 
    load_in_8bit=True, 
    device_map='auto',
    torch_dtype=torch.float16,
    config=config
)

可以发现self.causal_mask成功初始化为[1, 1, 4000, 4000].
然而在_att中再次打印self.causal_mask,shape会重新变为[1, 1, 2048, 2048] 导致尺寸不匹配问题。
为什么register_buffer后矩阵尺寸会变?哪里还存在修改self.causal_mask的逻辑吗?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the configuration in the issue and inspect modeling_moss.py, especially the causal_mask initialization and the _att method linked in the report. Trace assignments or buffer handling between those points to identify why the shape returns to 2048. Done means explaining the reset path and confirming the resulting mask dimensions no longer mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.