- 博客(39)
- 资源 (1)
- 收藏
- 关注

原创 在windows下用anaconda安装 pytorch
在windowws下用anaconda安装 pytorch概述1.安装anaconda2.查看自己的显卡驱动版本(很重要!!!)可能遇到的问题显卡型号3.安装pytorch注意点判断是否安装成功总结概述本次主要是谈论下如何在windows10下面安装pytorch的gpu版本,第一次写博客,可能写的有点啰嗦,还望大家耐心看下去。1.安装anaconda这个网上的教学很多,百度一下即可,要注...
2020-12-07 12:33:05
3838
原创 anaconda清华源配置
channels: - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-.
2022-04-12 16:31:06
1991
1
原创 大整数乘法
大整数乘法代码1.分治代码在divide_conquer.py中,FFT代码在FFT.py中2.分别运行divide_conquer.py和FFT.py可以看到输出结果3.如果想直接修改测试示例可以修改随机种子,或者直接使用solution.multiply方法进行打印...
2022-01-12 11:32:37
244
原创 ubuntu安装
1.安装地址:欢迎访问网易开源镜像站 (网易)选择ubuntu-release ubuntu-21.10-desktop-amd64.iso安装教程 Ubuntu18.04安装教程_Sunshine的博客-优快云博客_ubuntu安装教程下载最新的一直下一步2.启动ssh服务Ubuntu下使用SSH 命令用于登录远程桌面_yucicheung的博客-优快云博客_ubuntu使用ssh3.设置root密码su第一次以root身份登录_爱编程的莲莲猫的博客-优快云博客_su..
2021-12-11 13:05:44
1246
原创 github上传文件
git init # 创建仓库git remote add origin https://github.com/lilinqin/machine_learning_homework.git # 远程连接git pull origin master # 获取远程文件git add . # 添加文件到缓存区git commit -m "提交" # 提交只本地仓库git push -u origin master # 上传...
2021-12-10 10:07:06
300
原创 BERT的MLMhead
from transformers.models.bert.modeling_bert import BertOnlyMLMHeadfrom transformers import BertConfig, BertPreTrainedModel, BertModelclass BertLMHeadModel(BertPreTrainedModel): def __init__(self, config): super().__init__(config) sel.
2021-12-06 20:15:07
2012
原创 数据集随机划分
import randomindex = list(range(num_text))random.shuffle(index)train_len = int(num_text * 0.8)train_texts = texts[:train_len]train_labels = labels[:train_len]test_texts = texts[train_len:]test_labels = labels[train_len:]
2021-11-11 13:59:54
457
原创 vscode远程连接
1.安装插件remote development2.重启3.打开左边的资源管理器4.点击左上方的加号5.输入ssh://root:pwd@10.10.66.77:22,分别是用户名,密码,ip和端口号6.进入配置文件,保存7.点击远程连接,输入密码...
2021-10-21 19:27:08
182
原创 pytorch优化器对指定的层使用不同的学习率
在很多时候,训练模型时需要对不同层使用不同的学习率等参数。在实际操作中,可以通过指定每层参数的id来实现。这是本文用到的网络,需要将resnet和其余层设置不同的学习率。class GlobalModel(nn.Module): def __init__(self, embedding_size, output_size): super().__init__() self.resnet = MyResNet(BasicBlock, [2, 2, 2, 2])
2021-06-25 16:06:48
663
原创 pytorch利用resnet预训练模型提取特征
可以直接使用预训练模型,但是它的最终输出不是特征,而是每个类别的得分。本文以resnet18为例。import torchvision model = torchvision.models.resnet18(pretrained=True)为了使用预训练模型提取特征,需要自己将网络复制过来,进行修改。import torchimport torch.nn as nnfrom torchvision.models.resnet import Bottleneck, BasicBlock,
2021-06-25 15:48:49
6441
7
原创 ubuntu安装NVIDIA驱动+cuda10.1+cudnn
驱动1.禁用nouveausudo vim /etc/modprobe.d/blacklist.conf在文件末尾加上blacklist nouveauoptions nouveau modeset=0执行命令sudo update-initramfs -u 重新启动查看是否禁用,如果没有输出,则表示已经禁用lsmod | grep nouveau2.安装显卡驱动根据显卡型号下载驱动,网址3. 安装驱动需要给文件添加权限sudo chmod +x NVIDIA-Linu
2021-04-14 20:25:25
133
原创 jupyter notebook ipynb转变为py文件
try: !jupyter nbconvert --to python utility.ipynbexcept: pass
2020-12-27 10:25:37
236
原创 qt-5.9.7-vc14h73c81de_0
一直安装失败,参考了该网站,添加了环境变量%SystemRoot%\system32,并用管理员模式打开miniconda prompt进行安装,然后就ok了,貌似是环境的问题,具体为什么也不清楚。
2020-12-03 18:59:15
593
原创 gensim下载时出现找不到information.json的问题
主动在C:\Users\18360\gensim-data中添加information.json文件{ "corpora": { "semeval-2016-2017-task3-subtaskBC": { "num_records": -1, "record_format": "dict", "file_size": 6344358, "reader_code": "https://g
2020-10-19 21:55:03
2410
3
原创 如何在任意位置打开jupyter notebook
在命令行输入jupyter notebook 文件夹地址例如jupyter notebook C:\course1
2020-10-18 19:08:16
2541
转载 tornado学习网站
https://docs.pythontab.com/tornado/introduction-to-tornado/ch3.html
2020-03-17 17:50:39
149
转载 二叉搜索的细节问题
https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/solution/er-fen-cha-zhao-suan-fa-xi-jie-xiang-jie-by-labula/
2020-03-12 18:17:21
106
原创 ubuntu切换清华源
https://blog.youkuaiyun.com/sitebus/article/details/104390645
2020-03-05 17:06:07
256
原创 刷leetcode常用的c++知识(留着自己用)
刷leetcode常用的c++知识(留着自己用)STLstackvector参考https://blog.youkuaiyun.com/qq_34489943/article/details/79771371https://blog.youkuaiyun.com/veghlreywg/article/details/80400382STLstack#include<stack> //头文件sta...
2020-02-29 12:19:32
2189
原创 问题WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
出现以下问题解决办法python -m 会指定你当前使用的python版本python -m pip install torchtext(包名)安装成功!
2020-02-13 18:23:07
59881
1
原创 mm,bmm和matmul的区别
参考 https://blog.youkuaiyun.com/leo_95/article/details/89946318mm只能是矩阵乘法,即分别为(n×m)和(m×q)bmm是三维张量相乘,即(b×n×m)和(b×m×q),b为批量matmul为张量乘法,任意维度...
2020-02-08 14:51:07
1771
原创 pytorch的gather函数
官方文档torch.gather(input, dim, index, out=None) → Tensor Gathers values along an axis specified by dim. For a 3-D tensor the output is specified by: out[i][j][k] = input[index[i][j][k]][...
2020-02-08 11:28:09
248
原创 pytorch的unsqueeze和squeeze
unsqueeze(i):在第i维增加一个维度squeeze(i):去掉第i个维度,只有维度为1时有效例子
2020-02-07 20:42:34
149
原创 在jupyter notebook上训练模型gpu显存不够,关闭后模型仍占有显存的坑
在任务管理器的性能一栏能看到gpu的运行情况在jupyter notebook上训练模型gpu显存不够,关闭后发现GPU仍然占有很大显存,导致后面运行不了,无论是修改batch_size还是之类的,都无效。解决的办法,重启服务,即红色所指即可,再重新运行程序就ok了。...
2020-02-02 15:13:20
5834
10
原创 jupyter notebook常用快捷键
参考 https://www.cnblogs.com/sui776265233/p/9759303.html这里我只记录几个常用的方便我自己使用运行所有命令模式(按Esc)Enter : 转入编辑模式Ctrl-Enter : 运行本单元Alt-Enter : 运行本单元,在其下插入新单元Y : 单元转入代码状态M :单元转入markdown状态1 : 设定 1 级标题2 :...
2020-01-30 11:04:34
366
原创 anaconda几个常用的cmd指令
这篇文章主要是记录了anaconda的指令来方便自己查看,参考了这位博主这里,和这位博主这里当然这位博主还介绍了其他更加深入的方面,有兴趣的话可以去看看。环境切换到base环境activate切换py37环境activate py37离开环境conda dectivate删除环境conda remove -n py37 --all创建名为py37的环境并指定python版本为...
2020-01-28 21:17:17
1598
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人