A Pen by Shubhanshu Mishra on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
from scipy import sparse | |
from joblib import dump, load | |
import joblib | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir food.com | |
cd food.com | |
wget https://www.food.com/sitemap.xml | |
for url in $(cat sitemap.xml | grep "<loc>https://www.food.com/sitemap-" | sed -n 's:.*<loc>\(.*\)</loc>.*:\1:p'); | |
do echo "Download: $url"; | |
done | |
for url in $(cat sitemap.xml | grep "<loc>https://www.food.com/sitemap-" | sed -n 's:.*<loc>\(.*\)</loc>.*:\1:p'); | |
do wget "$url"; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import torch | |
from transformers import CLIPProcessor, CLIPTextModelWithProjection | |
from accelerate import Accelerator | |
from datasets import Dataset | |
import pandas as pd | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
pip install pypdf | |
""" | |
from pypdf import PdfWriter | |
def main(args): | |
merger = PdfWriter() | |
file_paths = args.input_files | |
for pdf in file_paths: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sentence_transformers/SentenceTransformer.py b/sentence_transformers/SentenceTransformer.py | |
index e44e573..ae4dea4 100644 | |
--- a/sentence_transformers/SentenceTransformer.py | |
+++ b/sentence_transformers/SentenceTransformer.py | |
@@ -16,6 +16,7 @@ from torch.optim import Optimizer | |
from torch.utils.data import DataLoader | |
import torch.multiprocessing as mp | |
from tqdm.autonotebook import trange | |
+from tqdm.autonotebook import tqdm | |
import math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Spacy Embedding Transformer for Sklearn pipeline | |
Install spacy and floret | |
```bash | |
pip install spacy floret scikit-learn | |
``` | |
First download the vectors from: | |
```bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/torchbiggraph/converters/importers.py b/torchbiggraph/converters/importers.py | |
index fa84bc6..765e9fa 100644 | |
--- a/torchbiggraph/converters/importers.py | |
+++ b/torchbiggraph/converters/importers.py | |
@@ -28,6 +28,7 @@ from torchbiggraph.graph_storages import ( | |
RELATION_TYPE_STORAGES, | |
) | |
from torchbiggraph.types import UNPARTITIONED | |
+from tqdm import tqdm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ! pip install celluloid | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from celluloid import Camera | |
def plot_mat(A, evals=None, evecs=None, fig=None, ax=None): | |
if ax is None: | |
fig, ax = plt.subplots(1, 2, figsize=(8, 4)) | |
A = A / np.linalg.norm(A, axis=0, keepdims=True) | |
ax[0].imshow(A) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zipfile import ZipFile | |
from pathlib import Path | |
import pandas as pd | |
import numpy as np | |
import json | |
JOB_FILES = list(Path(".").glob("**/job_*.json.zip")) | |
JOB_ID_TO_OUTPUT_PART = { | |
1873084: 12, |