小编mar*_*lon的帖子

如何从huggingface下载模型?

例如,我想在https://huggingface.co/modelsbert-base-uncased上下载,但找不到“下载”链接。或者说不能下载?

transformer-model huggingface-transformers

52
推荐指数
4
解决办法
13万
查看次数

如何从 ubuntu 中完全删除 cuda?

我有 ubuntu 18.04,不小心安装了 cuda 9.1 来运行 Tensorflow-gpu,但似乎 tensorflow-gpu 需要 cuda 10.0,所以我想先通过执行来删除 cuda:

martin@nlp-server:~$ sudo apt-get remove --auto-remove nvidia-cuda-toolkit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to …
Run Code Online (Sandbox Code Playgroud)

ubuntu cuda tensorflow

26
推荐指数
4
解决办法
9万
查看次数

为什么我无法使用 pip 安装 cudatookkit=10.1,但可以使用 conda?

$ pip install cudatoolkit==10.1
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement cudatoolkit==10.1 (from versions: none)
ERROR: No matching distribution found for cudatoolkit==10.1
Run Code Online (Sandbox Code Playgroud)

这失败了。然而,conda 的工作原理是:

$ conda install cudatoolkit=10.1
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /data0/congmin/miniconda

  added / updated specs:
    - cudatoolkit=10.1


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2021.5.25  |       h06a4308_1         112 KB
    certifi-2021.5.30          |   py38h06a4308_0 …
Run Code Online (Sandbox Code Playgroud)

python pip conda

20
推荐指数
1
解决办法
7万
查看次数

如何忽略项目中的同名目录__pycache__?

__pycache__目录在使用 git 更新时很烦人。每当我使用 时git status,都会出现很多 .pyc 文件。如何方便地列出__pycache__文件中的文件夹,.gitignore以便在使用时不显示git status

例如:

core/__pycache__/utils.cpython-36.pyc
core/__pycache__/version.cpython-36.pyc
core/actions/__pycache__/__init__.cpython-36.pyc
core/actions/__pycache__/action.cpython-36.pyc
Run Code Online (Sandbox Code Playgroud)

我是否必须将所有单个__pycache__文件都列出到 gitignore 文件中?

git gitignore

18
推荐指数
4
解决办法
2万
查看次数

为什么使用两种不同的方式对行进行计数不同。加载文本?

import pathlib

file_path = 'vocab.txt'
vocab = pathlib.Path(file_path).read_text().splitlines()
print(len(vocab))

count = 0
with open(file_path, 'r', encoding='utf8') as f:
  for line in f:
    count += 1

print(count)
Run Code Online (Sandbox Code Playgroud)

这两个计数是 2122 和 2120。它们不应该是相同的吗?

python

9
推荐指数
1
解决办法
507
查看次数

如何禁用as-you-type JBT Validator

我在JBoss Developer Stutio工作,我经常看到"As-you-type JBT validor"消息,当它发生时,我什么都不做,因为它消耗了大量资源.在Preferences-> validation-> JSF view validator中,我无法专门禁用它,因为只能选择"Enable all"或"Disable all"选项.

如何摆脱这种头痛?

jboss jboss-developer-studio

8
推荐指数
1
解决办法
4662
查看次数

zsh:未找到匹配项:uvicorn[标准]

我按照示例安装 unvicorn:

https://www.uvicorn.org/
Run Code Online (Sandbox Code Playgroud)

通过做:

pip install uvicorn[standard]
Run Code Online (Sandbox Code Playgroud)

但收到以下错误:

 % pip install uvicorn[standard]
zsh: no matches found: uvicorn[standard]
Run Code Online (Sandbox Code Playgroud)

然而这有效:

 % pip install uvicorn
Run Code Online (Sandbox Code Playgroud)

我使用的是 Python 3.7 的 MacPro。

fastapi

8
推荐指数
2
解决办法
5890
查看次数

使用ThreadPoolExecutor时如何保持输入的原始顺序?

from concurrent.futures import ThreadPoolExecutor, as_completed

def add_one(number, n):
    return number + 1 + n

def process():
    all_numbers = []
    for i in range(0, 10):
        all_numbers.append(i)

    threads = []
    all_results = []
    with ThreadPoolExecutor(max_workers=10) as executor:
        for number in all_numbers:
            threads.append(executor.submit(add_one, number))

        for index, task in enumerate(as_completed(threads)):
            result = task.result()
            #print(result)
            all_results.append(result)

    for index, result in enumerate(all_results):
        print(result)

process()
Run Code Online (Sandbox Code Playgroud)

如果我设置max_works=1,则会按顺序打印出1到10;如果我设置 max_workers = 10,则顺序可能是随机的:

5
3
10
7
1
8
6
2
4
9
Run Code Online (Sandbox Code Playgroud)

当使用 ThreadPoolExecutor 处理项目列表时,如何保持输入的原始顺序(如本例所示)?

python threadpoolexecutor

7
推荐指数
1
解决办法
7902
查看次数

表字段命名约定和SQL语句

关于在数据库中命名表字段,我有一个实际问题.例如,我有两个表:

student (id int; name varchar(30))
teacher (id int, s_id int; name varchar(30))
Run Code Online (Sandbox Code Playgroud)

两个表中都有'id'和"name".在SQL语句中,如果没有前缀的表名,则两者将不明确.两种选择:

  1. 使用表名作为SQL'where'子句中字段的前缀
  2. 在表中使用前缀字段名称,以便在'where'子句中不使用前缀.

哪一个更好?

sql

6
推荐指数
1
解决办法
1187
查看次数

为什么我找不到 lsvirtualenv 命令?

我想找到我的机器上有多少个虚拟环境,我运行了:

lsvirtualenv
Run Code Online (Sandbox Code Playgroud)

但收到错误信息:

-bash: lsvirtualenv: command not found
Run Code Online (Sandbox Code Playgroud)

我没有使用 anaconda 来创建我的虚拟环境。

python virtualenv

6
推荐指数
1
解决办法
1万
查看次数