拥抱面变压器conda安装问题

发布于 2025-01-19 07:34:49 字数 512 浏览 3 评论 0原文

默认情况下,conda安装变压器2.x但是,默认情况下,pip安装4.x,这是我想要的,但是通过conda。

如果我通过从Conda-Forge指定最新的分发文件来安装… conda安装https://anaconda.org/conda-forge/transformers/4.16.2/download/noarch/transformers-4.16.2-pyhd8ed1ab_0.tar.bz2

然后,它会抱怨环境并不一致,并列出引起问题的软件包,即Pytorch版本1.11。

我卸下了Pytorch,然后按照上面列出的安装安装,然后安装进行。然后,我尝试安装数据集… conda安装数据集

现在,它抱怨由于我安装了变压器4.16.2,环境是不一致的。

不确定有什么问题以及如何将Pytorch,Transformers和Dataset一起安装而没有任何问题。 我是否需要这些特定版本才能使其正常工作,找不到有关拥抱面文档或支持页面的任何此类准则。

谢谢。

conda by default installing transformers 2.x however pip installs 4.x by default which is what I want but via conda.

If I install by specifying the latest distribution file from conda-forge…
conda install https://anaconda.org/conda-forge/transformers/4.16.2/download/noarch/transformers-4.16.2-pyhd8ed1ab_0.tar.bz2

then it complains that environment is not consistent and list the package causing the issue which is PyTorch version 1.11.

I removed pytorch and then installed as listed above then installation go through. I then tried installing datasets…
conda install datasets

Now it complains that environment is inconsistent due to transformers 4.16.2 that I installed.

Not sure whats wrong and how to install pytorch, transformers and datasets together with no issue.
Do I need specific versions of these to make it work, could not find any such guideline on huggingface docs or support pages.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明天过后 2025-01-26 07:34:50

刚刚尝试在venv中安装变压器,我将按照以下操作进行操作

conda install transformers

,并安装了版本Transformers-4.18.0

如果一个人想从频道huggingface专门安装,则执行以下最后

conda install -c huggingface transformers

一个情况,请使用pip 进行安装,因为使用pip可以潜在地破坏一个人的安装(pipconda不要以相同的方式管理依赖关系)。

pip install transformers

或者,如果已经安装了Transformers,则通过指定版本

pip install transformers==4.18.0

或直接从源

pip install git+https://github.com/huggingface/transformers

指定版本,并希望安装与当前拥有的版本不同的版本,则应通过-IV。 (如下所示

pip install -Iv transformers==4.18.0 

检查是否正确安装了transformers

python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"

预算的型号,然后打印出标签并得分。


有关Transformers安装的更多信息,请咨询此页面

Just tried installing transformers in the venv that I will be working on as follows

conda install transformers

And it installed the version transformers-4.18.0.

If one wants to install specifically from the channel huggingface, then do the following

conda install -c huggingface transformers

Last case scenario, install it with pip, as using pip can potentially wreck one's installation (pip and conda do not manage dependencies in the same way).

pip install transformers

Or, by specifying the version

pip install transformers==4.18.0

Or directly from the source

pip install git+https://github.com/huggingface/transformers

If one has transformers already installed and wants to install a different version than the one we currently have, one should pass -Iv (as suggested here)

pip install -Iv transformers==4.18.0 

To check if transformers was properly installed, run the following

python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"

It will download a pretrained model, then print out the label and score.


For more information on transformers installation, consult this page.

谁的年少不轻狂 2025-01-26 07:34:50

对我有用的是从 conda-forge 频道而不是 huggingface 频道下载,即
conda 安装 conda-forge::transformers

What worked for me is to download from conda-forge channel instead of huggingface channel, i.e.
conda install conda-forge::transformers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文