Impossible to initialize accelerate in google colab

#9
by gxcellister - opened

When trying to initialize accelerate in google colab I get the error

NotImplementedError Traceback (most recent call last)
in <cell line: 1>()
----> 1 get_ipython().system('accelerate config default')

2 frames
/usr/local/lib/python3.10/dist-packages/google/colab/_system_commands.py in _run_command(cmd, clear_streamed_output)
166 locale_encoding = locale.getpreferredencoding()
167 if locale_encoding != _ENCODING:
--> 168 raise NotImplementedError(
169 'A UTF-8 locale is required. Got {}'.format(locale_encoding)
170 )

NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968

Do you have a way to initialize in another way?

Actually the problem is due to that cell

import gc

delete the BLIP2 pipelines and clear up some memory

del blip_processor, blip_model
gc.collect()
torch.cuda.empty_cache()

If I run this cell, then I cannot run any command using !

Just run this before :
import locale
locale.getpreferredencoding = lambda: "UTF-8"

Sign up or log in to comment