[](https://mermaid.live/edit#pako:eNqFk01vgzAMhv9KlFMrtQc49jAJrVRMKhz4UA-BQwReiwYJSoK2CvjvSwmdVlS2HFBiP69NHLvDOS8A7_BZ0OaC4n3KkF4Ria5SQY18kJKeIUPb7QvqnaYBViDFkVdKxcW1RydCTrRU6J0LlEgQP4rMRDqNyoQ8-IwrWQx6PPqrlf4gl51LBuu1EdwsN4lDHCk1S5mahXQWQ3qEeJQVFcx_0DOSfSkgVygE2XAmQV_swR1zXqFXWlWyR27XjceQtwrEMBjQnYE9ii0ynqxskbANYS8TgSGCiYgtg7hfkOvsPQqnJI91iO05Zj_FgjkWPMNCa_n5Y_9XA_zWynuBQ_sv9cQE_zN6M0KHpOsOvKr457Zt7tU_mGbSHTI921tEVlOMdfboSxne4BpETctCd353s6ZYXaCGFO_0tqDiI8UpGzRHW8WjK8vxTokWNrhtCqpgX1I9MPXdCEWpE
This file contains hidden or 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
import json | |
from typing import Any, Type | |
from pydantic import BaseModel | |
class FunctionSchemaForOpenAI(BaseModel): | |
name: str | |
description: str | |
func_schema: Type[BaseModel] |
This file contains hidden or 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
digraph G { | |
graph [fontname = "Handlee"]; | |
node [fontname = "Handlee"]; | |
edge [fontname = "Handlee"]; | |
bgcolor=transparent; | |
subgraph cluster_0 { | |
color=orange; | |
label="Usage" |
- Request access to one of the llama2 model repositories from Meta's HuggingFace organization, for example the
Llama-2-13b-chat-hf
. - Generate a HuggingFace read-only access token from your user profile settings page.
- Setup a Python 3.10 enviornment with the following dependencies installed:
transformers, huggingface_hub
. - Run the following code to download and load the model in HuggingFace
transformers
:
TOKEN = # copy-paste your HuggingFace access token here
### Option 1
This file contains hidden or 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
import pandas as pd | |
import openpyxl | |
def _get_link_if_exists(cell) -> str | None: | |
try: | |
return cell.hyperlink.target | |
except AttributeError: | |
return None |
This file contains hidden or 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
import numpy as np | |
import spacy | |
from spacy.language import Language | |
from typing import Callable | |
def get_most_similar_word(nlp: spacy.language.Language, word: str, metric: Callable[[np.array, np.array], float]) -> str: | |
# Get the vector of representation of the query word | |
vector = nlp.vocab.get_vector(word) | |
# Get the most similar vector by row index in the word vector matrix |