动手学深度学习 v2.0名称来自统计物理学55中一个模 拟粒子群分布的方程。 def softmax(X): X_exp = torch.exp(X) partition = X_exp.sum(1, keepdim=True) return X_exp / partition # 这里应用了广播机制 正如上述代码,对于任何随机输入,我们将每个元素变成一个非负数。此外,依据概率原理,每行总和为1。 X = torch normal(0, 1, (2, 5)) X_prob = softmax(X) X_prob, X_prob.sum(1) 55 https://en.wikipedia.org/wiki/Partition_function_(statistical_mechanics) 116 3. 线性神经网络 (tensor([[0.1686, 0.4055, 0.0849, 0.1064, 0.2347] reserved_tokens = [] # 按出现频率排序 counter = count_corpus(tokens) self._token_freqs = sorted(counter.items(), key=lambda x: x[1], reverse=True) # 未知词元的索引为0 self.idx_to_token = [''] + reserved_tokens (continues 0 码力 | 797 页 | 29.45 MB | 1 年前3
Lecture 7: K-Means46 K-Means Clustering Problem Given a set of observations X = {x1, x2, · · · , xN} (xi ∈ RD), partition the N observations into K sets (K ≤ N) {Ck}k=1,··· ,K such that the sets minimize the within-cluster0 码力 | 46 页 | 9.78 MB | 1 年前3
PyTorch Release Notesexamples, see: ‣ PyTorch website ‣ PyTorch project This document provides information about the key features, software enhancements and improvements, known issues, and how to run this container. PyTorch support details, see Deep Learning Frameworks Support Matrix. Key Features and Enhancements This PyTorch release includes the following key features and enhancements. ‣ PyTorch container image version support details, see Deep Learning Frameworks Support Matrix. Key Features and Enhancements This PyTorch release includes the following key features and enhancements. ‣ PyTorch container image version0 码力 | 365 页 | 2.94 MB | 1 年前3
AI大模型千问 qwen 中文文档OpenAI's API key and API base to use vLLM's API server. openai_api_key = "EMPTY" openai_api_base = "http://localhost:8000/v1" client = OpenAI( (续下页) 1.2. 快速开始 5 Qwen (接上页) api_key=openai_api_key, base_url=openai_api_base OpenAI # Set OpenAI's API key and API base to use vLLM's API server. openai_api_key = "EMPTY" openai_api_base = "http://localhost:8000/v1" client = OpenAI( api_key=openai_api_key, base_url=openai_api_base OpenAI # Set OpenAI's API key and API base to use vLLM's API server. openai_api_key = "EMPTY" openai_api_base = "http://localhost:8000/v1" client = OpenAI( api_key=openai_api_key, base_url=openai_api_base0 码力 | 56 页 | 835.78 KB | 1 年前3
从推荐模型的基础特点看大规模推荐类深度学习系统的设计 袁镱User与推荐系统交互,7*24⼩时 流式学习 1.2 Item和User新增,离开/遗忘, Embedding空间动态变化。 短期命中的⾼频key随时间缓慢变化 少量的⾼频key占据了主要访问需求 ⼀段时间样 本命中的 unique key ID/tag/交叉特征 (全量为:亿,千亿) ⼩特征 (个) 中型特征 (百) ID/tag/交叉特征 (千,千万) ⼩特征 (个) 百万级稠密 交叉参数 千亿级 稀疏输⼊ 层参数 单个样本命 中的key ⽐如:性别,年龄等取值少的特征; 热⻔⽂章的特征,活跃⽤户的特征 推荐系统 模型上线 在线推理 模型训练 ⽂章 新闻 视频 Item User Item特征 ⽤户反馈 Item推荐 Embedding参数 本⼩时访问过的key 上⼩时访问过的key 访 问 百 分 ⽐ 时间(⼩ 时) � Feature � CPU:固定64位key,基于L1缓存的查 询优化 � 业务需求 � 模型⼤⼩超TB � 单个请求需要15W个key � 耗时要求10ms以下 � 资讯业务请求量⼤ (>10000请求/秒) � 模型有多个版本 � 原有在线分布式存储系统的 问题 � 主备模式资源严重浪费 � 数据读写需要加锁 � ⽀持多模型和模型多版本 困难 >15亿key/秒 近千台 只读版本0 码力 | 22 页 | 6.76 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architecturesweight), WK (key weight) and WV (value weight) which are used to compute the query, key and value matrices for input sequences. Then, a softmax is applied to the scaled dot product of query and key matrices of each element. The weight matrices WQ, WK, and WV are identically shaped as (d, dk). The query, key and the value matrices are computed as follows: The resulting Q, K, and V matrices are shaped as (n Since this model will be deployed on mobile devices, footprint metrics along with quality are the key concerns. Given an image of a pet, our model will predict a segmentation mask over the pet. An example0 码力 | 53 页 | 3.92 MB | 1 年前3
全连接神经网络实战. pytorch 版state_dict () fo r key , value in s e l f . state_dict () . items () : # 根 据 命 名 来 筛 选, 只 要 线 性 部 分 i f ’ l i n e a r ’ in key : # 方 法 一: a=torch . normal (0 ,0.1 , t [ key ] . shape ) t [ key ] . copy_( 法 二: nn . i n i t . normal_ ( value , 0 ,0.1) #nn . i n i t . constant_ ( value , 0.01) 注意,我们把 key 打印出来以后得到: linear_relu_stack . 0 . weight linear_relu_stack . 0 . bias linear_relu_stack . 2 . weight0 码力 | 29 页 | 1.40 MB | 1 年前3
超大规模深度学习在美团的应用-余建平特征按照Hash方式分布式存储 • 模型并行调超参 grid search random search PS的多模型训练 • 提高内存使用效率 model group内共享特征key的存储 • 超大规模模型 -> 高扇出的分布式PS • 长尾效应:单个分片的抖动(网络、CPU)对请求影响变大 单分片4个9的可用性 16分片整体可用性:99.99% ^ 16 = 99 定义了流式数据的时钟,不可逆性 Smooth low watermark:异常数据时间跳变 流式拼接 • Checkpoint解决不重不丢问题 外存解决大数据量性能问题 在引擎中流转log key,特征数据在外存 • 分业务场景支持 轻量级predictor:仅支持模型的计算,特征由业务传入,无状态设计 自定义predictor: 提供业务抽象,支持业务自定义逻辑,插件化实现0 码力 | 41 页 | 5.96 MB | 1 年前3
机器学习课程-温州大学-01机器学习-引言),其中()内可以是列表、字典或字符串,因为字符串是以列表的形式存储的 ⚫字典(dict) 字典dict也叫做关联数组,用大括号{ }括起来,在其他语言中也称为map,使用键-值( key-value)存储,具有极快的查找速度,其中key不能重复。 56 Python控制流 ⚫顺序结构 ⚫分支结构 ⚫循环结构 ⚫break、continue和pass ⚫列表生成式 57 Python函数 ⚫调用函数0 码力 | 78 页 | 3.69 MB | 1 年前3
机器学习课程-温州大学-01深度学习-引言),其中()内可以是列表、字典或字符串,因为字符串是以列表的形式存储的 ⚫字典(dict) 字典dict也叫做关联数组,用大括号{ }括起来,在其他语言中也称为map,使用键-值( key-value)存储,具有极快的查找速度,其中key不能重复。 57 Python控制流 ⚫顺序结构 ⚫分支结构 ⚫循环结构 ⚫break、continue和pass ⚫列表生成式 58 Python函数 ⚫调用函数0 码力 | 80 页 | 5.38 MB | 1 年前3
共 20 条
- 1
- 2













