when i run on windows,it loop argument must agree with lock
cyq123-git opened this issue · 0 comments
import PIL
import jax.numpy as jnp
from tensorflow.io import gfile
from scenic.projects.boundary_attention.configs import base_config
from scenic.projects.boundary_attention.helpers import train_utils
from scenic.projects.boundary_attention.helpers import viz_utils
######## MODIFY THE OPTIONS BELOW #########
im_height = 216 # Replace with height to resize input to
im_width = 216 # Replace with width to resize input to
img_path = './pic/noisy_flower.png' # Replace with path to new input
weights_dir = './pretrained_weights/' # Add path to pretrained weights here
############################################
input_img = jnp.array(PIL.Image.open(gfile.GFile(img_path, 'rb')).resize((im_width, im_height)))/255.0
print(input_img)
input_img = jnp.expand_dims(input_img.transpose(2,0,1)[:3,:,:], axis=0)
config = base_config.get_config(model_name='boundary_attention',
dataset_name='testing',
input_size=(im_height, im_width, 3))
apply_jitted, trained_params = train_utils.make_apply(config, weights_dir)
outputs = apply_jitted(trained_params['params'], input_img)
viz_utils.visualize_outputs(input_img, outputs)
Traceback (most recent call last):
File "D:\python_software\code_doc\2023project\googleboundary\test.py", line 27, in
apply_jitted, trained_params = train_utils.make_apply(config, weights_dir)
File "D:\python_software\anaconda\envs\google\lib\site-packages\scenic\projects\boundary_attention\helpers\train_utils.py", line 36, in make_apply
trained_params = checkpoints.restore_checkpoint(ckpt_dir=ckpt_dir,
File "D:\python_software\anaconda\envs\google\lib\site-packages\flax\training\checkpoints.py", line 1129, in restore_checkpoint
restored = orbax_checkpointer.restore(
File "D:\python_software\anaconda\envs\google\lib\site-packages\orbax\checkpoint\checkpointer.py", line 170, in restore
restored = self._handler.restore(directory, args=ckpt_args)
File "D:\python_software\anaconda\envs\google\lib\site-packages\orbax\checkpoint\pytree_checkpoint_handler.py", line 1088, in restore
byte_limiter = get_byte_limiter(self._concurrent_gb)
File "D:\python_software\anaconda\envs\google\lib\site-packages\orbax\checkpoint\pytree_checkpoint_handler.py", line 171, in get_byte_limiter
return asyncio.run(_create_byte_limiter())
File "D:\python_software\anaconda\envs\google\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\python_software\anaconda\envs\google\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "D:\python_software\anaconda\envs\google\lib\site-packages\orbax\checkpoint\pytree_checkpoint_handler.py", line 169, in _create_byte_limiter
return LimitInFlightBytes(concurrent_bytes) # pylint: disable=protected-access
File "D:\python_software\anaconda\envs\google\lib\site-packages\jax\experimental\array_serialization\serialization.py", line 180, in init
self._cv = asyncio.Condition(lock=asyncio.Lock())
File "D:\python_software\anaconda\envs\google\lib\asyncio\locks.py", line 234, in init
raise ValueError("loop argument must agree with lock")
ValueError: loop argument must agree with lock
Process finished with exit code 1