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

Question about the type of parameter in the parameter conduction process of my model #3443

Open
CHENxx23 opened this issue May 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@CHENxx23
Copy link

Describe the bug

ERROR : ray::ClientAppActor.run() (pid=46852, ip=172.17.0.5, actor_id=3d75a2ab5f2027e623a07e9901000000, repr=<flwr.simulation.ray_transport.ray_actor.ClientAppActor object at 0x7f7acbf68520>)
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/client/client_app.py", line 98, in call
return self._call(message, context)
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/client/client_app.py", line 81, in ffn
out_message = handle_legacy_message_from_msgtype(
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/client/message_handler/message_handler.py", line 141, in handle_legacy_message_from_msgtype
out_recordset = evaluateres_to_recordset(evaluate_res)
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/common/recordset_compat.py", line 294, in evaluateres_to_recordset
recordset.configs_records[f"{res_str}.metrics"] = ConfigsRecord(
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/common/record/configsrecord.py", line 85, in init
self[k] = configs_dict[k]
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/common/record/typeddict.py", line 38, in setitem
self._check_value_fn(value)
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/common/record/configsrecord.py", line 57, in _check_value
is_valid(value)
File "/root/anaconda3/envs/gpt4ts/lib/python3.9/site-packages/flwr/common/record/configsrecord.py", line 35, in is_valid
raise TypeError(
TypeError: Not all values are of valid type. Expected typing.Union[int, float, str, bytes, bool, typing.List[int], typing.List[float], typing.List[str], typing.List[bytes], typing.List[bool]] but <class 'numpy.float32'> was passed.

This error occurs after I run the code, but I'm having a hard time finding in the overall model code which parameter type in the model parameter transfer process is non-compliant, is there a simpler way that I can solve this problem

Steps/Code to Reproduce

from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

import numpy as np
import numpy.typing as npt

NDArray = npt.NDArray[Any]
NDArrayInt = npt.NDArray[np.int_]
NDArrayFloat = npt.NDArray[np.float_]
NDArrays = List[NDArray]

The following union type contains Python types corresponding to ProtoBuf types that

ProtoBuf considers to be "Scalar Value Types", even though some of them arguably do

not conform to other definitions of what a scalar is. Source:

https://developers.google.com/protocol-buffers/docs/overview#scalar

Scalar = Union[bool, bytes, float, int, str]
Value = Union[
bool,
bytes,
float,
int,
str,
np.float32,
List[bool],
List[bytes],
List[float],
List[int],
List[str],
]

Is it possible to fix this problem by modifying the code of the tying file in the library?

Expected Results

Normal is that the client is able to accept the model parameters for testing

Actual Results

aggregate_evaluate: received 0 results and 2 failures

@CHENxx23 CHENxx23 added the bug Something isn't working label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant