File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
[project ]
2
2
name = " transfusion-pytorch"
3
- version = " 0.10.4 "
3
+ version = " 0.10.5 "
4
4
description = " Transfusion in Pytorch"
5
5
authors = [
6
6
{
name =
" Phil Wang" ,
email =
" [email protected] " }
Original file line number Diff line number Diff line change @@ -1580,10 +1580,12 @@ def sample(
1580
1580
if is_tensor (prompt ) and prompt .dtype == torch .float : # is modality with type 0 implicit
1581
1581
prompt = (0 , prompt )
1582
1582
1583
+ prompt_is_modality = isinstance (prompt , tuple )
1584
+
1583
1585
if is_tensor (prompt ) and prompt .dtype in (torch .int , torch .long ): # is text only prompt
1584
1586
prompt = [prompt ]
1585
1587
1586
- elif isinstance ( prompt , tuple ) :
1588
+ elif prompt_is_modality :
1587
1589
modality_type , modality = prompt
1588
1590
1589
1591
mod = self .get_modality_info (modality_type )
@@ -1625,7 +1627,8 @@ def sample(
1625
1627
curr_length = 0
1626
1628
curr_modality_id = None
1627
1629
modality_shape = None
1628
- num_past_modalities = 0 # starts off with no modalities in output
1630
+
1631
+ num_past_modalities = int (prompt_is_modality ) # either 0 or 1 (if the prompt given is a modality)
1629
1632
1630
1633
text_is_greedy = text_temperature == 0.
1631
1634
is_decoding_text = True # starts off with text decoding, and alternates with modalities depending on [som] tokens detected
You can’t perform that action at this time.
0 commit comments