keras tutorial..................................................... 55 Keras v Functional API .................................................................................................. techniques to make high level neural network API easier and more performant. It supports the following features: Consistent, simple and extensible API. Minimal structure - easy to achieve the learning library used for numerical computational tasks developed by Google. Keras is a high level API built on top of TensorFlow or Theano. We know already how to install TensorFlow using pip. If it0 码力 | 98 页 | 1.57 MB | 1 年前3
AI大模型千问 qwen 中文文档下,我们将展示如何使用 vLLM 构建一个与 OpenAI API 兼容的 API 服务。 首先,确保你已经安装 vLLM>=0.3.0 : pip install vllm 运行以下代码以构建 vllm 服务。此处我们以 Qwen1.5-7B-Chat 为例: python -m vllm.entrypoints.openai.api_server --model Qwen/Qwen1.5-7B-Chat 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, b base_url=openai_api_base, ) chat_response = client.chat.completions.create( model="Qwen/Qwen1.5-7B-Chat", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content":0 码力 | 56 页 | 835.78 KB | 1 年前3
Keras: 基于 Python 的深度学习库LSTM 模型 . . . . . . . . . . . . 15 3.2 函数式 API 指引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.1 开始使用 Keras 函数式 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.2 Sequential 顺序模型 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.2.1 Sequential 顺序模型 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.3 函数式 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.3.1 Model 类 API . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 257 页 | 1.19 MB | 1 年前3
动手学深度学习 v2.03 提交主要更改 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764 16.6 d2l API 文档 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767 16.6 些情况下,我们通常会提供两个版本的示例:一个是我们从零开始实现一切,仅依赖张量操作和自动微分; 另一个是更实际的示例,我们使用深度学习框架的高级API编写简洁的代码。一旦我们教了您一些组件是如 何工作的,我们就可以在随后的教程中使用高级API了。 内容和结构 全书大致可分为三个部分,在 图1 中用不同的颜色呈现: 目录 3 图1: 全书结构 • 第一部分包括基础知识和预备知识。1节 到的文本,并将手写字符映 射到对应的已知字符之上。这种“哪一个”的问题叫做分类(classification)问题。分类问题希望模型能够预 测样本属于哪个类别(category,正式称为类(class))。例如,手写数字可能有10类,标签被设置为数字0~ 9。最简单的分类问题是只有两类,这被称之为二项分类(binomial classification)。例如,数据集可能由动 物图像组成,标签可能是{�0 码力 | 797 页 | 29.45 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 6 - Advanced Learning Techniques - Technical Reviewsoftware9 where GPT-3 is used for auto-completing code snippets with an IDE. End-users can also use GPT-3 API10 to build their own applications. Given the large number of possible uses for such models, the high Anthology, Nov. 2021, pp. 10644-52, doi:10.18653/v1/2021.emnlp-main.831. 10 OpenAI GPT-3 API https://openai.com/api/ 9 GitHub Copilot: https://github.com/features/copilot import tensorflow_datasets as authors report a top-1 accuracy of on ImageNet when fine-tuning with only 1% labels (13 labels per class). The SimCLR fine-tuned checkpoint with ResNet-50 as the encoder architecture also achieved a better0 码力 | 31 页 | 4.03 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112from torch import nn from torch.nn import functional as F from torch import optim class MyNetwork(nn.Module): def __init__(self): super(MyNetwork, self).__init__() Layer 实现一个网络层,需要传入网络层的输入节点数、输出节点数、激 活函数类型等参数,权值 weights 和偏置张量 bias 在初始化时根据输入、输出节点数自动 生成并初始化。代码如下: class Layer: # 全连接网络层 def __init__(self, n_input, n_neurons, activation=None, weights=None, 创建单层网络类后,我们实现网络模型的 NeuralNetwork 类,它内部维护各层的网络 层 Layer 类对象,可以通过 add_layer 函数追加网络层,实现创建不同结构的网络模型目 的。代码如下: class NeuralNetwork: # 神经网络模型大类 def __init__(self): self._layers = [] # 网络层对象列表0 码力 | 439 页 | 29.91 MB | 1 年前3
PyTorch Tutorial??????????? On Princeton CS server (ssh cycles.cs.princeton.edu) • Non-CS students can request a class account. • Miniconda is highly recommended, because: • It lets you manage your own Python installation Advantages (continued) • Which one do you think is better? PyTorch! • Easy Interface − easy to use API. The code execution in this framework is quite easy. Also need a fewer lines to code in comparison Cross Entropy …... Model • In PyTorch, a model is represented by a regular Python class that inherits from the Module class. • Two components • __init__(self): it defines the parts that make up the model0 码力 | 38 页 | 4.09 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquescompressed sizes of our regular model and its 50% sparse version. We used Tensorflow's save_model() API and zipped the model files using gzip. In addition to the usual models, the figure also shows compressed it can be classified into one of the 12 classes (each representing either a target word, with one class for ‘unknown’). The code for this project is available here as a Jupyter notebook. Train the baseline tensorflow_model_optimization as tfmot You can now invoke the model clustering using the cluster_weights API by providing the model to be clustered and two important parameters: (1) the number of clusters, and0 码力 | 34 页 | 3.18 MB | 1 年前3
深度学习与PyTorch入门实战 - 27. MLP网络层__init__ ▪ implement forward() Step1. Step2. Step3. nn.ReLU v.s. F.relu() ▪ class-style API ▪ function-style API Train 下一课时 激活函数与GPU Thank You.0 码力 | 13 页 | 992.88 KB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniquesexample is a 28x28 matrix containing values in the range [0, 255]. The task is to identify which digit class a given example belongs to. This problem can be solved with a simple deep learning model. In fact multi-class (In this case, classes are 0, 1, 2 and so on until 9) inputs. We use the sparse variant of the categorical cross entropy loss function so that we can use the index of the correct class for each each example. The regular function expects one-hot labels which would require us to transform the class label 2, for example, to its one-hot representation [0 0 1 0 0 0 0 0 0 0]. The optimizer is the standard0 码力 | 33 页 | 1.96 MB | 1 年前3
共 50 条
- 1
- 2
- 3
- 4
- 5













