【学术】个人知识库
【学术】个人知识库
【学术】个人知识库
anaconda3 用
- 创建与移除环境(包括移除下载的库)
1
2
3
conda create -n env_name python=X.X(python版本号)
conda remove -n ENV_NAME --all
- 添加清华镜像源
1
2
3
4
5
6
7
8
9
10
11
12
13
1.查看anaconda中已经存在的镜像源
conda config --show channels
2.添加镜像源(永久添加)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
3.设置搜索时显示通道地址
conda config --set show_channel_urls yes
- 磁盘空间不够
1
2
3
TMPDIR=xxxxx pip install -r requirements.txt --no-cache-dir
# xxxx 为临时路径 不需要带引号
安装gpu版本的pytorch
找CUDA匹配版本
conda activate
激活环境后,先尝试用 Conda 下的方式下载不行的话就用 wheel 下的方式下载
无匹配版本
- 处理:Python 版本不对
1
ERROR: Could not find a version that satisfies the requirement
GitHub Desktop GPG
1
2
3
gpg --list-secret-keys --keyid-format LONG
git config --global user.signingkey <GPG_KEY_ID>
git config --global commit.gpgsign true
screen 关电脑服务器继续跑
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
创建:screen -S xxx
查看有多少会话:screen -ls
恢复:screen -r xxx.xxx
如果不能恢复:先screen -d xxx.xxx
再screen -r xxx.xxx
删除 screen -S xxx.xxx -X quit
完成以上步骤,使用ctrl+a+d退出screen,然后再×掉cmd窗口就可以
Detached意思是当前screen没有被打开,相对的是Attached表示当前screen正处在打开状态。
增加github克隆成功概率
用 ghproxy 代理进行 git clone
重点在于,在原本要克隆的网站地址前加入
https://mirror.ghproxy.com/
1
git clone https://mirror.ghproxy.com/https://github.com/........
huggingface
- 修改缓存路径
1
2
3
4
5
6
7
8
9
10
vim ~/.bashrc
# 在末尾行加入
export HF_HOME="/path/to/you/dir" # 替换为你想更改的目标路径
# 立即生效
source ~/.bashrc
# 查看是否生效
env | grep HF_HOME
vscode ssh 出错与修改 .vscode-server/ 存储位置
1
rm -rf .vscode-server/
NER 模型学习参考
加速 Stanford NER
1
2
3
4
5
6
7
8
sentence = conversation[i][0]['value']
text = sentence
sentences = text
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in nltk.sent_tokenize(sentences)]
# tag sentences
ne_annotated_sentences = sn.tag_sents(tokenized_sentences)
Stanford NER
1
pip install stanza
1
2
3
4
5
import stanza
nlp = stanza.Pipeline(lang='en', processors='tokenize,ner')
doc = nlp("Chris Manning teaches at Stanford University. He lives in the Bay Area.")
print(*[f'entity: {ent.text}\ttype: {ent.type}' for ent in doc.ents], sep='\n')
克服网络问题
参考该链接
微调大模型
GPU 显存不够 与 指定显卡
环境设置要放在最最最最最最前面!!!!!!!!也就是第一二行的位置!!!!
1
2
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "7"
一些书写注意
The mathematics powered by MathJax:
\[\begin{equation} \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} \label{eq:series} \end{equation}\]We can reference the equation as \eqref{eq:series}.
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]An example showing the
tip
type prompt.
An example showing the
info
type prompt.
An example showing the
warning
type prompt.
An example showing the
danger
type prompt.
This post is licensed under CC BY 4.0 by the author.