In [1]:
!pip install git+https://github.com/INF800/genaudit # restart session if any errors
Collecting git+https://github.com/INF800/genaudit
  Cloning https://github.com/INF800/genaudit to /tmp/pip-req-build-hqu6fmqy
  Running command git clone --filter=blob:none --quiet https://github.com/INF800/genaudit /tmp/pip-req-build-hqu6fmqy
  Resolved https://github.com/INF800/genaudit to commit 0325629c27b4c7bd14fa8699015b371ea6536bc9
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: accelerate in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.28.0)
Requirement already satisfied: bitsandbytes>=0.39.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.43.0)
Requirement already satisfied: bottle==0.12.23 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.12.23)
Requirement already satisfied: einops>=0.6.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.7.0)
Requirement already satisfied: jsonlines in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (4.0.0)
Requirement already satisfied: nltk in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (3.8.1)
Requirement already satisfied: openai in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (1.14.2)
Requirement already satisfied: paste in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (3.8.0)
Requirement already satisfied: peft>=0.4.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.10.0)
Requirement already satisfied: sentencepiece in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.2.0)
Requirement already satisfied: spacy in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (3.7.4)
Requirement already satisfied: tenacity in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (8.2.3)
Requirement already satisfied: tiktoken in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (0.6.0)
Requirement already satisfied: transformers>=4.34.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from genaudit==0.1) (4.39.0)
Requirement already satisfied: numpy>=1.17 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (1.22.4)
Requirement already satisfied: packaging>=20.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (21.3)
Requirement already satisfied: psutil in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (5.9.8)
Requirement already satisfied: pyyaml in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (6.0.1)
Requirement already satisfied: torch>=1.10.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (2.2.1)
Requirement already satisfied: huggingface-hub in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (0.21.4)
Requirement already satisfied: safetensors>=0.3.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from accelerate->genaudit==0.1) (0.4.2)
Requirement already satisfied: tqdm in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from peft>=0.4.1->genaudit==0.1) (4.66.1)
Requirement already satisfied: filelock in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from transformers>=4.34.0->genaudit==0.1) (3.13.1)
Requirement already satisfied: regex!=2019.12.17 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from transformers>=4.34.0->genaudit==0.1) (2023.12.25)
Requirement already satisfied: requests in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from transformers>=4.34.0->genaudit==0.1) (2.31.0)
Requirement already satisfied: tokenizers<0.19,>=0.14 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from transformers>=4.34.0->genaudit==0.1) (0.15.2)
Requirement already satisfied: attrs>=19.2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from jsonlines->genaudit==0.1) (23.2.0)
Requirement already satisfied: click in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from nltk->genaudit==0.1) (8.1.7)
Requirement already satisfied: joblib in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from nltk->genaudit==0.1) (1.3.2)
Requirement already satisfied: anyio<5,>=3.5.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (4.2.0)
Requirement already satisfied: distro<2,>=1.7.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (1.9.0)
Requirement already satisfied: httpx<1,>=0.23.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (0.27.0)
Requirement already satisfied: pydantic<3,>=1.9.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (2.6.4)
Requirement already satisfied: sniffio in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (1.3.0)
Requirement already satisfied: typing-extensions<5,>=4.7 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from openai->genaudit==0.1) (4.9.0)
Requirement already satisfied: setuptools in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from paste->genaudit==0.1) (69.0.3)
Requirement already satisfied: six>=1.4.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from paste->genaudit==0.1) (1.16.0)
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (3.0.12)
Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (1.0.5)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (1.0.10)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (2.0.8)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (3.0.9)
Requirement already satisfied: thinc<8.3.0,>=8.2.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (8.2.3)
Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (1.1.2)
Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (2.4.8)
Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (2.0.10)
Requirement already satisfied: weasel<0.4.0,>=0.1.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (0.3.4)
Requirement already satisfied: typer<0.10.0,>=0.3.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (0.9.0)
Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (6.4.0)
Requirement already satisfied: jinja2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (3.1.3)
Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy->genaudit==0.1) (3.3.0)
Requirement already satisfied: idna>=2.8 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai->genaudit==0.1) (3.6)
Requirement already satisfied: exceptiongroup>=1.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai->genaudit==0.1) (1.2.0)
Requirement already satisfied: certifi in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai->genaudit==0.1) (2024.2.2)
Requirement already satisfied: httpcore==1.* in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai->genaudit==0.1) (1.0.4)
Requirement already satisfied: h11<0.15,>=0.13 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai->genaudit==0.1) (0.14.0)
Requirement already satisfied: fsspec>=2023.5.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from huggingface-hub->accelerate->genaudit==0.1) (2023.12.2)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from packaging>=20.0->accelerate->genaudit==0.1) (3.1.1)
Requirement already satisfied: annotated-types>=0.4.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai->genaudit==0.1) (0.6.0)
Requirement already satisfied: pydantic-core==2.16.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai->genaudit==0.1) (2.16.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests->transformers>=4.34.0->genaudit==0.1) (3.3.2)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests->transformers>=4.34.0->genaudit==0.1) (1.26.18)
Requirement already satisfied: blis<0.8.0,>=0.7.8 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from thinc<8.3.0,>=8.2.2->spacy->genaudit==0.1) (0.7.11)
Requirement already satisfied: confection<1.0.0,>=0.0.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from thinc<8.3.0,>=8.2.2->spacy->genaudit==0.1) (0.1.4)
Requirement already satisfied: sympy in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (1.12)
Requirement already satisfied: networkx in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (3.2.1)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.105)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.105)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (8.9.2.26)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.3.1)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (11.0.2.54)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (10.3.2.106)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (11.4.5.107)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.0.106)
Requirement already satisfied: nvidia-nccl-cu12==2.19.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (2.19.3)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (12.1.105)
Requirement already satisfied: triton==2.2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from torch>=1.10.0->accelerate->genaudit==0.1) (2.2.0)
Requirement already satisfied: nvidia-nvjitlink-cu12 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch>=1.10.0->accelerate->genaudit==0.1) (12.4.99)
Requirement already satisfied: cloudpathlib<0.17.0,>=0.7.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from weasel<0.4.0,>=0.1.0->spacy->genaudit==0.1) (0.16.0)
Requirement already satisfied: MarkupSafe>=2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from jinja2->spacy->genaudit==0.1) (2.1.4)
Requirement already satisfied: mpmath>=0.19 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from sympy->torch>=1.10.0->accelerate->genaudit==0.1) (1.3.0)
In [2]:
from genaudit import FactChecker
fc = FactChecker("hf:kundank/genaudit-usb-flanul2", distributed=True)
adapter_config.json:   0%|          | 0.00/406 [00:00<?, ?B/s]
tokenizer_config.json:   0%|          | 0.00/2.35k [00:00<?, ?B/s]
spiece.model:   0%|          | 0.00/792k [00:00<?, ?B/s]
added_tokens.json:   0%|          | 0.00/665 [00:00<?, ?B/s]
special_tokens_map.json:   0%|          | 0.00/2.20k [00:00<?, ?B/s]
tokenizer.json:   0%|          | 0.00/2.43M [00:00<?, ?B/s]
You are using the default legacy behaviour of the <class 'transformers.models.t5.tokenization_t5.T5Tokenizer'>. This is expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
config.json:   0%|          | 0.00/784 [00:00<?, ?B/s]
Fetching 17 files:   0%|          | 0/17 [00:00<?, ?it/s]
pytorch_model-00004-of-00008.bin:   0%|          | 0.00/4.96G [00:00<?, ?B/s]
pytorch_model-00006-of-00008.bin:   0%|          | 0.00/4.93G [00:00<?, ?B/s]
pytorch_model-00005-of-00008.bin:   0%|          | 0.00/5.00G [00:00<?, ?B/s]
pytorch_model-00003-of-00008.bin:   0%|          | 0.00/4.97G [00:00<?, ?B/s]
README.md:   0%|          | 0.00/14.8k [00:00<?, ?B/s]
.gitattributes:   0%|          | 0.00/1.48k [00:00<?, ?B/s]
pytorch_model-00001-of-00008.bin:   0%|          | 0.00/4.69G [00:00<?, ?B/s]
pytorch_model-00007-of-00008.bin:   0%|          | 0.00/5.00G [00:00<?, ?B/s]
pytorch_model-00002-of-00008.bin:   0%|          | 0.00/4.97G [00:00<?, ?B/s]
pytorch_model-00008-of-00008.bin:   0%|          | 0.00/4.93G [00:00<?, ?B/s]
pytorch_model.bin.index.json:   0%|          | 0.00/67.5k [00:00<?, ?B/s]
adapter_model.bin:   0%|          | 0.00/50.5M [00:00<?, ?B/s]
Collecting en-core-web-md==3.7.1
  Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.7.1/en_core_web_md-3.7.1-py3-none-any.whl (42.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.8/42.8 MB 11.8 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: spacy<3.8.0,>=3.7.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from en-core-web-md==3.7.1) (3.7.4)
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.0.12)
Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (1.0.5)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (1.0.10)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.0.8)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.0.9)
Requirement already satisfied: thinc<8.3.0,>=8.2.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (8.2.3)
Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (1.1.2)
Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.4.8)
Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.0.10)
Requirement already satisfied: weasel<0.4.0,>=0.1.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.3.4)
Requirement already satisfied: typer<0.10.0,>=0.3.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.9.0)
Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (6.4.0)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (4.66.1)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.31.0)
Requirement already satisfied: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.6.4)
Requirement already satisfied: jinja2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.1.3)
Requirement already satisfied: setuptools in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (69.0.3)
Requirement already satisfied: packaging>=20.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (21.3)
Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.3.0)
Requirement already satisfied: numpy>=1.19.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (1.22.4)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from packaging>=20.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.1.1)
Requirement already satisfied: annotated-types>=0.4.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.6.0)
Requirement already satisfied: pydantic-core==2.16.3 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.16.3)
Requirement already satisfied: typing-extensions>=4.6.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (4.9.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2024.2.2)
Requirement already satisfied: blis<0.8.0,>=0.7.8 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from thinc<8.3.0,>=8.2.2->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.7.11)
Requirement already satisfied: confection<1.0.0,>=0.0.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from thinc<8.3.0,>=8.2.2->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.1.4)
Requirement already satisfied: click<9.0.0,>=7.1.1 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from typer<0.10.0,>=0.3.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (8.1.7)
Requirement already satisfied: cloudpathlib<0.17.0,>=0.7.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from weasel<0.4.0,>=0.1.0->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (0.16.0)
Requirement already satisfied: MarkupSafe>=2.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages (from jinja2->spacy<3.8.0,>=3.7.2->en-core-web-md==3.7.1) (2.1.4)
Installing collected packages: en-core-web-md
Successfully installed en-core-web-md-3.7.1
✔ Download and installation successful
You can now load the package via spacy.load('en_core_web_md')
⚠ Restart to reload dependencies
If you are in a Jupyter or Colab notebook, you may need to restart Python in
order to load all the package's dependencies. You can do this by selecting the
'Restart kernel' or 'Restart runtime' option.
In [7]:
ref = '''Carnegie Mellon University (CMU) is a private research university in Pittsburgh, Pennsylvania. \
The institution was formed by a merger of Carnegie Institute of Technology and Mellon Institute \
of Industrial Research in 1967. In the 1990s and into the 2000s, Carnegie Mellon solidified its \
status among American universities, consistently ranking in the top 25. In 2018, Carnegie Mellon's \
Tepper School of Business placed 12th in an annual ranking of U.S. business schools by Bloomberg Businessweek.'''

