《TensorFlow 快速入门与实战》7-实战TensorFlow人脸识别��������-� LFW.Labeled Face in the Wild/ LFW �t������i 6000 �����h�����vh�i 300 �u��300 ���� ���ha��c��d����t���LFW���s�d�����p� 2013�:�����������f�������l��+�c��� 2014�:����������c��� 2014��s��c��+��� ����[���]� x��S���r�y��������u��w�0�1�RT�����������H���������d�� �f���N��ko��e�g���0�1M�w��P�������������Ha�l�fs�I 0�1����A����-�E�����.9����� �2���2���2�����2�2�������A2�����E�A� �2B����2�����������������0 码力 | 81 页 | 12.64 MB | 1 年前3
动手学深度学习 v2.0Vishwesh Ravi Shrimali, YaYaB, Yuhong Chen, Evgeniy Smirnov, lgov, Simon Corston‐Oliver, Igor Dzreyev, Ha Nguyen, pmuens, Andrei Lukovenko, senorcinco, vfdev‐5, dsweet, Mohammad Mahdi Rahimi, Abhishek Gupta pool2d(X, pool_size, mode='max'): p_h, p_w = pool_size Y = torch.zeros((X.shape[0] - p_h + 1, X.shape[1] - p_w + 1)) for i in range(Y.shape[0]): for j in range(Y.shape[1]): if mode == 'max': Y[i, j] j] = X[i: i + p_h, j: j + p_w].max() elif mode == 'avg': Y[i, j] = X[i: i + p_h, j: j + p_w].mean() return Y 我们可以构建 图6.5.1中的输入张量X,验证二维最大汇聚层的输出。 X = torch.tensor([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [60 码力 | 797 页 | 29.45 MB | 1 年前3
微博在线机器学习和深度学习实践-黄波checkpoint Model Training System Model register Status set/get Model delete Model Save Model Load HA Fault tolerance checkpoint Local HDFS Param Server System Model Serving System 3 在线机器学习-参数服务器0 码力 | 36 页 | 16.69 MB | 1 年前3
Keras: 基于 Python 的深度学习库4.2.3 Sequential 模型方法 4.2.3.1 compile compile(self, optimizer, loss, metrics=None, sample_weight_mode=None, weighted_metrics=None, target_tensors=None) 用于配置训练模型。 参数 • optimizer: 字符串(优化器名)或者优化器对象。详见 {'output_a':'accuracy'}。 • sample_weight_mode: 如果你需要执行按时间步采样权重(2D 权重) ,请将其设置为 temporal。默认为 None,为采样权重(1D)。如果模型有多个输出,则可以通过传递 mode 的字典或列表,以在每个输出上使用不同的 sample_weight_mode。 • weighted_metrics: 在训练和测试期间,由 sample_weight Flow 后端时,这些参数被传递到 tf.Session.run。 异常 • ValueError: 如果 optimizer, loss, metrics 或 sample_weight_mode 这些参数不合法。 例 model = Sequential() model.add(Dense(32, input_shape=(500,))) model.add(Dense(10,0 码力 | 257 页 | 1.19 MB | 1 年前3
keras tutorialActivation, Dense from keras import initializers my_init = initializers.VarianceScaling(scale=1.0, mode='fan_in', distribution='normal', seed=None) model.add(Dense(512, activation='relu', input_shape=(784 input_shape=(784,), kernel_initializer=my_init)) where, scale represent the scaling factor mode represent any one of fan_in, fan_out and fan_avg values distribution represent either of normal or n represent, number of input units for mode = fan_in number of out units for mode = fan_out average number of input and output units for mode = fan_avg Similarly, it finds the limit for0 码力 | 98 页 | 1.57 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 1 - IntroductionInference Efficiency By inference, we mean when the model is deployed and is in the prediction mode. Hence, inference efficiency primarily deals with questions that someone deploying a model would ask offline applications of these models. As an example, the Google Translate application supports offline mode which improves the user experience in low or no-connectivity areas. This is made possible with an quantized models, we need the inference platform to support common neural net layers in quantized mode. TFLite supports quantized models, by allowing export of models with 8-bit unsigned int weights, and0 码力 | 21 页 | 3.17 MB | 1 年前3
Machine Learning Pytorch Tutorialcriterion(pred, y) loss.backward() optimizer.step() iterate n_epochs set model to train mode iterate through the dataloader set gradient to zero move data to device (cpu/cuda) forward pass += loss.cpu().item() * len(x) avg_loss = total_loss / len(dv_set.dataset) set model to evaluation mode iterate through the dataloader move data to device (cpu/cuda) disable gradient calculation forward torch.no_grad(): pred = model(x) preds.append(pred.cpu()) set model to evaluation mode iterate through the dataloader move data to device (cpu/cuda) disable gradient calculation forward0 码力 | 48 页 | 584.86 KB | 1 年前3
PyTorch Release Notesmodules are scripted in amp. Disable autocast in TorchScript by using `torch._C._jit_set_autocast_mode(False)` if you encounter this issue. PyTorch RN-08516-001_v23.07 | 120 Chapter 19. PyTorch Release heuristics, use export USE_HEURISTIC_MODE_B=1 in addition to export CUDNN_V8_API_ENABLED=1. Please refer to the cuDNN API docs for more information about this heuristic mode (https://docs.nvidia.com/deeplearning/cudnn/ heuristics, use `export USE_HEURISTIC_MODE_B=1` in addition to `export CUDNN_V8_API_ENABLED=1`. Please refer to the cuDNN API docs for more information about this heuristic mode (https://docs.nvidia.com/deeplearning/cudnn/api/0 码力 | 365 页 | 2.94 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112Out[20]: tensor(2., requires_grad=True) True 除了在创建时指定参数是否需要计算梯度,还可以随时改变张量的属性,调用张量的 requires_grad_(mode)函数即可,例如 w.requires_grad_(False)即可将待优化张量转变为普通 张量。 PyTorch 的自动梯度功能只允许对待优化张量进行梯度计算,例如: In [21]: range(0, 280, 28): # 10 列图片阵列 im = imgs[index] im = Image.fromarray(im, mode='L') new_im.paste(im, (i, j)) # 写入对应位置 index += 1 # 保存图片阵列 这些技巧仅能在一定程度上避免出现训练不稳定的现象,并没有从理论层面解释为什么会 出现训练困难、以及如果解决训练不稳定的问题。 (a) (b) 图 13.15 超参数敏感实例 [5] 13.6.2 模式崩塌 模式崩塌(Mode Collapse)是指模型生成的样本单一,多样性很差的现象。由于判别器 只能鉴别单个样本是否采样自真实分布,并没有对样本多样性进行显式约束,导致生成模 型可能倾向于生成真实分布的部分区间中的少量高质量样本,以此来在判别器中获得较高0 码力 | 439 页 | 29.91 MB | 1 年前3
AI大模型千问 qwen 中文文档TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True) # This will print the output in the streaming mode. generated_ids = model.generate( model_inputs, max_new_tokens=512, streamer=streamer, ) 除了使用 TextStreamer output_dir: str, bias="none" ): """Collects the state dict and dump to disk.""" # check if zero3 mode enabled if deepspeed.is_deepspeed_zero3_enabled(): state_dict = trainer.model_wrapped._zero3_cons __init__() self.tokenizer = tokenizer self.max_len = max_len rank0_print("Formatting inputs...Skip in lazy mode") self.tokenizer = tokenizer self.raw_data = raw_data self.cached_data_dict = {} def __len__(self):0 码力 | 56 页 | 835.78 KB | 1 年前3
共 16 条
- 1
- 2













