verl icon indicating copy to clipboard operation
verl copied to clipboard

When I run the main_eval.py script for evaluation, an error occurs: "ModuleNotFoundError: No module named 'custom_module'".

Open yinspeng123 opened this issue 5 months ago • 9 comments

/home/yinshengpeng/anaconda3/envs/verl/bin/python /home/yinshengpeng/nuoya/verl/verl/trainer/main_eval.py data.path=/home/yinshengpeng/nuoya/verl/data/DigitalLearningGmbH___math-lighteval/qwen3_0.6b_length_gen_test.parquet custom_reward_function.path=/home/yinshengpeng/nuoya/verl/verl/utils/reward_score/math.py 2025-07-22 14:46:23,853 INFO worker.py:1908 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 using customized reward function 'compute_score' from '/home/yinshengpeng/nuoya/verl/verl/utils/reward_score/math.py' 0%| | 0/5000 [00:03<?, ?it/s] Error executing job with overrides: ['data.path=/home/yinshengpeng/nuoya/verl/data/DigitalLearningGmbH___math-lighteval/qwen3_0.6b_length_gen_test.parquet', 'custom_reward_function.path=/home/yinshengpeng/nuoya/verl/verl/utils/reward_score/math.py'] Traceback (most recent call last): File "/home/yinshengpeng/nuoya/verl/verl/trainer/main_eval.py", line 68, in main data_source, score = ray.get(result_id) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper return fn(*args, **kwargs) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper return func(*args, **kwargs) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 2849, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 937, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(RaySystemError): ray::process_item() (pid=4164622, ip=222.29.51.164) At least one of the input arguments for this task could not be computed: ray.exceptions.RaySystemError: System error: No module named 'custom_module' traceback: Traceback (most recent call last): ModuleNotFoundError: No module named 'custom_module'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace. (process_item pid=4164622) No module named 'custom_module' (process_item pid=4164622) Traceback (most recent call last): (process_item pid=4164622) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/serialization.py", line 458, in deserialize_objects (process_item pid=4164622) obj = self._deserialize_object(data, metadata, object_ref) (process_item pid=4164622) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/serialization.py", line 315, in _deserialize_object (process_item pid=4164622) return self._deserialize_msgpack_data(data, metadata_fields) (process_item pid=4164622) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/serialization.py", line 270, in _deserialize_msgpack_data (process_item pid=4164622) python_objects = self._deserialize_pickle5_data(pickle5_data) (process_item pid=4164622) File "/home/yinshengpeng/anaconda3/envs/verl/lib/python3.10/site-packages/ray/_private/serialization.py", line 260, in _deserialize_pickle5_data (process_item pid=4164622) obj = pickle.loads(in_band) (process_item pid=4164622) ModuleNotFoundError: No module named 'custom_module' (process_item pid=4164622) No module named 'custom_module'

yinspeng123 avatar Jul 22 '25 06:07 yinspeng123

Same problem. Any Ideas?

zzfoutofspace avatar Aug 04 '25 12:08 zzfoutofspace

Same issue

yzhEric avatar Aug 13 '25 08:08 yzhEric

I am also encountering the same issue

lihkinVerma avatar Aug 22 '25 17:08 lihkinVerma

Is there any progress on this issue?

liaoliaojun avatar Aug 28 '25 08:08 liaoliaojun

Ping!

GnarlyMshtep avatar Sep 13 '25 22:09 GnarlyMshtep

Modifying the original method in verl/utils/reward_score/__init__.py is fine; do not use a custom reward

liaoliaojun avatar Sep 15 '25 08:09 liaoliaojun

I was getting a similar error when doing grpo training and enabling async reward computation in the config. The following edits fixed it:

Add this

    reward_fn = load_reward_manager(
        config, tokenizer, num_examine=0, **config.reward_model.get("reward_kwargs", {})
    )

to this function before the if statement: https://github.com/volcengine/verl/blob/ba8555120af6a1f8dba8f09e60e4663ac5176efc/verl/trainer/ppo/reward.py#L176-L191

and change this line: https://github.com/volcengine/verl/blob/ba8555120af6a1f8dba8f09e60e4663ac5176efc/verl/trainer/ppo/ray_trainer.py#L1055

To

                            future_reward = compute_reward_async.remote(data=batch, config=self.config, tokenizer=self.tokenizer)

aghyad-deeb avatar Sep 24 '25 23:09 aghyad-deeb

It seems ray does not allow directly passing in a reward_fn. I solved by adding get_custom_reward_fn

@ray.remote
def process_item(config, data_source, response_lst, reward_data, extra_info=None):
    ground_truth = reward_data["ground_truth"]
    compute_score = get_custom_reward_fn(config)  # add this line
    score_lst = [compute_score(data_source, r, ground_truth, extra_info) for r in response_lst]
    return data_source, score_lst 

It solves my case perfectly

lihaoxin2020 avatar Oct 25 '25 21:10 lihaoxin2020

It seems ray does not allow directly passing in a reward_fn. I solved by adding get_custom_reward_fn看起来射线不允许直接通过 reward_fn。我通过加 get_custom_reward_fn 来解决

@ray.remote def process_item(config, data_source, response_lst, reward_data, extra_info=None): ground_truth = reward_data["ground_truth"] compute_score = get_custom_reward_fn(config) # add this line score_lst = [compute_score(data_source, r, ground_truth, extra_info) for r in response_lst] return data_source, score_lst It solves my case perfectly这完美解决了我的案子

good,thinks

mpj1234 avatar Nov 24 '25 07:11 mpj1234