thinkst / zippy Goto Github PK
View Code? Open in Web Editor NEWDetect AI-generated text [relatively] quickly via compression ratios
License: MIT License
Detect AI-generated text [relatively] quickly via compression ratios
License: MIT License
Describe the bug
!pip install --upgrade numpy==1.25.2
!python3 -c "import numpy as np; print('> NumPy version: {}'.format(np.__version__))"
!git clone https://github.com/thinkst/zippy.git && cd zippy && pip install -r requirements.txt &&python3 setup.py build && python3 setup.py install
The output information is as follows:
Collecting numpy==1.25.2
Downloading numpy-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 45.7 MB/s eta 0:00:0000:0100:01
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.23.5
Uninstalling numpy-1.23.5:
Successfully uninstalled numpy-1.23.5
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
apache-beam 2.46.0 requires dill<0.3.2,>=0.3.1.1, but you have dill 0.3.7 which is incompatible.
apache-beam 2.46.0 requires numpy<1.25.0,>=1.14.3, but you have numpy 1.25.2 which is incompatible.
momepy 0.6.0 requires shapely>=2, but you have shapely 1.8.5.post1 which is incompatible.
numba 0.57.1 requires numpy<1.25,>=1.21, but you have numpy 1.25.2 which is incompatible.
pymc3 3.11.5 requires numpy<1.22.2,>=1.15.0, but you have numpy 1.25.2 which is incompatible.
pymc3 3.11.5 requires scipy<1.8.0,>=1.7.3, but you have scipy 1.11.2 which is incompatible.
tensorflow 2.12.0 requires numpy<1.24,>=1.22, but you have numpy 1.25.2 which is incompatible.
woodwork 0.26.0 requires numpy<1.25.0,>=1.22.0, but you have numpy 1.25.2 which is incompatible.
ydata-profiling 4.3.1 requires numpy<1.24,>=1.16.0, but you have numpy 1.25.2 which is incompatible.
ydata-profiling 4.3.1 requires scipy<1.11,>=1.4.1, but you have scipy 1.11.2 which is incompatible.
Successfully installed numpy-1.25.2
> NumPy version: 1.25.2
Cloning into 'zippy'...
remote: Enumerating objects: 829, done.
remote: Counting objects: 100% (222/222), done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 829 (delta 130), reused 152 (delta 82), pack-reused 607
Receiving objects: 100% (829/829), 46.75 MiB | 25.33 MiB/s, done.
Resolving deltas: 100% (343/343), done.
Updating files: 100% (319/319), done.
Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (1.25.2)
Collecting brotli (from -r requirements.txt (line 4))
Downloading Brotli-1.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 29.0 MB/s eta 0:00:00a 0:00:01
Installing collected packages: brotli
Successfully installed brotli-1.1.0
/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``easy_install``.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
import zippy.zippy
from zippy.zippy import Zippy, EnsembledZippy, PRELUDE_STR, LzmaLlmDetector, BrotliLlmDetector, ZlibLlmDetector, CompressionEngine
The error message is as follows:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from zippy.zippy import Zippy, EnsembledZippy, PRELUDE_STR, LzmaLlmDetector, BrotliLlmDetector, ZlibLlmDetector, CompressionEngine
ImportError: cannot import name 'Zippy' from 'zippy.zippy' (/kaggle/working/zippy/zippy/__init__.py)
!uname -a
Linux eb546a198970 5.15.133+ #1 SMP Sat Nov 4 11:53:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Hi,
in the README.md
you are mentioning a paper which applies the same technique for anomay detection. However you do not apply the same formula in your code.
From what I understood the normalization factors are different.
I wonder if you had any reason to do so, and would be interested to discuss more about it, since it seems to me that the formula in the original paper is more suited - but maybe you found some empirical optimization.
Thank you, and again congratulations for the project and the presentation at Hacklu
The output of zippy is for example ('Human', 0.06013429262166636), but what exactly does thew number represent ? What is the range ? Would this be 6% ?
I understand it might make sense for someone deep down in ZipPy but for a person coming and looking for the first time there is no indication anywhere what this number is
I want to implement this repository. I cloned it on my windows machine and followed Readme.md
file for the installation using pip3
. However, after successful installation, I ran into following error while trying to run zippy -h
:
(venv) C:\Users\HP\PycharmProjects\zippy>zippy -h
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\HP\PycharmProjects\zippy\venv\Scripts\zippy.exe\__main__.py", line 4, in <module>
File "C:\Users\HP\PycharmProjects\zippy\venv\lib\site-packages\zippy\__init__.py", line 1, in <module>
from .zippy import *
File "C:\Users\HP\PycharmProjects\zippy\venv\lib\site-packages\zippy\zippy.py", line 44, in <module>
PRELUDE_STR = clean_text(files('zippy').joinpath(PRELUDE_FILE).read_text())
File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1135, in read_text
return f.read()
File "C:\Users\HP\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 54323: character maps to <undefined>
Can you please let me know if there is any step which I am missing?
Hello,
I saw the post on beehaw.org about this project and started playing around but I've gotten false negatives when using a 7B model. How would it be possible to improve detection so I could try and get more accurate results? And is it possible without lessening detection on larger models such as ChatGPT?
I've gotten the following results using the 7B model:
Silly generation: Human 0.60
Serious generation: Human 0.039
My own text: Human 0.69
Is your feature request related to a problem? Please describe.
Hey there! Can we have library of zippy?
Describe the solution you'd like
just a clean pip3 install zippy/xyz would be smoother :)
Describe alternatives you've considered
none
Additional context
Please consider implementing it to https://pypi.org/
Describe the bug
Running on Windows 11 Python 3.10.9 the ai-generated.txt file cannot be read and the program crashes.
To Reproduce
Expected behavior
Either the README should specify the environment in which the tool works (perhaps a linux host is required) or the read of ai-generated.txt should be fixed to ignore these chars or process them differently.
Desktop (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.