Hugging face

hugging face的预训练模型下载慢的问题(使用BertModel.from_pretrained()等下载慢)_#苦行僧的博客-CSDN博客 (1)

[国内HuggingFace,预训练模型镜像使用_A_zhangpengjie的博客-CSDN博客 (1)](%E5%9B%BD%E5%86%85HuggingFace%EF%BC%8C%E9%A2%84%E8%AE%AD%E7%BB%83%E6%A8%A1%E5%9E%8B%E9%95%9C%E5%83%8F%E4%BD%BF%E7%94%A8_A_zhangpengjie%E7%9A%84%E5%8D%9A%E5%AE%A2-CSDN%E5%8D%9A%E5%AE%A2%20%28.md

Github问题

  • git错误 You are not currently on a branch的解决办法

    今天使用 git pull和git push 命令,分别报错:

    You are not currently on a branch, so I cannot use any
    'branch.<branchname>.merge' in your configuration file.
    Please specify which remote branch you want to use on the command
    line and try again (e.g. 'git pull <repository> <refspec>').
    See git-pull(1) for details.
    
    fatal: You are not currently on a branch.
    To push the history leading to the current (detached HEAD)
    state now, use
    
        git push origin HEAD:<name-of-remote-branch>
    

    这是什么意思呢? 说我当前不是在分支上,因此不能 pull 或者 push

    然后利用git branch查看一下,发现:

    git branch
    * (HEAD detached from bdcfe3d8)
    * master
    * issue68
    

    我当前所处的位置是在HEAD detached from bdcfe3d8上

    所以进行如下操作

    git branch temp bdcfe3d8
    git checkout master
    git merge temp
    

    这三行命令的意思是:

    1. 依据快照bdcfe3d8 创建 temp 分支
    2. 切换到 master 分支
    3. 将 temp 分支合并到 master分支

    再看一下所有的分支

    git branch
    * master
    * issue68
    * temp
    

    这时候就可以进行 git pull 和 git push 了 记得删除 temp 分支哦

    git branch -d temp
    
  • git 加tag

    git tag  # 查看所有tag
    git log  # 获取当前版本的编号
    git tag -a v1.0 9fceb02  # 加上tag
    git show v1.0  # 查看指定tag
    git push origin v1.0  # 上传tag
    
    # 下载指定的tag 版本
    git clone --branch <tag> <url>
    
  • 删除某个已经push的commit

    • 先将本地的项目指向错误的commit之前的一个commit (这个操作会删除该commit之后的所有代码更改, 记得备份现有代码)
    git reset –-hard  <commit hash>
    
    • 更安全地进行强制推送, --force-with-lease 可以不使用本地分支的提交强行覆盖远端推送分支.
    git push --force-with-lease
    
  • git push to branch

    git show  # 找到HEAD
    git push origin <HEAD>:<branch>
    
  • git branch

    Git 版本控制系統(2) 開 branch 分支和操作遠端 repo.

  • Git如何忽略已经上传的文件或文件夹?

    背景:使用IDEA新建项目,有时候会不小心将.idea文件夹上传上去,由于缓存的存在,之后再在.gitignore中添加这个文件夹就无效了,需要清除掉缓存.gitignore才会生效

    git rm --cached <file>

    这个命令会直接从暂存区删除文件,工作区则不做出改变。

    git rm --cached命令比git reset head更好,前者是删除掉,后者是替换掉。

    加上-r参数可以进行递归删除 eg: git rm -r --cached .idea/ 执行这个指令之后,需要重新提交代码,这个时候相当于提交了一个删除远程指定文件的请求,但是本地文件不会删除,而且.gitignore可以生效了

npm安装

npm install 报错 npm install error from the terminal

npm i --legacy-peer-deps