huggingface使用心得

初见

先安装git-lfs

然后安装这些

1
2
pip install transformers torch datasets
pip install huggingface_hub

在huggingface个人设置那边创建api可以

然后终端登陆

1
huggingface-cli login

在huggingface私有的dataset,

1
git clone https://huggingface.co/datasets/naseele/仓库名 
1
cd .\KOL_Database\

之后用Git操作就好了

如果网慢

1
2
git config --global http.proxy "http://127.0.0.1:10809"
git config --global https.proxy "http://127.0.0.1:10809"

一些可能会用到的操作:

1
2
3
4
5
6
7
8
9
10

git lfs install
git lfs track "*.db"
git add .\.gitattributes
//注意先单独把这个玩意交上去,再交其他的

git add "*.db"
git add .
git commit -m "aadfsafsfasef"
git push
1
2
3
git rm --cached 111/03/result/111.db
git reset --hard origin/main
git push -f origin main

tree /F查看项目架构

1
2
3
4
5
6
7
8
9
10
11
还没addcommit了?
git reset --soft HEAD^

命令详解:
HEAD^ 表示上一个版本,即上一次的commit,也可以写成HEAD~1
如果进行两次的commit,想要都撤回,可以使用HEAD~2

–soft
不删除工作空间的改动代码 ,撤销commit,不撤销git add file
–hard
删除工作空间的改动代码,撤销commit且撤销add,会导致本次改动的代码丢失

仓库后来移交给组织了(私有仓库不能直接拉人)

1
git remote set-url https://huggingface.co/datasets/组织名/仓库名