donut icon indicating copy to clipboard operation
donut copied to clipboard

SwinTransformer' object has no attribute 'pos_drop'

Open Sridhar-Ranganaboina opened this issue 1 year ago • 3 comments

SwinTransformer' object has no attribute 'pos_drop', getting this error in line no 100 in model.py

Sridhar-Ranganaboina avatar Jun 06 '23 06:06 Sridhar-Ranganaboina

@Sridhar-Ranganaboina which timm's version are you using? pos_drop was removed since version after 0.6.13 You can either pip install timm==0.6.13 or comment the line x = self.model.pos_drop(x) in the function SwinEncoder.forward(...) (in the file donut/model.py).

For more information: In SwinTransformer (timm==0.6.13), pos_drop is defined as a Dropout self.pos_drop = nn.Dropout(p=drop_rate) In addition, Donut uses SwinTransformer without declaring drop_rate so drop_rate=0. by default,

https://github.com/clovaai/donut/blob/a0e94bf145d81cfc934eae8848f1269ae9ca46a2/donut/model.py#L63-L71

which means you can safely ignore the line x = self.model.pos_drop(x).

thinh-huynh-re avatar Jun 07 '23 03:06 thinh-huynh-re

Sorry, for the noise. this does indeed work!

poetaster avatar Sep 18 '23 16:09 poetaster

@Sridhar-Ranganaboina which timm's version are you using? pos_drop was removed since version after 0.6.13 You can either pip install timm==0.6.13 or comment the line x = self.model.pos_drop(x) in the function SwinEncoder.forward(...) (in the file donut/model.py).

For more information: In SwinTransformer (timm==0.6.13), pos_drop is defined as a Dropout self.pos_drop = nn.Dropout(p=drop_rate) In addition, Donut uses SwinTransformer without declaring drop_rate so drop_rate=0. by default,

https://github.com/clovaai/donut/blob/a0e94bf145d81cfc934eae8848f1269ae9ca46a2/donut/model.py#L63-L71

which means you can safely ignore the line x = self.model.pos_drop(x).

Well, it solved this issue but generates the following error : BARTDecoder.prepare_inputs_for_inference() got an unexpected keyword argument 'past_key_values'

rafikoham avatar Jan 25 '24 10:01 rafikoham