Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i run on windows,it loop argument must agree with lock #1042

Open
cyq123-git opened this issue Apr 16, 2024 · 0 comments
Open

when i run on windows,it loop argument must agree with lock #1042

cyq123-git opened this issue Apr 16, 2024 · 0 comments

Comments

@cyq123-git
Copy link

cyq123-git commented Apr 16, 2024

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

@cyq123-git cyq123-git changed the title when i run on windowsloop argument must agree with lock when i run on windows,it loop argument must agree with lock Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant