自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 简单地下载huggingface model权重

1.下载 huggingface model方法只要将第三行,链接地址替换对应的model权重地址。例如gpt2···!sudo apt-get install git-lfs!git lfs install!git clone https://huggingface.co/hfl/chinese-roberta-wwm-ext-large/···

2022-05-15 22:03:00 1904 2

原创 3.GLUE Dataset

1. XNLICross-lingual Natural Language Inference,跨语言的自然语言推断,huggingface在线示例。判断premise是否被hypothesis蕴含。label:neutral, entailment蕴含,contradiction矛盾.分类任务.

2021-11-27 13:22:13 897

原创 5. KFold, StratifiedKFold,StratifiedShuffleSplit, GroupKFold区别以及Stratified Group KFold

5. KFold, StratifiedKFold,StratifiedShuffleSplit, GroupKFold区别以及Stratified Group KFold

2021-09-11 22:37:29 2727

原创 4. Categorical Encoding with CatBoost Encoder

4. Categorical Encoding with CatBoost Encoder记录下CatBoost Encoder 特征编码,来自于Categorical Encoding with CatBoost Encoder。大部分机器学习算法要求数据是数字格式的,对于类别这种非数字格式,我们要将其转换为数字形式。方法非常多,Catboost使用的是target-based categorical 编码。其计算公式为:TargetCount+priorFeatureCount+1(1)\fr

2021-09-10 18:31:57 1080

原创 3.LGBM 无法使用GPU tree

问题描述:在使用LGBM是设置GPU以及ID后 'device': 'gpu', 'gpu_platform_id': 0, 'gpu_device_id': 0, 使用出现:LightGBMError: GPU Tree Learner was not enabled in this build.Please recompile with CMake option -DUSE_GPU=1解决方案:LGBM编译有要求,最好要加上 -DUSE_GPU=1.git clone --recursiv

2021-08-25 14:46:34 1666

原创 1.cannot import name ‘container_abcs‘ from ‘torch._six‘

问题描述:在导入torch或torchvision 中,由于torchvision与torch版本不匹配,torchvision无法导入,出现ImportError: cannot import name 'container_abcs' from 'torch._six' (/usr/local/lib/python3.7/dist-packages/torch/_six.py)解决方案:查看自己的版本torch.__version__,torchvision.__version__, 如1.9

2021-08-22 16:43:15 6799 8

原创 3. tensorflow TPU使用 UnimplementedError: File system scheme ‘[local]‘

问题描述:在Colab中使用TPU读取数据时出现:UnimplementedError: File system scheme '[local]' not implementedignore_order = tf.data.Options() if not ordered: ignore_order.experimental_deterministic = False dataset = tf.data.TFRecordDataset(filenames, num_pa

2021-08-13 12:51:06 683

原创 1.DICOM文件转array

DICOM文件读取来源于 Convert dicom to np.array - the correct way1. 读取import numpy as npimport pydicomfrom pydicom.pixel_data_handlers.util import apply_voi_lutdef read_xray(path, voi_lut=True, fix_monochrome=True): """读取DICOM格式数据转为np.array uint8格式"""

2021-08-06 17:36:17 742

原创 2. colab 和kaggle使用

1. 挂载硬盘import osfrom google.colab import drivedrive.mount('/content/drive', force_remount=True)2. kaggle使用去kaggle生成自己的token令牌上传到相应位置, 复制加权限#!mkdir /root/.kaggle/ #如果没有!cp /content/kaggle.json /root/.kaggle/kaggle.json!chmod 600 /root/.kaggle/kaggl

2021-08-05 15:19:59 1215

原创 2. t-NSE 可视化

1. t-NSE 可视化t-SNE是t-Distributed Stochastic Neighbor Embedding简写,出自Visualizing Data using t-SNE论文。t-SNE是一种非线性降维算法,通过原始空间和嵌入空间的联合概率的KL散度来评估降维到嵌入空间的效果,就是用KL散度的函数作为loss函数,然后通过梯度下降最小化loss函数,最终获得收敛结果。并且t-SNE计算复杂度高。下面是t-SNE可视化手写数字的代码:import numpy as npimport

2021-07-31 21:03:24 1614

原创 2. Tensorflow Dataset

2.Tensorflow Dataset1. from_tensor_slices 从tensor中切片建立数据集1.x版本示例, 示例为1.2.0:dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6, 7, 8, 9]) #创建Dataset对象iterator = dataset.make_one_shot_iterator()#创建迭代器, 2.x中遗弃element = iterator.get_next()#g

