Views
No views yet
!pip install git+https://github.com/AntoineSimoulin/adaptive-depth-transformers$1from act import AlbertActConfig, AlbertActModel, TFAlbertActModel
2from transformers import AlbertTokenizer
3
4tokenizer = AlbertTokenizer.from_pretrained('asi/albert-act-base')
5model = AlbertActModel.from_pretrained('asi/albert-act-base')
6_ = model.eval()
7
8inputs = tokenizer("a lump in the middle of the monkeys stirred and then fell quiet .", return_tensors="pt")
9outputs = model(**inputs)
10outputs.updates
11# tensor([[[[15., 9., 10., 7., 3., 8., 5., 7., 12., 10., 6., 8., 8., 9., 5., 8.]]]])1@inproceedings{simoulin-crabbe-2021-many,
2 title = "How Many Layers and Why? {A}n Analysis of the Model Depth in Transformers",
3 author = "Simoulin, Antoine and
4 Crabb{\'e}, Benoit",
5 booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: Student Research Workshop",
6 month = aug,
7 year = "2021",
8 address = "Online",
9 publisher = "Association for Computational Linguistics",
10 url = "https://aclanthology.org/2021.acl-srw.23",
11 doi = "10.18653/v1/2021.acl-srw.23",
12 pages = "221--228",
13}Alex Graves. 2016. Adaptive computation time for recurrent neural networks. CoRR, abs/1603.08983.