Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'flax' has no attribute 'optim'

My code is as follows:

!pip install flax
init_params = TransporterNets().init(key, init_img, init_text, init_pix)['params']
print(f'Model parameters: {n_params(init_params):,}')
optim = flax.optim.Adam(lr=1e-4).create(init_params)

However it shows the following error:

AttributeError: module 'flax' has no attribute 'optim'

Even though I have seen documentation of optim attribute in flax module. How to fix it?

like image 586
Md Tawsif Mostafiz 170021031 Avatar asked Oct 18 '25 20:10

Md Tawsif Mostafiz 170021031


1 Answers

You can temporarily solve the issue by downgrading flax version from 0.6.0 to 0.5.1 at the moment.

pip install flax==0.5.1
like image 179
Baris CELIK Avatar answered Oct 21 '25 19:10

Baris CELIK