ModuleNotFoundError:没有名为“trl”的模块

问题描述 投票:0回答:1

我已经使用 pip 安装了 trl。

!pip show trl

并且正确显示包裹信息,

!pip show trl

Name: trl
Version: 0.7.10
Summary: Train transformer language models with reinforcement learning.
Home-page: https://github.com/huggingface/trl
Author: Leandro von Werra
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python3.10/dist-packages
Requires: accelerate, datasets, numpy, torch, transformers, tyro
Required-by: 

但是,当我在笔记本中导入时,它显示错误:

import trl

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[9], line 1
----> 1 import trl

ModuleNotFoundError: No module named 'trl'

为什么会出现这种差异?怎么解决?

python jupyter-notebook pip package
1个回答
0
投票

当我使用直接源安装时,问题得到解决,

pip install git+https://github.com/huggingface/trl.git
© www.soinside.com 2019 - 2024. All rights reserved.