(seq, drop_rate=0.5)
| 42 | |
| 43 | |
| 44 | def drop_seq_token(seq, drop_rate=0.5): |
| 45 | idx = torch.randperm(seq.size(1)) |
| 46 | num_keep_tokens = int(len(idx) * (1 - drop_rate)) |
| 47 | idx = idx[:num_keep_tokens] |
| 48 | seq = seq[:, idx] |
| 49 | return seq |
| 50 | |
| 51 | |
| 52 | def import_model_class_from_model_name_or_path( |
nothing calls this directly
no outgoing calls
no test coverage detected