- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 09:42 AM
I am trying to run this attention visualization in my Databricks notebook. This is my code and this is the error I get:
```
```
/databricks/python/lib/python3.12/site-packages/transformers/tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884 warnings.warn(
<IPython.core.display.Javascript object>
Does anyone have thoughts on how to actually see the display?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 06:10 PM
Hi @Rasputin312 !
I was able to render the visualization with bertviz library.
The default moview_view html_action is view
that does not work with Databricks notebook. Instead, using the returned HTML, we can visualize the model.
display(model_view(attention, tokens, html_action="return"))
From model_view
doc:
html_action: Specifies the action to be performed with the generated HTML object - 'view' (default): Displays the generated HTML representation as a notebook cell output - 'return' : Returns an HTML object containing the generated view for further processing or custom visualization
The entire notebook code is available here. https://gist.github.com/koji-kawamura-db/49c52d5d96b25b936e038fc21d3bbcec
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 06:10 PM
Hi @Rasputin312 !
I was able to render the visualization with bertviz library.
The default moview_view html_action is view
that does not work with Databricks notebook. Instead, using the returned HTML, we can visualize the model.
display(model_view(attention, tokens, html_action="return"))
From model_view
doc:
html_action: Specifies the action to be performed with the generated HTML object - 'view' (default): Displays the generated HTML representation as a notebook cell output - 'return' : Returns an HTML object containing the generated view for further processing or custom visualization
The entire notebook code is available here. https://gist.github.com/koji-kawamura-db/49c52d5d96b25b936e038fc21d3bbcec

