Skip to content

Commit abd5477

Browse files
authored
Force use_cache=True (#496)
1 parent 6ef6bf5 commit abd5477

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ install_requires =
4040
transformers>=4.32.0,<5.0.0 # if you change this, please also change version assert in petals/__init__.py
4141
speedtest-cli==2.1.3
4242
pydantic>=1.10,<2.0 # 2.0 is incompatible with hivemind yet
43-
hivemind @ git+https://github.com/learning-at-home/hivemind
43+
hivemind==1.1.10.post2
4444
tensor_parallel==1.0.23
4545
humanfriendly
4646
async-timeout>=4.0.2

src/petals/models/bloom/model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def forward(
4343
attention_mask: Optional[torch.Tensor] = None,
4444
head_mask: Optional[torch.LongTensor] = None,
4545
inputs_embeds: Optional[torch.LongTensor] = None,
46-
use_cache: Optional[bool] = None,
46+
use_cache: Optional[bool] = None, # Not used here but needed for HF Transformers compatibility
4747
output_attentions: Optional[bool] = None,
4848
output_hidden_states: Optional[bool] = None,
4949
return_dict: Optional[bool] = None,
@@ -63,7 +63,6 @@ def forward(
6363
attention_mask is None or (attention_mask == 1).all()
6464
), f"Custom attention masks are not supported, {attention_mask=}"
6565
assert head_mask is None, f"Custom head masks are not supported, {head_mask=}"
66-
assert use_cache is None or use_cache, f"{use_cache=} is not supported"
6766
assert not output_attentions, f"{output_attentions=} is not supported"
6867
assert not output_hidden_states, f"{output_hidden_states=} is not supported"
6968
assert return_dict is None or return_dict, f"{return_dict=} is not supported"

src/petals/models/llama/model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def forward(
4343
position_ids: Optional[torch.LongTensor] = None,
4444
past_key_values: Optional[RemotePastKeyValues] = None,
4545
inputs_embeds: Optional[torch.FloatTensor] = None,
46-
use_cache: Optional[bool] = None,
46+
use_cache: Optional[bool] = None, # Not used here but needed for HF Transformers compatibility
4747
output_attentions: Optional[bool] = None,
4848
output_hidden_states: Optional[bool] = None,
4949
return_dict: Optional[bool] = None,
@@ -65,7 +65,6 @@ def forward(
6565
assert (
6666
position_ids is None or (position_ids[:, 1:] - position_ids[:, :-1] == 1).all()
6767
), f"Non-consecutive position_ids are not supported, {position_ids=}"
68-
assert use_cache is None or use_cache, f"{use_cache=} is not supported"
6968
assert not output_attentions, f"{output_attentions=} is not supported"
7069
assert not output_hidden_states, f"{output_hidden_states=} is not supported"
7170
assert return_dict is None or return_dict, f"{return_dict=} is not supported"

0 commit comments

Comments
 (0)