gen = "CMU is a top-ranked university located in Pittsburgh. It was formed by merging Carnegie Institute \
of Technology, Mellon Institute of Industrial Research, and the Cranberry Lemon Institute. Its business school \
was ranked 15th in the US by Bloomberg Businessweek."

from pprint import pprint

out = fc.check(reference=ref, claim=gen)
pprint(out)
{'claim_sents': [{'success': False,
                  'txt': 'CMU is a top-ranked university located in '
                         'Pittsburgh.'},
                 {'success': False,
                  'txt': 'It was formed by merging Carnegie Institute of '
                         'Technology, Mellon Institute of Industrial Research, '
                         'and the Cranberry Lemon Institute.'},
                 {'success': False,
                  'txt': 'Its business school was ranked 15th in the US by '
                         'Bloomberg Businessweek.'}],
 'reference_sents': ['Carnegie Mellon University (CMU) is a private research '
                     'university in Pittsburgh, Pennsylvania.',
                     'The institution was formed by a merger of Carnegie '
                     'Institute of Technology and Mellon Institute of '
                     'Industrial Research in 1967.',
                     'In the 1990s and into the 2000s, Carnegie Mellon '
                     'solidified its status among American universities, '
                     'consistently ranking in the top 25.',
                     "In 2018, Carnegie Mellon's Tepper School of Business "
                     'placed 12th in an annual ranking of U.S. business '
                     'schools by Bloomberg Businessweek.']}
