paperswithcode / galai

Model API for GALACTICA
Apache License 2.0
2.68k stars 276 forks source link

TypeError: clean() got an unexpected keyword argument 'css_sanitizer' #67

Open fengyunzaidushi opened 1 year ago

fengyunzaidushi commented 1 year ago

when i run the following code:

model = gal.load_model("base")
prompt = "The Riemann zeta function is given by:\n\n\\["
output = model.generate(prompt, max_new_tokens=60)
display_latex(output)

it gives me the following error:

│ J:/tx_generation/glactica/glactica.py:8 in <module>                         │
│                                                                             │
│   5 model = gal.load_model("base")                                          │
│   6 prompt = "The Riemann zeta function is given by:\n\n\\["                │
│   7 output = model.generate(prompt, max_new_tokens=60)                      │
│ > 8 display_latex(output)                                                   │
│   9                                                                         │
│                                                                             │
│ D:\2020exe\Anaconda3\lib\site-packages\galai\notebook_utils.py:102 in       │
│ display_latex                                                               │
│                                                                             │
│    99 │   # normalize LaTeX tags                                            │
│   100 │   text = text.replace(r"\(", "$").replace(r"\)", "$").replace(r"\[" │
│   101 │   # the text is going to be parsed as                               │
│ > 102 │   text = clean_html(text, tags=[], attributes=[], css_sanitizer=[]) │
│   103 │   # use IPython.display.HTML instead of IPython.display.Latex so th │
│   104 │   # rendered properly on notebook load without cells reevaluations  │
│   105 │   return HTML(text)                                                 │
│                                                                             │
│ D:\2020exe\Anaconda3\lib\site-packages\galai\notebook_utils.py:67 in        │
│ clean_html                                                                  │
│                                                                             │
│    64 │   │   value,                                                        │
│    65 │   │   tags=tags,                                                    │
│    66 │   │   attributes=attributes,                                        │
│ >  67 │   │   css_sanitizer=css_sanitizer,                                  │
│    68 │   )                                                                 │
│    69 │                                                                     │
│    70 │   return cleaned      

TypeError: clean() got an unexpected keyword argument 'css_sanitizer'

mkardas commented 1 year ago

Hi @fengyunzaidushi, thanks for reporting. What is your bleach version?

fengyunzaidushi commented 1 year ago

Hi @fengyunzaidushi, thanks for reporting. What is your bleach version?

thank you for your reply: bleach=3.1.0 galai == 1.1.2 python=3.7 ide= pycharm i run it with cpu.

mkardas commented 1 year ago

Thanks @fengyunzaidushi for the details. I updated the bleach version in requirements.txt (~=5.0.1), can you reinstall bleach and check again?

mso1830 commented 1 year ago

I encountered the same error. I have all the latest packages in the requirement.txt

mkardas commented 1 year ago

@mso1830 I pushed a fix to the main branch, not yet on pypi. Can you try it if it works for you?