verl icon indicating copy to clipboard operation
verl copied to clipboard

ImportError: cannot import name 'get_tcp_uri' from 'vllm.utils'

Open zq2r opened this issue 1 year ago • 10 comments

System Info

File "/home/xxx/algo/verl/verl/workers/rollout/vllm_rollout/vllm_async_server.py", line 37, in from vllm.utils import FlexibleArgumentParser, get_tcp_uri ImportError: cannot import name 'get_tcp_uri' from 'vllm.utils' (/home/xxx/miniconda3/envs/verl/lib/python3.10/site-packages/vllm/utils.py)

It seems that 'get_tcp_uri' is not available in vllm.utils for the recommended version (vllm==0.8.5).

Information

  • [x] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [x] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

python3 -m verl.trainer.main_ppo
algorithm.adv_estimator=grpo
data.train_files=$HOME/data/gsm8k/train.parquet
data.val_files=$HOME/data/gsm8k/test.parquet
data.train_batch_size=64
data.max_prompt_length=1024
data.max_response_length=1024
data.filter_overlong_prompts=True
data.truncation='error'
data.return_raw_chat=True
actor_rollout_ref.model.path=$MODEL
actor_rollout_ref.actor.optim.lr=1e-6
actor_rollout_ref.model.use_remove_padding=True
actor_rollout_ref.actor.ppo_mini_batch_size=16
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4
actor_rollout_ref.actor.use_kl_loss=True
actor_rollout_ref.actor.kl_loss_coef=0.0001
actor_rollout_ref.actor.kl_loss_type=low_var_kl
actor_rollout_ref.actor.entropy_coeff=0
actor_rollout_ref.model.enable_gradient_checkpointing=True
actor_rollout_ref.actor.fsdp_config.param_offload=False
actor_rollout_ref.actor.fsdp_config.optimizer_offload=False
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=16
actor_rollout_ref.rollout.tensor_model_parallel_size=1
actor_rollout_ref.rollout.name=vllm
actor_rollout_ref.rollout.mode=async
actor_rollout_ref.rollout.max_model_len=1024
actor_rollout_ref.rollout.agent.num_workers=1
actor_rollout_ref.rollout.gpu_memory_utilization=0.5
actor_rollout_ref.rollout.n=8
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=16
actor_rollout_ref.ref.fsdp_config.param_offload=True
algorithm.use_kl_in_reward=False
trainer.critic_warmup=0
trainer.logger=['console','wandb']
trainer.project_name='rebuttal'
trainer.experiment_name='qwen2_5_1_5b_base_math_grpo_1k'
trainer.n_gpus_per_node=1
trainer.nnodes=1
trainer.save_freq=10
trainer.test_freq=5
trainer.total_epochs=20

Expected behavior

This bug should not occur

zq2r avatar Sep 27 '25 17:09 zq2r

I solve this concern by mannually define the get_tcp_uri function:

def is_valid_ipv6_address(address: str) -> bool: try: ipaddress.IPv6Address(address) return True except ValueError: return False

def get_tcp_uri(ip: str, port: int) -> str: if is_valid_ipv6_address(ip): return f"tcp://[{ip}]:{port}" else: return f"tcp://{ip}:{port}"

zq2r avatar Sep 28 '25 09:09 zq2r

Our CI image has bump to vllm==0.10.0

wuxibin89 avatar Sep 28 '25 11:09 wuxibin89

I added this code, but it introduced other bugs. I upgraded vLLM to 0.10.0 and also upgraded FlashAttention, and the Quickstart now runs successfully.

March-H avatar Oct 14 '25 08:10 March-H

我添加了这段代码,但它引入了其他错误。 我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行了。

可以公布一下您的版本之类的吗? 我更新到vllm==0.10.0后出现了新的错误。。。

Image

ShuaiLyu0110 avatar Oct 22 '25 12:10 ShuaiLyu0110

我添加了这段代码,但它引入了其他错误。 我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行了。

可以公布一下您的版本之类的吗? 我更新到vllm==0.10.0后出现了新的错误。。。

Image

https://github.com/Dao-AILab/flash-attention/issues/1708 更换flash-attn版本(升级或降级)能解决很多问题

March-H avatar Oct 22 '25 13:10 March-H

我添加了这段代码,但它引入了其他错误。 我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行了。

可以公布一下您的版本之类的吗? 我更新到vllm==0.10.0后出现了新的错误。。。 Image

Dao-AILab/flash-attention#1708 更换flash-attn版本(升级或降级)能解决很多问题