2021-07-30 21:17:33 408

原创 1.SuperGLUE task

1. COPA: Choice of Plausibe Ansewers数据集代表了一项因果推理任务,其会向系统提供一个前提句子和两个可能的可选项。系统必须选择与前提句子有更可信因果关系的可选项。用于构建可选项的方法要确保需要因果推理才能解决该任务。样本要么针对前提句子的可能原因,要么则是可能结果,再加上模型的两个实例类型之间的简单问题消岐。Premise(前提): I knocked on my neighbor’s door.What happened as a result?Alterna

2021-07-27 16:23:03 1867

原创 1.无聊,拿GPT2写写诗!

无聊,拿GPT2写写诗!这个是开源GPT2中文的使用,安装requirements.txt,一定得安装对于版本torch, transformer, pytorch-lightning,不然会导入不了模型,出现 KeyError: 'state_dict,或者cuda加载不了获取 训练好的模型,包括 vocab.txt, config.json, model.bin,分别对应着词汇表,训练模型设置, 训练好的模型python /content/gpt2/generate.py --model_co

2021-07-26 13:25:55 466

原创 1. tf 2.5.0从keras.utils导入to_categorical报错

问题描述:tf=2.5.0中导入包from keras.utils import to_categorical报错ImportError: cannot import name 'to_categorical' from 'keras.utils' (/usr/local/lib/python3.7/dist-packages/keras/utils/__init__.py)解决方案:现在keras完全至于tf模块中,这个要从tensoflow根模块导入,修改为:from tensorf

2021-06-21 23:43:16 9257 11

原创 1. spacy 下载模型后导入报错

1. spacy 下载模型后导入报错比如spacy下载模型使用时,报错找不到python -m spacy download en_core_web_lgpython -m spacy download en_core_web_smimport spacynlp = spacy.load("en_core_web_lg")这样导入会报错 OSError: [E050] Can't find model 'en_core_web_lg'. It doesn't seem to be a sho

2021-06-17 16:59:36 1056

原创 1. 压缩和解压缩

压缩和解压缩按照每个命令以压缩解压缩顺序为例展示1. zip/unzip压缩指定目录 -r参数代表递归zip *.zip 目录zip -r all.zip all/ 解压缩到指定目录 unzip *.zip -d 目录unzip all.zip -d ./unzip/2. tar 相关tar 日常使用模板:tar [-c/x z/j vf] *.tar.gz/bz2 目录 (解压到指定目录前面加-C)如果后缀是gz, 参数指定为z如果后缀是bz2,参数指定为j-f后

2021-05-13 13:23:35 162

原创 1.sklearn AttributeError: ‘str‘ object has no attribute ‘decode‘

LogisticRegression 报错 AttributeError: ‘str’ object has no attribute ‘decode’stackoverflow解答解决办法将求解器指定为liblinear:logreg = LogisticRegression(solver='liblinear', class_weight="balanced")

2021-05-08 11:23:44 837 4

原创 3. 141 环形链表

3. 141 环形链表141. 环形链表# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def hasCycle(self, head: ListNode) -> bool: """ 快慢指针,如果快指针和慢

2021-04-22 14:33:42 37

原创 2. Leetcode 24 两两交换链表中的节点

2. 24 两两交换链表中的节点24. 两两交换链表中的节点# Definition for singly-linked list.# class ListNode:# def __init__(self, val=0, next=None):# self.val = val# self.next = nextclass Solution: def swapPairs(self, head: ListNode) -> ListNode:

2021-04-22 14:23:29 60

原创 1. Leetcode 206 反转链表

1. Leetcode 206 反转链表206. 反转链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListN

2021-04-22 14:09:38 62

原创 fasttext安装和问题解决

1.win10下fasttext安装下载 git clone https://github.com/facebookresearch/fastText.gitcd cd fastText安装 python setup.py install如果报错required VC++ 14.0就用下面VC++ tools工具,默认安装或者选择需要module。百度云链接如下:[Microsoft Visual C++ Build Tools](https://pan.baidu.com/s/14mUG_r

2020-10-06 19:50:31 766

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除