chunk_id stringlengths 30 59 | document_id stringlengths 24 24 | modality stringclasses 3
values | text stringlengths 1 5.37k ⌀ | asset_path stringlengths 44 112 ⌀ | asset_sha256 stringlengths 64 64 ⌀ | source_location stringlengths 17 883 | embedding_duplicate_of stringlengths 34 59 ⌀ | default_embedding_candidate bool 2
classes | warnings listlengths 0 2 | associated_text_chunk_ids listlengths 0 7 |
|---|---|---|---|---|---|---|---|---|---|---|
00121ed5ec4722c37808aa18-segment-000001-text-0001 | 00121ed5ec4722c37808aa18 | text | با ترانسفورمرها در HuggingFace کار کنید! برخی از اسکریپتهایی که آنها برای کار با مدلهای مختلف در سایتشان ارائه میدهند را امتحان کنید: https://huggingface.co/docs/transformers/run_scripts. یکی از دیتاستهای آنها را امتحان کنید، سپس یکی از دیتاستهای خودتان را از این دوره آموزشی یا از Kaggle وارد کنید و ببینید آیا م... | null | null | {"kind": "document"} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000001-text-0001 | 001290a424c857b4b4998e31 | text | Entrenar redes neuronales convolucionales (CNNs) puede llevar mucho tiempo y requiere una gran cantidad de datos. Sin embargo, gran parte del tiempo se dedica a aprender los mejores filtros de bajo nivel que una red utiliza para extraer patrones de las imágenes. Surge una pregunta natural: ¿podemos usar una red neurona... | null | null | {"kind": "cell", "cell": 1} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000002-text-0001 | 001290a424c857b4b4998e31 | text | ```python
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from torchinfo import summary
import numpy as np
import os
from pytorchcv import train, plot_results, display_dataset, train_long, check_image_dir
``` | null | null | {"kind": "cell", "cell": 2} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000003-text-0001 | 001290a424c857b4b4998e31 | text | En esta unidad, resolveremos un problema de la vida real clasificando imágenes de gatos y perros. Para ello, utilizaremos el [Conjunto de datos de Gatos vs. Perros de Kaggle](https://www.kaggle.com/c/dogs-vs-cats), que también se puede descargar [desde Microsoft](https://www.microsoft.com/en-us/download/details.aspx?id... | null | null | {"kind": "cell", "cell": 3} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000004-text-0001 | 001290a424c857b4b4998e31 | text | ```python
if not os.path.exists('data/kagglecatsanddogs_5340.zip'):
!wget -P data https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_5340.zip
``` | null | null | {"kind": "cell", "cell": 4} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000005-text-0001 | 001290a424c857b4b4998e31 | text | ```python
import zipfile
if not os.path.exists('data/PetImages'):
with zipfile.ZipFile('data/kagglecatsanddogs_5340.zip', 'r') as zip_ref:
zip_ref.extractall('data')
``` | null | null | {"kind": "cell", "cell": 5} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000006-text-0001 | 001290a424c857b4b4998e31 | text | Desafortunadamente, hay algunos archivos de imagen corruptos en el conjunto de datos. Necesitamos hacer una limpieza rápida para verificar los archivos corruptos. Para no saturar este tutorial, movimos el código para verificar el conjunto de datos a un módulo. | null | null | {"kind": "cell", "cell": 6} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000007-text-0001 | 001290a424c857b4b4998e31 | text | ```python
check_image_dir('data/PetImages/Cat/*.jpg')
check_image_dir('data/PetImages/Dog/*.jpg')
```
Corrupt image: data/PetImages/Cat/666.jpg
/anaconda/envs/py38_pytorch/lib/python3.8/site-packages/PIL/TiffImagePlugin.py:793: UserWarning: Truncated File Read
warnings.warn(str(msg))
Corrupt image: data/PetImages/... | null | null | {"kind": "cell", "cell": 7} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000008-text-0001 | 001290a424c857b4b4998e31 | text | A continuación, carguemos las imágenes en el conjunto de datos de PyTorch, convirtiéndolas en tensores y realizando algo de normalización. Aplicaremos la transformación `std_normalize` para llevar las imágenes al rango esperado por la red VGG preentrenada: | null | null | {"kind": "cell", "cell": 8} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000009-text-0001 | 001290a424c857b4b4998e31 | text | ```python
std_normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
trans = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
std_normalize])
dataset = torchvision.datasets.ImageFol... | null | null | {"kind": "cell", "cell": 9} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000010-text-0001 | 001290a424c857b4b4998e31 | text | Existen muchos modelos preentrenados disponibles dentro del módulo `torchvision`, y se pueden encontrar aún más modelos en Internet. Veamos cómo se puede cargar y utilizar el modelo VGG-16 más simple: | null | null | {"kind": "cell", "cell": 10} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000011-text-0001 | 001290a424c857b4b4998e31 | text | ```python
vgg = torchvision.models.vgg16(pretrained=True)
sample_image = dataset[0][0].unsqueeze(0)
res = vgg(sample_image)
print(res[0].argmax())
```
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /home/cathy/.cache/torch/hub/checkpoints/vgg16-397923af.pth
0%| | 0.00/528M [00:00<... | null | null | {"kind": "cell", "cell": 11} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000012-text-0001 | 001290a424c857b4b4998e31 | text | El resultado que hemos recibido es un número de una clase de `ImageNet`, que se puede consultar [aquí](https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a). Podemos usar el siguiente código para cargar automáticamente esta tabla de clases y devolver el resultado: | null | null | {"kind": "cell", "cell": 12} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000013-text-0001 | 001290a424c857b4b4998e31 | text | ```python
import json, requests
class_map = json.loads(requests.get("https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json").text)
class_map = { int(k) : v for k,v in class_map.items() }
class_map[res[0].argmax().item()]
```
['n02123159', 'tiger_cat'] | null | null | {"kind": "cell", "cell": 13} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000014-text-0001 | 001290a424c857b4b4998e31 | text | Veamos también la arquitectura de la red VGG-16: | null | null | {"kind": "cell", "cell": 14} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000015-text-0001 | 001290a424c857b4b4998e31 | text | ```python
summary(vgg,input_size=(1,3,224,224))
``` | null | null | {"kind": "cell", "cell": 15} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000015-text-0002 | 001290a424c857b4b4998e31 | text | ========================================================================================== Layer (type:depth-idx) Output Shape Param # ========================================================================================== VGG -- ... | null | null | {"kind": "cell", "cell": 15} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000015-text-0003 | 001290a424c857b4b4998e31 | text | │ └─ReLU: 2-28 [1, 512, 14, 14] -- │ └─Conv2d: 2-29 [1, 512, 14, 14] 2,359,808 │ └─ReLU: 2-30 [1, 512, 14, 14] -- │ └─MaxPool2d: 2-31 [1, 512, 7, 7] -- ├─AdaptiveAvgPool2d: 1-2 ... | null | null | {"kind": "cell", "cell": 15} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000016-text-0001 | 001290a424c857b4b4998e31 | text | Además de la capa que ya conocemos, existe otro tipo de capa llamada **Dropout**. Estas capas actúan como una técnica de **regularización**. La regularización realiza pequeñas modificaciones en el algoritmo de aprendizaje para que el modelo se generalice mejor. Durante el entrenamiento, las capas de dropout descartan u... | null | null | {"kind": "cell", "cell": 16} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000016-text-0002 | 001290a424c857b4b4998e31 | text | Las redes neuronales profundas, como VGG-16 y otras arquitecturas más modernas, requieren bastante potencia computacional para ejecutarse. Tiene sentido usar aceleración por GPU si está disponible. Para hacerlo, necesitamos mover explícitamente todos los tensores involucrados en el cálculo a la GPU.
Normalmente, esto ... | null | null | {"kind": "cell", "cell": 16} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000017-text-0001 | 001290a424c857b4b4998e31 | text | ```python
device = 'cuda' if torch.cuda.is_available() else 'cpu'
print('Doing computations on device = {}'.format(device))
vgg.to(device)
sample_image = sample_image.to(device)
vgg(sample_image).argmax()
```
Doing computations on device = cuda
tensor(282, device='cuda:0') | null | null | {"kind": "cell", "cell": 17} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000018-text-0001 | 001290a424c857b4b4998e31 | text | Si queremos usar VGG-16 para extraer características de nuestras imágenes, necesitamos el modelo sin las capas finales de clasificación. De hecho, este "extractor de características" se puede obtener utilizando el método `vgg.features`: | null | null | {"kind": "cell", "cell": 18} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000019-text-0001 | 001290a424c857b4b4998e31 | text | ```python
res = vgg.features(sample_image).cpu()
plt.figure(figsize=(15,3))
plt.imshow(res.detach().view(512,-1).T)
print(res.size())
```
torch.Size([1, 512, 7, 7])
<Figure size 1080x216 with 1 Axes> | null | null | {"kind": "cell", "cell": 19} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000020-text-0001 | 001290a424c857b4b4998e31 | text | La dimensión del tensor de características es 512x7x7, pero para poder visualizarlo tuvimos que remodelarlo a una forma 2D.
Ahora intentemos ver si esas características pueden usarse para clasificar imágenes. Tomemos manualmente una porción de imágenes (800 en nuestro caso) y precomputemos sus vectores de característi... | null | null | {"kind": "cell", "cell": 20} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000021-text-0001 | 001290a424c857b4b4998e31 | text | ```python
bs = 8
dl = torch.utils.data.DataLoader(dataset,batch_size=bs,shuffle=True)
num = bs*100
feature_tensor = torch.zeros(num,512*7*7).to(device)
label_tensor = torch.zeros(num).to(device)
i = 0
for x,l in dl:
with torch.no_grad():
f = vgg.features(x.to(device))
feature_tensor[i:i+bs] = f.view... | null | null | {"kind": "cell", "cell": 21} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000022-text-0001 | 001290a424c857b4b4998e31 | text | Ahora podemos definir `vgg_dataset` que toma datos de este tensor, los divide en conjuntos de entrenamiento y prueba utilizando la función `random_split`, y entrena una pequeña red clasificador densa de una capa sobre las características extraídas: | null | null | {"kind": "cell", "cell": 22} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000023-text-0001 | 001290a424c857b4b4998e31 | text | ```python
vgg_dataset = torch.utils.data.TensorDataset(feature_tensor,label_tensor.to(torch.long))
train_ds, test_ds = torch.utils.data.random_split(vgg_dataset,[700,100])
train_loader = torch.utils.data.DataLoader(train_ds,batch_size=32)
test_loader = torch.utils.data.DataLoader(test_ds,batch_size=32)
net = torch.nn... | null | null | {"kind": "cell", "cell": 23} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000024-text-0001 | 001290a424c857b4b4998e31 | text | ¡El resultado es excelente! ¡Podemos distinguir entre un gato y un perro con casi un 98% de probabilidad! Sin embargo, solo hemos probado este enfoque en un pequeño subconjunto de todas las imágenes, porque la extracción manual de características parece tomar mucho tiempo. | null | null | {"kind": "cell", "cell": 24} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000024-text-0002 | 001290a424c857b4b4998e31 | text | También podemos evitar precomputar manualmente las características utilizando la red VGG-16 original en su totalidad durante el entrenamiento. Veamos la estructura del objeto VGG-16: | null | null | {"kind": "cell", "cell": 24} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000025-text-0001 | 001290a424c857b4b4998e31 | text | ```python
print(vgg)
```
VGG(
(features): Sequential(
(0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU(inplace=True)
(2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(3): ReLU(inplace=True)
(4): MaxPool2d(kernel_size=2, stride=2, padding=0, dil... | null | null | {"kind": "cell", "cell": 25} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000026-text-0001 | 001290a424c857b4b4998e31 | text | Puedes ver que la red contiene:
* un extractor de características (`features`), compuesto por varias capas de convolución y de agrupamiento (pooling)
* una capa de agrupamiento promedio (`avgpool`)
* un `classifier` final, que consiste en varias capas densas, y convierte 25088 características de entrada en 1000 clases ... | null | null | {"kind": "cell", "cell": 26} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000027-text-0001 | 001290a424c857b4b4998e31 | text | ```python
vgg.classifier = torch.nn.Linear(25088,2).to(device)
for x in vgg.features.parameters():
x.requires_grad = False
summary(vgg,(1, 3,244,244))
``` | null | null | {"kind": "cell", "cell": 27} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000027-text-0002 | 001290a424c857b4b4998e31 | text | ========================================================================================== Layer (type:depth-idx) Output Shape Param # ========================================================================================== VGG -- ... | null | null | {"kind": "cell", "cell": 27} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000027-text-0003 | 001290a424c857b4b4998e31 | text | │ └─ReLU: 2-28 [1, 512, 15, 15] -- │ └─Conv2d: 2-29 [1, 512, 15, 15] (2,359,808) │ └─ReLU: 2-30 [1, 512, 15, 15] -- │ └─MaxPool2d: 2-31 [1, 512, 7, 7] -- ├─AdaptiveAvgPool2d: 1-2 ... | null | null | {"kind": "cell", "cell": 27} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000028-text-0001 | 001290a424c857b4b4998e31 | text | Como puedes ver en el resumen, este modelo contiene alrededor de 15 millones de parámetros en total, pero solo 50,000 de ellos son entrenables; esos son los pesos de la capa de clasificación. Esto es bueno, porque podemos ajustar un menor número de parámetros con un menor número de ejemplos.
Ahora entrenemos el modelo... | null | null | {"kind": "cell", "cell": 28} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000029-text-0001 | 001290a424c857b4b4998e31 | text | ```python
trainset, testset = torch.utils.data.random_split(dataset,[20000,len(dataset)-20000])
train_loader = torch.utils.data.DataLoader(trainset,batch_size=16)
test_loader = torch.utils.data.DataLoader(testset,batch_size=16)
train_long(vgg,train_loader,test_loader,loss_fn=torch.nn.CrossEntropyLoss(),epochs=1,print_... | null | null | {"kind": "cell", "cell": 29} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000030-text-0001 | 001290a424c857b4b4998e31 | text | ¡Parece que hemos obtenido un clasificador de gatos contra perros razonablemente preciso! ¡Guardémoslo para uso futuro! | null | null | {"kind": "cell", "cell": 30} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000031-text-0001 | 001290a424c857b4b4998e31 | text | ```python
torch.save(vgg,'data/cats_dogs.pth')
``` | null | null | {"kind": "cell", "cell": 31} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000032-text-0001 | 001290a424c857b4b4998e31 | text | Podemos cargar el modelo desde el archivo en cualquier momento. Puede ser útil en caso de que el próximo experimento destruya el modelo; no tendrías que empezar desde cero. | null | null | {"kind": "cell", "cell": 32} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000033-text-0001 | 001290a424c857b4b4998e31 | text | ```python
vgg = torch.load('data/cats_dogs.pth')
``` | null | null | {"kind": "cell", "cell": 33} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000034-text-0001 | 001290a424c857b4b4998e31 | text | En la sección anterior, entrenamos la capa final del clasificador para clasificar imágenes en nuestro propio conjunto de datos. Sin embargo, no volvimos a entrenar el extractor de características, y nuestro modelo se basó en las características que había aprendido con los datos de ImageNet. Si tus objetos se ven visual... | null | null | {"kind": "cell", "cell": 34} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000035-text-0001 | 001290a424c857b4b4998e31 | text | ```python
for x in vgg.features.parameters():
x.requires_grad = True
``` | null | null | {"kind": "cell", "cell": 35} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000036-text-0001 | 001290a424c857b4b4998e31 | text | Después de descongelar, podemos realizar algunos ciclos adicionales de entrenamiento. También puedes seleccionar una tasa de aprendizaje más baja para minimizar el impacto en los pesos preentrenados. Sin embargo, incluso con una tasa de aprendizaje baja, es probable que la precisión disminuya al inicio del entrenamient... | null | null | {"kind": "cell", "cell": 36} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000037-text-0001 | 001290a424c857b4b4998e31 | text | ```python
train_long(vgg,train_loader,test_loader,loss_fn=torch.nn.CrossEntropyLoss(),epochs=1,print_freq=90,lr=0.0001)
```
Epoch 0, minibatch 0: train acc = 1.0, train loss = 0.0
Epoch 0, minibatch 90: train acc = 0.8990384615384616, train loss = 0.2978392171335744
Epoch 0, minibatch 180: train acc = 0.90607734806629... | null | null | {"kind": "cell", "cell": 37} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000038-text-0001 | 001290a424c857b4b4998e31 | text | VGG-16 es una de las arquitecturas más simples de visión por computadora. El paquete `torchvision` ofrece muchas más redes preentrenadas. Las más utilizadas entre ellas son las arquitecturas **ResNet**, desarrolladas por Microsoft, y **Inception** de Google. Por ejemplo, exploremos la arquitectura del modelo más simple... | null | null | {"kind": "cell", "cell": 38} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000039-text-0001 | 001290a424c857b4b4998e31 | text | ```python
resnet = torchvision.models.resnet18()
print(resnet)
``` | null | null | {"kind": "cell", "cell": 39} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000039-text-0002 | 001290a424c857b4b4998e31 | text | ResNet( (conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False) (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) (maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False) (layer1): Sequen... | null | null | {"kind": "cell", "cell": 39} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000039-text-0003 | 001290a424c857b4b4998e31 | text | (conv1): Conv2d(128, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False) (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn... | null | null | {"kind": "cell", "cell": 39} | null | true | [
"long_section_split_review_context"
] | [] |
001290a424c857b4b4998e31-segment-000040-text-0001 | 001290a424c857b4b4998e31 | text | Como puedes ver, el modelo contiene los mismos bloques básicos: extractor de características y clasificador final (`fc`). Esto nos permite usar este modelo exactamente de la misma manera que hemos estado utilizando VGG-16 para aprendizaje por transferencia. Puedes intentar experimentar con el código anterior, utilizand... | null | null | {"kind": "cell", "cell": 40} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000040-text-0002 | 001290a424c857b4b4998e31 | text | Esta red contiene otro tipo de capa: **Normalización por Lotes**. La idea de la normalización por lotes es ajustar los valores que fluyen a través de la red neuronal al intervalo correcto. Por lo general, las redes neuronales funcionan mejor cuando todos los valores están en el rango de [-1,1] o [0,1], y por eso escala... | null | null | {"kind": "cell", "cell": 40} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000041-text-0001 | 001290a424c857b4b4998e31 | text | Utilizando aprendizaje por transferencia, pudimos crear rápidamente un clasificador para nuestra tarea de clasificación de objetos personalizados y lograr una alta precisión. Sin embargo, este ejemplo no fue completamente justo, ya que la red original VGG-16 fue preentrenada para reconocer gatos y perros, por lo que si... | null | null | {"kind": "cell", "cell": 41} | null | true | [] | [] |
001290a424c857b4b4998e31-segment-000042-text-0001 | 001290a424c857b4b4998e31 | text | ---
**Descargo de responsabilidad**:
Este documento ha sido traducido utilizando el servicio de traducción automática [Co-op Translator](https://github.com/Azure/co-op-translator). Si bien nos esforzamos por garantizar la precisión, tenga en cuenta que las traducciones automatizadas pueden contener errores o impreci... | null | null | {"kind": "cell", "cell": 42} | null | true | [] | [] |
001290a424c857b4b4998e31-embedded-12e4c11615f62c460d19508c | 001290a424c857b4b4998e31 | image | null | assets/12e4c11615f62c460d19508c489d2a199fcdac19b2a2877f60682b1b63b2036c.png | 12e4c11615f62c460d19508c489d2a199fcdac19b2a2877f60682b1b63b2036c | {"kind": "image", "cell": 9} | null | true | [] | [] |
001290a424c857b4b4998e31-embedded-e7404dd54364aabe08aca4c3 | 001290a424c857b4b4998e31 | image | null | assets/e7404dd54364aabe08aca4c39da50c339e05ea2ece635dfa748d06d62afad7ea.png | e7404dd54364aabe08aca4c39da50c339e05ea2ece635dfa748d06d62afad7ea | {"kind": "image", "cell": 19} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0001 | 001c239a01c4abc70e217300 | text | NLP ਖੇਤਰ ਵਿੱਚ ਸਭ ਤੋਂ ਮਹੱਤਵਪੂਰਨ ਸਮੱਸਿਆਵਾਂ ਵਿੱਚੋਂ ਇੱਕ ਹੈ **ਮਸ਼ੀਨ ਅਨੁਵਾਦ**, ਜੋ Google Translate ਵਰਗੇ ਟੂਲਾਂ ਦੇ ਅਧਾਰ ਵਿੱਚ ਇੱਕ ਜਰੂਰੀ ਕੰਮ ਹੈ। ਇਸ ਭਾਗ ਵਿੱਚ, ਅਸੀਂ ਮਸ਼ੀਨ ਅਨੁਵਾਦ 'ਤੇ ਧਿਆਨ ਦੇਵਾਂਗੇ, ਜਾਂ, ਵਧੇਰੇ ਆਮ ਤੌਰ 'ਤੇ, ਕਿਸੇ ਵੀ *ਸੀਕਵੈਂਸ-ਟੂ-ਸੀਕਵੈਂਸ* ਕੰਮ (ਜਿਸਨੂੰ **ਵਾਕ ਸੰਚਾਰ** ਵੀ ਕਿਹਾ ਜਾਂਦਾ ਹੈ) 'ਤੇ।
RNNs ਨਾਲ, ਸੀਕਵੈਂਸ-ਟੂ-ਸੀਕਵੈਂਸ ਦੋ ਰਿ... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0002 | 001c239a01c4abc70e217300 | text | Attention ਮਕੈਨਿਜ਼ਮ ਦੀ ਅਪਣਾਉਣੀ ਅਤੇ ਇਸ ਪਾਬੰਦੀ ਨੇ ਅੱਜ ਦੇ ਮੌਜੂਦਾ state-of-the-art ਟ੍ਰਾਂਸਫਾਰਮਰ ਮਾਡਲਾਂ ਦੀ ਰਚਨਾ ਲਈ ਰਾਹ ਹਮਵਾਰ ਕੀਤਾ, ਜਿਵੇਂ ਕਿ BERT ਤੋਂ Open-GPT3। | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0003 | 001c239a01c4abc70e217300 | text | ਟ੍ਰਾਂਸਫਾਰਮਰਾਂ ਦੇ ਪਿੱਛੇ ਇੱਕ ਮੁੱਖ ਵਿਚਾਰ ਇਹ ਹੈ ਕਿ RNNs ਦੀ ਕ੍ਰਮਵਾਰ ਪ੍ਰਕਿਰਿਆਵਧੀ ਨੂੰ ਟਾਲਿਆ ਜਾਵੇ ਅਤੇ ਇੱਕ ਮਾਡਲ ਬਣਾਇਆ ਜਾਵੇ ਜੋ ਟ੍ਰੇਨਿੰਗ ਦੌਰਾਨ ਪੈਰਾਲਲਾਈਜ਼ ਕੀਤਾ ਜਾ ਸਕੇ। ਇਹ ਦੋ ਵਿਚਾਰਾਂ ਨੂੰ ਲਾਗੂ ਕਰਕੇ ਹਾਸਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ:
* positional encoding
* RNNs (ਜਾਂ CNNs) ਦੀ ਬਜਾਏ ਪੈਟਰਨ ਨੂੰ ਕੈਪਚਰ ਕਰਨ ਲਈ self-attention ਮਕੈਨਿਜ਼ਮ ਦੀ ਵਰਤੋਂ (ਇਸ ਲਈ ਟ੍ਰਾ... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0004 | 001c239a01c4abc70e217300 | text | Positional encoding ਦਾ ਵਿਚਾਰ ਹੇਠਾਂ ਦਿੱਤਾ ਗਿਆ ਹੈ।
1. RNNs ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਸਮੇਂ, ਟੋਕਨ ਦਾ ਸਬੰਧਿਤ ਸਥਾਨ ਕਦਮਾਂ ਦੀ ਗਿਣਤੀ ਦੁਆਰਾ ਦਰਸਾਇਆ ਜਾਂਦਾ ਹੈ, ਅਤੇ ਇਸ ਲਈ ਇਸਨੂੰ ਸਪਸ਼ਟ ਤੌਰ 'ਤੇ ਦਰਸਾਉਣ ਦੀ ਲੋੜ ਨਹੀਂ ਹੁੰਦੀ।
2. ਹਾਲਾਂਕਿ, ਜਦੋਂ ਅਸੀਂ attention ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਾਂ, ਤਾਂ ਸਾਨੂੰ ਇੱਕ ਸੀਕਵੈਂਸ ਵਿੱਚ ਟੋਕਨ ਦੇ ਸਬੰਧਿਤ ਸਥਾਨਾਂ ਨੂੰ ਜਾਣਨ ਦੀ ਲੋੜ ਹੁੰਦੀ ਹੈ।... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0005 | 001c239a01c4abc70e217300 | text | ਅਗਲੇ, ਸਾਨੂੰ ਆਪਣੇ ਸੀਕਵੈਂਸ ਵਿੱਚ ਕੁਝ ਪੈਟਰਨ ਕੈਪਚਰ ਕਰਨ ਦੀ ਲੋੜ ਹੈ। ਇਹ ਕਰਨ ਲਈ, ਟ੍ਰਾਂਸਫਾਰਮਰ **self-attention** ਮਕੈਨਿਜ਼ਮ ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਨ, ਜੋ ਮੂਲ ਤੌਰ 'ਤੇ attention ਹੈ ਜੋ ਇਨਪੁਟ ਅਤੇ ਆਉਟਪੁੱਟ ਦੇ ਤੌਰ 'ਤੇ ਇੱਕੋ ਸੀਕਵੈਂਸ 'ਤੇ ਲਾਗੂ ਹੁੰਦੀ ਹੈ। Self-attention ਲਾਗੂ ਕਰਨ ਨਾਲ ਸਾਨੂੰ **context** ਨੂੰ ਵਾਕ ਵਿੱਚ ਧਿਆਨ ਵਿੱਚ ਲੈਣ ਦੀ ਆਗਿਆ ਮਿਲਦੀ ਹੈ, ਅਤੇ ਵੇਖ... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0006 | 001c239a01c4abc70e217300 | text | ਟ੍ਰਾਂਸਫਾਰਮਰਾਂ ਵਿੱਚ, attention ਦੋ ਸਥਾਨਾਂ 'ਤੇ ਵਰਤੀ ਜਾਂਦੀ ਹੈ:
* ਇਨਪੁਟ ਟੈਕਸਟ ਵਿੱਚ ਪੈਟਰਨ ਕੈਪਚਰ ਕਰਨ ਲਈ self-attention ਦੀ ਵਰਤੋਂ
* ਸੀਕਵੈਂਸ ਅਨੁਵਾਦ ਕਰਨ ਲਈ - ਇਹ attention layer ਹੈ ਜੋ ਐਨਕੋਡਰ ਅਤੇ ਡਿਕੋਡਰ ਦੇ ਵਿਚਕਾਰ ਹੈ।
Encoder-decoder attention RNNs ਵਿੱਚ ਵਰਤੇ attention ਮਕੈਨਿਜ਼ਮ ਦੇ ਬਹੁਤ ਹੀ ਸਮਾਨ ਹੈ, ਜਿਵੇਂ ਕਿ ਇਸ ਭਾਗ ਦੇ ਸ਼ੁਰੂ ਵਿੱਚ ... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0007 | 001c239a01c4abc70e217300 | text | **BERT** (Bidirectional Encoder Representations from Transformers) ਇੱਕ ਬਹੁਤ ਵੱਡਾ multi-layer ਟ੍ਰਾਂਸਫਾਰਮਰ ਨੈਟਵਰਕ ਹੈ ਜਿਸ ਵਿੱਚ *BERT-base* ਲਈ 12 ਲੇਅਰ ਹਨ, ਅਤੇ *BERT-large* ਲਈ 24। ਮਾਡਲ ਨੂੰ ਪਹਿਲਾਂ ਇੱਕ ਵੱਡੇ ਟੈਕਸਟ ਡਾਟਾ ਕੋਰਪਸ (WikiPedia + ਕਿਤਾਬਾਂ) 'ਤੇ unsupervised training (ਵਾਕ ਵਿੱਚ masked ਸ਼ਬਦਾਂ ਦੀ ਪੇਸ਼ਕਸ਼) ਦੀ ਵਰਤੋਂ ਕਰਕੇ pre-t... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0008 | 001c239a01c4abc70e217300 | text | ਹੇਠਾਂ ਦਿੱਤੇ ਨੋਟਬੁੱਕਾਂ ਵਿੱਚ ਆਪਣੀ ਸਿੱਖਿਆ ਜਾਰੀ ਰੱਖੋ:
* [Transformers in PyTorch](TransformersPyTorch.ipynb)
* [Transformers in TensorFlow](TransformersTF.ipynb) | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0009 | 001c239a01c4abc70e217300 | text | ਇਸ ਪਾਠ ਵਿੱਚ ਤੁਸੀਂ ਟ੍ਰਾਂਸਫਾਰਮਰ ਅਤੇ Attention ਮਕੈਨਿਜ਼ਮ ਬਾਰੇ ਸਿੱਖਿਆ, ਜੋ NLP ਟੂਲਬਾਕਸ ਵਿੱਚ ਜ਼ਰੂਰੀ ਸੰਦ ਹਨ। ਟ੍ਰਾਂਸਫਾਰਮਰ ਆਰਕੀਟੈਕਚਰਾਂ ਦੇ ਕਈ ਰੂਪ ਹਨ ਜਿਵੇਂ ਕਿ BERT, DistilBERT, BigBird, OpenGPT3 ਅਤੇ ਹੋਰ ਜੋ fine-tuned ਕੀਤੇ ਜਾ ਸਕਦੇ ਹਨ। [HuggingFace ਪੈਕੇਜ](https://github.com/huggingface/) PyTorch ਅਤੇ TensorFlow ਦੋਵਾਂ ਨਾਲ ਕਈ ਆਰਕੀਟੈਕਚਰ... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0010 | 001c239a01c4abc70e217300 | text | * [Blog post](https://mchromiak.github.io/articles/2017/Sep/12/Transformer-Attention-is-all-you-need/), explaining the classical [Attention is all you need](https://arxiv.org/abs/1706.03762) paper on transformers.
* [A series of blog posts](https://towardsdatascience.com/transformers-explained-visually-part-1-overview-... | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-segment-000001-text-0011 | 001c239a01c4abc70e217300 | text | --- | null | null | {"kind": "document"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-d3a99e32fba10d1ee89618fa | 001c239a01c4abc70e217300 | image | null | assets/d3a99e32fba10d1ee89618fa327690cfadc661a92dcacada73adbbe80c5abff3.gif | d3a99e32fba10d1ee89618fa327690cfadc661a92dcacada73adbbe80c5abff3 | {"kind": "image", "reference": "../../../../../lessons/5-NLP/18-Transformers/images/EncDecAttention.gif", "source_path": "microsoft_ai_for_beginners/lessons/5-NLP/18-Transformers/images/EncDecAttention.gif"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-4d8879f4b5810d97df312ac5 | 001c239a01c4abc70e217300 | image | null | assets/4d8879f4b5810d97df312ac595df273fe34d2798d05686d799b6b8c61b115229.gif | 4d8879f4b5810d97df312ac595df273fe34d2798d05686d799b6b8c61b115229 | {"kind": "image", "reference": "../../../../../lessons/5-NLP/18-Transformers/images/transformer-animated-explanation.gif", "source_path": "microsoft_ai_for_beginners/lessons/5-NLP/18-Transformers/images/transformer-animated-explanation.gif"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-2764d0532efca67a09e1dc72 | 001c239a01c4abc70e217300 | image | null | assets/2764d0532efca67a09e1dc722ff211ec46d1d605172086c86f7fea68f312e9a3.webp | 2764d0532efca67a09e1dc722ff211ec46d1d605172086c86f7fea68f312e9a3 | {"kind": "image", "reference": "../../../../../translated_images/pa/CoreferenceResolution.861924d6d384a7d6.webp", "source_path": "microsoft_ai_for_beginners/translated_images/pa/CoreferenceResolution.861924d6d384a7d6.webp"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-d9042260f3c1f5470d1a7099 | 001c239a01c4abc70e217300 | image | null | assets/d9042260f3c1f5470d1a709925362d4a0bb9a7d02b912f2ccbf010031c55a913.webp | d9042260f3c1f5470d1a709925362d4a0bb9a7d02b912f2ccbf010031c55a913 | {"kind": "image", "reference": "../../../../../translated_images/pa/bahdanau-fig3.09ba2d37f202a6af.webp", "source_path": "microsoft_ai_for_beginners/translated_images/pa/bahdanau-fig3.09ba2d37f202a6af.webp"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-6cdc6942713fdf7cdfe1ee3d | 001c239a01c4abc70e217300 | image | null | assets/6cdc6942713fdf7cdfe1ee3d7ed19dead8bdbd791f2d88edc3a094fdc1bfa60b.webp | 6cdc6942713fdf7cdfe1ee3d7ed19dead8bdbd791f2d88edc3a094fdc1bfa60b | {"kind": "image", "reference": "../../../../../translated_images/pa/encoder-decoder-attention.7a726296894fb567.webp", "source_path": "microsoft_ai_for_beginners/translated_images/pa/encoder-decoder-attention.7a726296894fb567.webp"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-37d215348a12d8e4e74d8252 | 001c239a01c4abc70e217300 | image | null | assets/37d215348a12d8e4e74d8252d6363112aeefc19a5cfc707478a609773994f358.webp | 37d215348a12d8e4e74d8252d6363112aeefc19a5cfc707478a609773994f358 | {"kind": "image", "reference": "../../../../../translated_images/pa/jalammarBERT-language-modeling-masked-lm.34f113ea5fec4362.webp", "source_path": "microsoft_ai_for_beginners/translated_images/pa/jalammarBERT-language-modeling-masked-lm.34f113ea5fec4362.webp"} | null | true | [] | [] |
001c239a01c4abc70e217300-embedded-fd559f29e941f382c066df61 | 001c239a01c4abc70e217300 | image | null | assets/fd559f29e941f382c066df6114b59e7a69ae7f22fa9be176a322e89050058666.webp | fd559f29e941f382c066df6114b59e7a69ae7f22fa9be176a322e89050058666 | {"kind": "image", "reference": "../../../../../translated_images/pa/pos-embedding.e41ce9b6cf6078af.webp", "source_path": "microsoft_ai_for_beginners/translated_images/pa/pos-embedding.e41ce9b6cf6078af.webp"} | null | true | [] | [] |
002607d3958b886cd2f49110-text-0-0001 | 002607d3958b886cd2f49110 | text | **Design Challenge Scenarios** | null | null | {"kind": "heading", "heading_path": []} | null | true | [] | [] |
002607d3958b886cd2f49110-text-0-0002 | 002607d3958b886cd2f49110 | text | | **SCHOOL** **THE SCENARIO: Parent on the phone** Someone calls the school office and says they are a student’s parent. They know the student’s full name, grade, teacher, and date of birth. They say they need a copy of the student’s records emailed to them today for enrollment at a new school. **THE TENSION: Record... | null | null | {"kind": "heading", "heading_path": []} | null | true | [
"long_section_split_review_context"
] | [] |
002607d3958b886cd2f49110-page-0001 | 002607d3958b886cd2f49110 | image | null | documents/002607d3958b886cd2f49110/pages/0001.jpg | 735c8f7f3f398a55ef62b0a3f5cbf6569b5400194dfb08fd249fe932a551b5ab | {"kind": "rendered_page", "page": 1} | null | false | [
"cross_page_context_not_merged"
] | [] |
0027bbf858e6b352721c8212-segment-000001-text-0001 | 0027bbf858e6b352721c8212 | text | > **Note:** The original [Microsoft Concept Graph](https://concept.research.microsoft.com/) API is no longer available. This notebook has been updated to use [ConceptNet](https://conceptnet.io/) as a replacement, which is a freely available open knowledge graph with similar `is-a` relations between concepts.
[ConceptN... | null | null | {"kind": "cell", "cell": 1} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000002-text-0001 | 0027bbf858e6b352721c8212 | text | [ConceptNet](https://conceptnet.io/) provides a REST API to explore `is-a` (IsA) relationships between concepts. No API key is required.
Here is the sample URL to call: `https://api.conceptnet.io/query?start=/c/en/microsoft&rel=/r/IsA&limit=10` | null | null | {"kind": "cell", "cell": 2} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000003-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
import urllib
import json
def http(x):
response = urllib.request.urlopen(x)
data = response.read()
return data.decode('utf-8')
def query(x):
concept = x.lower().replace(' ', '_')
url = "https://api.conceptnet.io/query?start=/c/en/{}&rel=/r/IsA&limit=10".format(
urllib.parse.quote... | null | null | {"kind": "cell", "cell": 3} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000004-text-0001 | 0027bbf858e6b352721c8212 | text | Let's try to categorize the news titles using parent concepts. To get news titles, we will use [NewsApi.org](http://newsapi.org) service. You need to obtain your own API key in order to use the service - go to the web site and register for free developer plan. | null | null | {"kind": "cell", "cell": 4} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000005-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
newsapi_key = '<your API key here>'
def get_news(country='us'):
res = json.loads(http("https://newsapi.org/v2/top-headlines?country={0}&apiKey={1}".format(country,newsapi_key)))
return res['articles']
all_titles = [x['title'] for x in get_news('us')+get_news('gb')]
``` | null | null | {"kind": "cell", "cell": 5} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000006-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
all_titles
```
['Covid-19 Live Updates: Vaccines and Boosters News - The New York Times', 'Ukrainians Flee Mariupol as Russian Forces Push to Take Port City - The Wall Street Journal', 'Bond Yields Jump, Stock Futures Rise After Powell Says Fed Is Ready to Be More Aggressive - The Wall Street Journal', 'P... | null | null | {"kind": "cell", "cell": 6} | null | true | [
"long_section_split_review_context"
] | [] |
0027bbf858e6b352721c8212-segment-000006-text-0002 | 0027bbf858e6b352721c8212 | text | "Friends beg Vladimir Putin's 'lover' to persuade him to end Ukraine invasion - The Mirror", 'Brass Eye’s outtakes show the brutal TV comedy was the tip of an iceberg - The Guardian', "Vladimir Putin threatens civilians to break Mariupol's spirit - The Times", 'Shell U-turn on Cambo oilfield would threaten green tar... | null | null | {"kind": "cell", "cell": 6} | null | true | [
"long_section_split_review_context"
] | [] |
0027bbf858e6b352721c8212-segment-000007-text-0001 | 0027bbf858e6b352721c8212 | text | First of all, we want to be able to extract nouns from news titles. We will use `TextBlob` library to do this, which simplifies a lot of typical NLP tasks like this. | null | null | {"kind": "cell", "cell": 7} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000008-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
import sys
!{sys.executable} -m pip install textblob
!{sys.executable} -m textblob.download_corpora
from textblob import TextBlob
```
Requirement already satisfied: textblob in c:\winapp\miniconda3\lib\site-packages (0.17.1)
Requirement already satisfied: nltk>=3.1 in c:\winapp\miniconda3\lib\site-packages (... | null | null | {"kind": "cell", "cell": 8} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000009-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
w = {}
for x in all_titles:
for n in TextBlob(x).noun_phrases:
if n in w:
w[n].append(x)
else:
w[n]=[x]
{ x:len(w[x]) for x in w.keys()}
``` | null | null | {"kind": "cell", "cell": 9} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000009-text-0002 | 0027bbf858e6b352721c8212 | text | {'covid-19 live updates': 1, 'vaccines': 1, 'boosters': 1, 'york': 4, 'ukrainians flee mariupol': 1, 'forces push': 1, 'port city': 1, 'wall street journal': 3, 'bond yields': 1, 'futures rise': 1, 'powell says fed': 1, 'ready': 1, 'be': 1, 'aggressive': 1, 'putin': 3, 'alexei navalny': 2, 'russian': 2,... | null | null | {"kind": "cell", "cell": 9} | null | true | [
"long_section_split_review_context"
] | [] |
0027bbf858e6b352721c8212-segment-000009-text-0003 | 0027bbf858e6b352721c8212 | text | 'live erik': 1, 'hag': 1, 'utd': 1, 'manager updates': 1, 'manchester evening': 1, 'inflation': 1, 'government borrowing': 1, 'february': 1, 'crude oil': 1, '– business': 1, 'kremlin': 1, 'large-scale fraud': 1, 'sky': 1, 'natural gas': 1, 'gazprom': 1, 'retail unit': 1, 'insider': 1, 'zaghari-ratcliff... | null | null | {"kind": "cell", "cell": 9} | null | true | [
"long_section_split_review_context"
] | [] |
0027bbf858e6b352721c8212-segment-000010-text-0001 | 0027bbf858e6b352721c8212 | text | We can see that nouns do not give us large thematic groups. Let's substitute nouns by more general terms obtained from the concept graph. This will take some time, because we are doing REST call for each noun phrase. | null | null | {"kind": "cell", "cell": 10} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000011-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
w = {}
for x in all_titles:
for noun in TextBlob(x).noun_phrases:
terms = query(noun)
for term in [u for u in terms.keys() if terms[u]>0.1]:
if term in w:
w[term].append(x)
else:
w[term]=[x]
``` | null | null | {"kind": "cell", "cell": 11} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000012-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
{ x:len(w[x]) for x in w.keys() if len(w[x])>3}
```
{'city': 9,
'brand': 4,
'place': 9,
'town': 4,
'factor': 4,
'film': 4,
'nation': 11,
'state': 5,
'person': 4,
'organization': 5,
'publication': 10,
'market': 5,
'economy': 4,
'company': 6,
'newspaper': 6,
'relationship': 6} | null | null | {"kind": "cell", "cell": 12} | null | true | [] | [] |
0027bbf858e6b352721c8212-segment-000013-text-0001 | 0027bbf858e6b352721c8212 | text | ```python
print('\nECONOMY:\n'+'\n'.join(w['economy']))
print('\nNATION:\n'+'\n'.join(w['nation']))
print('\nPERSON:\n'+'\n'.join(w['person']))
```
ECONOMY:
China searches for victims, flight recorders after first plane crash in 12 years - Reuters
Live updates: Russia stops talks with Japan over sanctions - The Associ... | null | null | {"kind": "cell", "cell": 13} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0001 | 003b4246732e6061d3de65f0 | text | > Sketchnote oleh [Tomomi Imura](https://twitter.com/girlie_mac)
Pencarian kecerdasan buatan didasarkan pada pencarian pengetahuan, untuk memahami dunia serupa dengan bagaimana manusia melakukannya. Tetapi bagaimana Anda bisa melakukannya? | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0002 | 003b4246732e6061d3de65f0 | text | Pada masa awal AI, pendekatan top-down untuk membuat sistem cerdas (dibahas pada pelajaran sebelumnya) sangat populer. Idenya adalah mengekstrak pengetahuan dari manusia ke dalam bentuk yang dapat dibaca mesin, dan kemudian menggunakannya untuk menyelesaikan masalah secara otomatis. Pendekatan ini didasarkan pada dua i... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0003 | 003b4246732e6061d3de65f0 | text | Salah satu konsep penting dalam AI Simbolik adalah **pengetahuan**. Penting untuk membedakan pengetahuan dari *informasi* atau *data*. Misalnya, seseorang bisa mengatakan bahwa buku berisi pengetahuan, karena seseorang bisa mempelajari buku dan menjadi seorang ahli. Namun, yang sebenarnya terkandung dalam buku disebut ... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0004 | 003b4246732e6061d3de65f0 | text | * Di sisi kiri, terdapat jenis representasi pengetahuan yang sangat sederhana yang dapat digunakan secara efektif oleh komputer. Yang paling sederhana adalah algoritmik, ketika pengetahuan direpresentasikan oleh program komputer. Namun, ini bukan cara terbaik untuk merepresentasikan pengetahuan, karena tidak fleksibel.... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0005 | 003b4246732e6061d3de65f0 | text | Kita dapat mengklasifikasikan metode representasi pengetahuan komputer ke dalam kategori berikut:
* **Representasi jaringan** didasarkan pada fakta bahwa kita memiliki jaringan konsep yang saling terkait di kepala kita. Kita dapat mencoba mereproduksi jaringan yang sama sebagai graf di dalam komputer—yang disebut **ja... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0006 | 003b4246732e6061d3de65f0 | text | 3. **Representasi prosedural** didasarkan pada merepresentasikan pengetahuan dengan daftar aksi yang dapat dijalankan ketika kondisi tertentu terjadi.
- Aturan produksi adalah pernyataan jika-maka yang memungkinkan kita menarik kesimpulan. Misalnya, seorang dokter dapat memiliki aturan yang mengatakan bahwa **JIKA... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0007 | 003b4246732e6061d3de65f0 | text | Salah satu keberhasilan awal AI simbolik adalah yang disebut **sistem pakar**—sistem komputer yang dirancang untuk bertindak sebagai ahli dalam domain masalah terbatas. Sistem ini didasarkan pada **basis pengetahuan** yang diambil dari satu atau lebih ahli manusia, dan mereka memiliki **mesin inferensi** yang melakukan... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0008 | 003b4246732e6061d3de65f0 | text | Anda dapat melihat bahwa setiap kondisi di sisi kiri aturan dan aksi merupakan triplet objek-atribut-nilai (OAV). **Memori kerja** berisi set triplet OAV yang sesuai dengan masalah yang sedang diselesaikan. **Mesin aturan** mencari aturan yang kondisinya terpenuhi dan menerapkannya, menambahkan triplet lain ke memori k... | null | null | {"kind": "document"} | null | true | [] | [] |
003b4246732e6061d3de65f0-segment-000001-text-0009 | 003b4246732e6061d3de65f0 | text | Proses yang dijelaskan di atas disebut **inferensi maju**. Ini dimulai dengan beberapa data awal tentang masalah yang tersedia di memori kerja, dan kemudian mengeksekusi loop penalaran berikut:
1. Jika atribut target ada di memori kerja—berhenti dan berikan hasilnya
2. Cari semua aturan yang kondisinya saat ini terp... | null | null | {"kind": "document"} | null | true | [] | [] |
知芽教学知识库
这是一个面向教学问答的多模态知识库数据集,包含教材、编程与人工智能教学资料,以及资料中的文字、图片和少量视频。除了原始资料,还提供整理后的文本片段和已经生成的检索向量(Embedding)。
它用于开源项目 知芽 Zhiya。知芽是面向小学至高中学生的个性化 AI 学习搭子,帮助学生学习编程和人工智能。
这个知识库让知芽在回答问题、组织教学内容时,先查找相关资料,再根据资料讲解,并在对话中给出来源引用。开发者可以下载完整知识库,接入自己的知芽部署,无需重新计算这些资料的向量。
有哪些资料?
资料来自 Day of AI、Microsoft AI for Beginners、AI4K12、Datawhale 和 K12 textbook,共整理出 7,434 份文档。内容包括教材、课程讲义、幻灯片、编程示例和教学图片。
| 内容 | 位置 |
|---|---|
| 原始资料、提取后的文字、图片、视频及来源信息 | knowledge/ |
| 已生成的 99,630 条文本检索向量 | embeddings/qwen3-text-8b/ |
| 已生成的 6,415 条视觉检索向量,对应 6,413 张图片和 2 个视频 | embeddings/qwen3-vl-8b-visual/ |
| 文件校验信息和模型配置 | manifest.json |
接入知芽
先获取知芽代码,安装 hf、uv 和 Go,启动 PostgreSQL 和 RustFS,并配置知识库的数据库与对象存储。具体配置见开发文档。然后在代码仓库根目录执行:
bash scripts/import-knowledge.sh
脚本会先显示下载来源、本地保存目录,以及将要写入的数据库和对象存储桶。输入 IMPORT 确认后,才会下载约 12 GB 的数据、校验文件、上传资料并导入向量。 请为下载和缓存预留磁盘空间。
如果由 Agent 执行,也需要先获得你的批准,再使用 --yes。如果已经下载了数据,可以使用 --data-dir /path/to/data --skip-download。
只下载或读取数据
hf download LanternCX/zhiya-knowledge --type dataset --local-dir data
只读取整理后的文字或向量,可以使用 Python:
from datasets import load_dataset
chunks = load_dataset("LanternCX/zhiya-knowledge", "chunks", split="train")
text_vectors = load_dataset("LanternCX/zhiya-knowledge", "text_embeddings", split="train")
visual_vectors = load_dataset("LanternCX/zhiya-knowledge", "visual_embeddings", split="train")
图片、视频和原始文件需要下载完整目录。train 是这里的读取集合名称;本数据集主要用于知识检索,没有划分训练集和测试集。
向量使用说明
文本向量使用 Qwen/Qwen3-Embedding-8B,视觉向量使用 Qwen/Qwen3-VL-Embedding-8B,均为 4096 维。检索时,查询需要用对应模型编码:文本与视觉分别检索,再合并结果,不能把两种模型的向量混在同一个索引中直接比较。
下载或导入时,可用 --revision <Hugging-Face-commit> 固定数据版本。
使用前请留意
第三方资料的许可见各自原文件和来源信息,使用或再发布前请核对。知芽代码的 AGPL-3.0 许可证不自动适用于这些资料。
这个数据集不包含用户聊天记录、业务数据库、API Key 或模型权重。
- Downloads last month
- 1,453