我知道 可是我明明换了flash-attn=2.7.4.post1 还是会有问题... 你用的python版本跟cuda版本是多少呢?会不会是这个问题

ShuaiLyu0110 avatar Oct 22 '25 13:10 ShuaiLyu0110

我添加了这段代码,但它引入了其他错误。 我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行了。

可以公布一下您的版本之类的吗? 我更新到vllm==0.10.0后出现了新的错误。。。 Image

Dao-AILab/flash-attention#1708 更换flash-attn版本(升级或降级)能解决很多问题

我知道 可是我明明换了flash-attn=2.7.4.post1 还是会有问题... 你用的python版本跟cuda版本是多少呢?会不会是这个问题

我没遇到你这个问题,但我遇到了flash-attn版本造成的其它问题。我现在环境是: python==3.10 torch==2.7.1 cuda==12.4 以及其它一些都和文档里面一样。不过我现在flash-attn版本是2.6.3,你可以降级试试。 因为某些原因我重建过一次容器环境,在上一次中我使用2.7.4.post1成功运行了,但是这一次出现了一些版本bug(可能是我配环境过程出现了一些不同导致的)。 但是两次我在更新vllm到0.10.0后,都只解决了flash-attn的版本bug就能运行了。

March-H avatar Oct 22 '25 13:10 March-H

I added this code, but it introduced other bugs.我添加了此代码,但它引入了其他错误。 I upgraded vLLM to 0.10.0 and also upgraded FlashAttention, and the Quickstart now runs successfully.我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行。

谢谢你!我已经配环境配置了一整天,就是为了去兼容verl关于agent_loop的配置,一开始我打算使用sglang来作为推理后端,但是由于之前没有经验,因此半天时间浪费了。下午开始尝试vllm,我是使用官网的版本0.8.5post1,但是这不起作用,于是我安装了vllm0.10.2,之后查看python版本,torch版本等等,然后找到合适的flash-attn版本,最近安装,一次性就成功了!谢谢

StoKou avatar Oct 28 '25 07:10 StoKou

I added this code, but it introduced other bugs.我添加了此代码,但它引入了其他错误。 I upgraded vLLM to 0.10.0 and also upgraded FlashAttention, and the Quickstart now runs successfully.我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行。

谢谢你!我已经配环境配置了一整天,就是为了去兼容verl关于agent_loop的配置,一开始我打算使用sglang来作为推理后端,但是由于之前没有经验,因此半天时间浪费了。下午开始尝试vllm,我是使用官网的版本0.8.5post1,但是这不起作用,于是我安装了vllm0.10.2,之后查看python版本,torch版本等等,然后找到合适的flash-attn版本,最近安装,一次性就成功了!谢谢

请问可以分享一下成功安装具体的版本吗?比如verl的版本,python, torch, flash-attn的版本

zq2r avatar Oct 28 '25 07:10 zq2r

I added this code, but it introduced other bugs.我添加了此代码,但它引入了其他错误。 I upgraded vLLM to 0.10.0 and also upgraded FlashAttention, and the Quickstart now runs successfully.我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行。我添加了这段代码,但它引入了其他错误。我添加了此代码,但它引入了其他错误。我将 vLLM 升级到 0.10.0,还升级了 FlashAttention,现在 Quickstart 运行成功。我将 vLLM 升级到 0.10.0 并升级了 FlashAttention,现在 Quickstart 可以成功运行。

谢谢你!我已经配环境配置了一整天,就是为了去兼容verl关于agent_loop的配置,一开始我打算使用sglang来作为推理后端,但是由于之前没有经验,因此半天时间浪费了。下午开始尝试vllm,我是使用官网的版本0.8.5post1,但是这不起作用,于是我安装了vllm0.10.2,之后查看python版本,torch版本等等,然后找到合适的flash-attn版本,最近安装,一次性就成功了!谢谢

请问可以分享一下成功安装具体的版本吗?比如verl的版本,python, torch, flash-attn的版本

verl我是使用verl0.6.0最新的代码,python使用3.10,cuda版本为12.4,torch在我执行pip install vllm=0.10.2(之前说错了)的时候,貌似vllm会自动下载torch2.8,因此我安装的flash-attn为flash_attn-2.8.3+cu12torch2.8cxx11abiTRUE-cp310-cp310-linux_x86_64.whl(https://github.com/Dao-AILab/flash-attention/releases这里可以找到),
安装成功后可以运行官方的examples/sglang_multiturn/run_qwen2.5-3b_gsm8k_tool_agent_mlflow.sh(需要把actor_rollout_ref.rollout.name改成vllm)

StoKou avatar Oct 28 '25 07:10 StoKou