In [8]:
!nvidia-smi
Thu Mar 21 13:38:08 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.12             Driver Version: 535.104.12   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Tesla V100-SXM2-16GB           On  | 00000000:00:1B.0 Off |                    0 |
| N/A   38C    P0              62W / 300W |   2915MiB / 16384MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  Tesla V100-SXM2-16GB           On  | 00000000:00:1C.0 Off |                    0 |
| N/A   37C    P0              64W / 300W |   3035MiB / 16384MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   2  Tesla V100-SXM2-16GB           On  | 00000000:00:1D.0 Off |                    0 |
| N/A   38C    P0              70W / 300W |   3133MiB / 16384MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   3  Tesla V100-SXM2-16GB           On  | 00000000:00:1E.0 Off |                    0 |
| N/A   39C    P0              68W / 300W |   3433MiB / 16384MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A     13179      C   ...r/anaconda3/envs/python3/bin/python     2912MiB |
|    1   N/A  N/A     13179      C   ...r/anaconda3/envs/python3/bin/python     3032MiB |
|    2   N/A  N/A     13179      C   ...r/anaconda3/envs/python3/bin/python     3130MiB |
|    3   N/A  N/A     13179      C   ...r/anaconda3/envs/python3/bin/python     3430MiB |
+---------------------------------------------------------------------------------------+
In [11]:
fc.model.model.hf_device_map
Out[11]:
{'shared': 0,
 'decoder.embed_tokens': 0,
 'encoder.embed_tokens': 0,
 'encoder.block.0': 0,
 'encoder.block.1': 0,
 'encoder.block.2': 0,
 'encoder.block.3': 0,
 'encoder.block.4': 0,
 'encoder.block.5': 0,
 'encoder.block.6': 0,
 'encoder.block.7': 0,
 'encoder.block.8': 0,
 'encoder.block.9': 0,
 'encoder.block.10': 0,
 'encoder.block.11': 0,
 'encoder.block.12': 0,
 'encoder.block.13': 0,
 'encoder.block.14': 0,
 'encoder.block.15.layer.0.SelfAttention.q': 0,
 'encoder.block.15.layer.0.SelfAttention.k': 0,
 'encoder.block.15.layer.0.SelfAttention.v': 1,
 'encoder.block.15.layer.0.SelfAttention.o': 1,
 'encoder.block.15.layer.0.layer_norm': 1,
 'encoder.block.15.layer.0.dropout': 1,
 'encoder.block.15.layer.1': 1,
 'encoder.block.16': 1,
 'encoder.block.17': 1,
 'encoder.block.18': 1,
 'encoder.block.19': 1,
 'encoder.block.20': 1,
 'encoder.block.21': 1,
 'encoder.block.22': 1,
 'encoder.block.23': 1,
 'encoder.block.24': 1,
 'encoder.block.25': 1,
 'encoder.block.26': 1,
 'encoder.block.27': 1,
 'encoder.block.28': 1,
 'encoder.block.29': 1,
 'encoder.block.30': 1,
 'encoder.block.31': 1,
 'encoder.final_layer_norm': 1,
 'encoder.dropout': 1,
 'decoder.block.0': 1,
 'decoder.block.1.layer.0': 1,
 'decoder.block.1.layer.1': 1,
 'decoder.block.1.layer.2.DenseReluDense.wi_0': 1,
 'decoder.block.1.layer.2.DenseReluDense.wi_1': 2,
 'decoder.block.1.layer.2.DenseReluDense.wo': 2,
 'decoder.block.1.layer.2.DenseReluDense.dropout': 2,
 'decoder.block.1.layer.2.DenseReluDense.act': 2,
 'decoder.block.1.layer.2.layer_norm': 2,
 'decoder.block.1.layer.2.dropout': 2,
 'decoder.block.2': 2,
 'decoder.block.3': 2,
 'decoder.block.4': 2,
 'decoder.block.5': 2,
 'decoder.block.6': 2,
 'decoder.block.7': 2,
 'decoder.block.8': 2,
 'decoder.block.9': 2,
 'decoder.block.10': 2,
 'decoder.block.11': 2,
 'decoder.block.12': 2,
 'decoder.block.13': 2,
 'decoder.block.14': 2,
 'decoder.block.15': 2,
 'decoder.block.16.layer.0': 2,
 'decoder.block.16.layer.1': 2,
 'decoder.block.16.layer.2.DenseReluDense.wi_0': 2,
 'decoder.block.16.layer.2.DenseReluDense.wi_1': 2,
 'decoder.block.16.layer.2.DenseReluDense.wo': 3,
 'decoder.block.16.layer.2.DenseReluDense.dropout': 3,
 'decoder.block.16.layer.2.DenseReluDense.act': 3,
 'decoder.block.16.layer.2.layer_norm': 3,
 'decoder.block.16.layer.2.dropout': 3,
 'decoder.block.17': 3,
 'decoder.block.18': 3,
 'decoder.block.19': 3,
 'decoder.block.20': 3,
 'decoder.block.21': 3,
 'decoder.block.22': 3,
 'decoder.block.23': 3,
 'decoder.block.24': 3,
 'decoder.block.25': 3,
 'decoder.block.26': 3,
 'decoder.block.27': 3,
 'decoder.block.28': 3,
 'decoder.block.29': 3,
 'decoder.block.30': 3,
 'decoder.block.31': 3,
 'decoder.final_layer_norm': 3,
 'decoder.dropout': 3,
 'lm_head': 3}
In [ ]: