Spaces:
Runtime error
Runtime error
Commit
·
7d1810a
1
Parent(s):
6221aa9
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,9 @@ import jax
|
|
2 |
import jax.numpy as jnp
|
3 |
from transformers import FlaxBigBirdForQuestionAnswering, BigBirdTokenizerFast
|
4 |
import gradio as gr
|
|
|
5 |
FLAX_MODEL_ID = "vasudevgupta/flax-bigbird-natural-questions"
|
|
|
6 |
if __name__ == "__main__":
|
7 |
model = FlaxBigBirdForQuestionAnswering.from_pretrained(FLAX_MODEL_ID, block_size=64, num_random_blocks=3)
|
8 |
tokenizer = BigBirdTokenizerFast.from_pretrained(FLAX_MODEL_ID)
|
@@ -27,6 +29,8 @@ if __name__ == "__main__":
|
|
27 |
default_context = "Models like BERT, RoBERTa have a token limit of 512. But BigBird supports up to 4096 tokens! How does it do that? How can transformers be applied to longer sequences? In Abhishek Thakur's next Talks, I will discuss BigBird!! Attend this Friday, 9:30 PM IST Live link: https://www.youtube.com/watch?v=G22vNvHmHQ0.\nBigBird is a transformer based model which can process long sequences (upto 4096) very efficiently. RoBERTa variant of BigBird has shown outstanding results on long document question answering."
|
28 |
question = gr.inputs.Textbox(lines=2, default="When is talk happening?", label="Question")
|
29 |
context = gr.inputs.Textbox(lines=10, default=default_context, label="Context")
|
|
|
30 |
title = "BigBird-RoBERTa"
|
31 |
desc = "BigBird is a transformer based model which can process long sequences (upto 4096) very efficiently. RoBERTa variant of BigBird has shown outstanding results on long document question answering."
|
32 |
-
|
|
|
|
2 |
import jax.numpy as jnp
|
3 |
from transformers import FlaxBigBirdForQuestionAnswering, BigBirdTokenizerFast
|
4 |
import gradio as gr
|
5 |
+
|
6 |
FLAX_MODEL_ID = "vasudevgupta/flax-bigbird-natural-questions"
|
7 |
+
|
8 |
if __name__ == "__main__":
|
9 |
model = FlaxBigBirdForQuestionAnswering.from_pretrained(FLAX_MODEL_ID, block_size=64, num_random_blocks=3)
|
10 |
tokenizer = BigBirdTokenizerFast.from_pretrained(FLAX_MODEL_ID)
|
|
|
29 |
default_context = "Models like BERT, RoBERTa have a token limit of 512. But BigBird supports up to 4096 tokens! How does it do that? How can transformers be applied to longer sequences? In Abhishek Thakur's next Talks, I will discuss BigBird!! Attend this Friday, 9:30 PM IST Live link: https://www.youtube.com/watch?v=G22vNvHmHQ0.\nBigBird is a transformer based model which can process long sequences (upto 4096) very efficiently. RoBERTa variant of BigBird has shown outstanding results on long document question answering."
|
30 |
question = gr.inputs.Textbox(lines=2, default="When is talk happening?", label="Question")
|
31 |
context = gr.inputs.Textbox(lines=10, default=default_context, label="Context")
|
32 |
+
|
33 |
title = "BigBird-RoBERTa"
|
34 |
desc = "BigBird is a transformer based model which can process long sequences (upto 4096) very efficiently. RoBERTa variant of BigBird has shown outstanding results on long document question answering."
|
35 |
+
|
36 |
+
gr.Interface(fn=get_answer, inputs=[question, context], outputs="text", title=title, description=desc).launch()
|