DeepSpam v0.3 release - uj tokenizalo, uj dataset/model

Elkeszult az FSF.hu altal tamogatott neuralis halos spamszurom uj verzioja...

uj model: http://thot.banki.hu/deepspam/model_big_v3/

sokkal tobb, tobbszorosen ellenorzott mintabol epitve:
36172 mail.neg
45139 mail.pos
81311 total

uj milter: http://thot.banki.hu/deepspam/milter-v0.3/
vagy online teszteleshez postfix/main.cf-be: smtpd_milters = inet:193.224.38.187:1080

Changelog v0.3:
================
- html parser atirva, jobban kezeli az extrem eseteket
- kodlap kezeles javitasok, pl. hibas utf8...
- tokenizalas modositva, anonimizalja a cimeket (email/url), szamokat
emiatt javasolt az uj model (v3) hasznalata, mert az mar az uj parserrel keszult!
- mar nincs python 2.x support, de ha van ra igeny megnezem majd, viszont foleg a kodlap kezeles tok maskepp megy 3.x alatt...

A'rpi

Hozzászólások

Köszi!
-------------------------
Hivatásos pitiáner
neut @ présház

sub

(hatha meg iden ra tudok nezni:)

---
Saying a programming language is good because it works on all platforms is like saying anal sex is good because it works on all genders....

Off: bocs, a model.png-t mivel rajzoltad?

Csináltam egy konténert a cuccosnak. Megosztom hátha valakinek hasznos. Ha lesz időm csinálok hozzá dockerfile-t is, de most egyelőre tesztelgetem.
Az ellenfél egy agyontanított dspam (még nem találtam jobbat). Első ránézésre partiban van vele, talán jobb is egy kicsit.
Ja, a tesztkörnyezet egy kb. 500 useres postfix egy tizenéves vason. AVX mutatóban sincs ennek ellenére 60ms/step az átlagos idő.


HOST:
docker run -it --name=dstemp debian:stretch

CONTAINER:
apt update
apt install dialog # csak hogy ne anyázzon az apt
apt upgrade # szúrta a szemem az 5 nem frissített csomag
apt install libmilter-dev # ez a pymilter-hez kell, hogy ne kelljen forrásból fordítani
apt install python3-pip

(if CPU AVX capable)

pip3 install tensorflow

(else)

apt install wget
wget https://files.pythonhosted.org/packages/43/aa/fe3e9d0b48db4adde9781658b…
pip3 install ./tensorflow-1.5.0-cp35-cp35m-manylinux1_x86_64.whl

(fi)

pip3 install pymilter html2text keras==2.2.5

# 'ctrl-d' kilépés a konténerből

HOST:
docker commit dstemp deepspam
docker rm -f dstemp

#összerendezgeted a file és könyvtár struktúrát (lásd: v0.2) vagy átírod a deepspam.py-t, aztán belépsz a deepspam.py könyvtárába, majd go:

docker run -it --rm --name=deepspam --hostname=deepspam -v $PWD:/tmp -w /tmp deepspam python3 ./deepspam.py

Kár, hogy ez nem hír lett, megérdemelte volna :D

Ki szerettem volna próbálni, de elakadtam python verzió problémával.

VPS-re telepítettem Debian 10-et. AVX nem támogatott.
Alapból 3.7-es python van, és a tensorflow 1.5 csak 3.6-os verzióig támogatott. Ha jól értelmeztem.

Várjak új verzióra?
Lehet telepíteni 3.6-os pythont debian 10-re? Nem sikerült, de nem értek a pythonhoz.
Mi az ajánlott distro?

2011 ota van avx... ha nem olyan regi akkor lehet csak a cpu flag-eket nem jol maszkoltak le a vps-nel. qemu-nal pl. meg lehet adni milyen cpu-t emulaljon...

vagy probald meg masik backend-el, a keras nem csak tensorflow-t tamogat, bar en csak azzal hasznaltam.

memoria lesz eleg? vps-ek nem arrol hiresek...

Tapasztalat:
AVX nélkül sem zabálja a procit, szinte észre sem lehet venni átlagosan 1 mail/s terhelésnél. Nagyobb gond a memória használat. A kezdeti 2 Gb körül értékről három hét alatt felkúszott több mint 4Gb-ra. Mivel csak 6 Gb van a gépben le is állítottam. Nézted mikor indítottad a memóriafoglalást? Nem lehet, hogy nálad is 2-ről ment fel 10-12-re? Nem ismerem az egész működését, de szerintem ez memória kezelési hiba lesz.

Egyébként kurva jó cucc. A három hét alatt fals-pozitívot nem találtam. Az angol nyelvű spamekre bőven 95% fölött volt a találat, a magyarokra kb. 80-85%.
Mikor jön a v0.4? Meg akartam csinálni a paraméterezhetőség (meg még egy két dolgot, pl. Subject hozzáadás), de mivel írtad, hogy hamarosan jön, ezért várakozó álláspontra helyezkedtem.

centos-en en is lattam ilyen memleak-elest a regi (0.2) verzional python2-vel. azt hittem valami bug, mert a 0.3+py3.6 ota nem tapasztalom ezt ott, ubuntun pedig regebben sem, vagy legalabbis nem ennyire durvan. amugy a pymilter-re gyanaxom, hogy a megszakadt smtp kapcsolatok beragadhatnak a memoriaban.
kell egy cron ami hetente restartolja es megoldva :)))

v0.4 lehet kimarad (beta fennvan, de az inkabb csak refaktor), mar a 0.5-on dolgozom :)

A'rpi

Pongyola voltam, nem találat volt 80-85%, hanem az elfogott levelek aránya. Ez annak köszönhető, hogy nem egy olyan spam volt amit egymásután 30-40 címre is küldtek. A találat a magyar leveleknél is 95% fölötti.
Nincsenek meg ezek a levelek, de ha újra beizzítom, akkor begyűjtöm és küldöm.

Tényleg érdekes. Most nézem a grafikonokat, a régi felállással 3 hét alatt felzabálta a 6GB memóriát. Most, hogy 16GB van 7 hete 4.5GB körül mocorog. Passz.

Semmi nem frissült, konténerben fut.

„Az összeomlás elkerülhetetlen, a katasztrófa valószínű, a kihalás lehetséges.” (Jem Bendell)

Eszembe jutottak az olcsóbbnál is olcsóbb VPS-t keresek topikok, és ott ráböktem az egyikre, ami támogatja az AVX-et.
https://contabo.com/?show=vps
VPS M SSD
6 mag, 16G ram.

Linux mx1....hu 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux


processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
stepping : 2
microcode : 0x1
cpu MHz : 2399.996
cache size : 16384 KB
physical id : 0
siblings : 6
core id : 5
cpu cores : 6
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips : 4799.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual

Elég jó arányba szűri a leveleket, de azért akadnak hibák.

Szívesen visszajelzem ezeket, ha fel tudod használni. Viszont a GDPR miatt, vhogy anonimizálni kellene a leveleket. Esetleg amit a programban használsz erre a célra ki tudod emelni külön scriptbe?

vagy a deepspam.res filebol azokat a sorokat kuldd el ami tevedes, vagy a levelre/folderre kuldd ra a maildedup2.py-t, az mbox/eml filebol megcsinalja.

amugy ezt nem is ugy terveztem hogy csak onmagaban hasznalni, mert nem nez minden parametert a levelben, csak a body szoveget, sokkal inkabb kiegesziti az egyeb modszereket (greylist, header checks, spamassassin, clamav stb). pl. egy kepet vagy csak url-t tartalmazo levellel nem tud mit kezdeni, akkor sem ha az url vagy az ip rajta van 10 blacklisten mar.

en ugy latom (sok helyen hasznalom mar), hogy pont azokat fogja meg eleg jo hatekonysaggal, ami a spamassassin/clamav-on atcsuszik, mert amugy artalmatlan levelnek tunik (pl. feltort valid accounttal kuldik, ami nincs blacklisten, es betart minden smtp protokollt), de a szovege gyanus. elsosorban a phishing leveleket.

A'rpi

Nem is olyan egyszerű visszakeresni.

Saját fiókban ezt a kettőt látom most. Ilyen formában jó lesz?

Mindkettőben kevés a szöveg. Gondolom ez nehezít a dolgon.

Github értesítő:
99%:fwiw i just tried sbtprojectmatrix and hit on sbt sbtprojectmatrix ## . our build is structured like this mtagsinterfaces pure java mtags crossversion . full # . ## . ## # . ## . ## # . ## . # . depends on mtagsinterfaces you are receiving this because you are subscribed to this thread . reply to this email directly view it on github or unsubscribe .

Twitter értesítő:
100%:twitter httpurl ## aktualis ertesitesed van a twitteren nezd meg httpurl sugo httpurl beallitasok httpurl leiratkozas httpurl ; cn mtewote # mtqwomfjdgl # axr # x # rpz # vzdf ## axrox # hlywrsaw # lx # noyw # nzq # d # d sig ## eee # ebf ## df #### db ########## a # d # c # c ### c iid ### e # f ######### bbd # c # b #### e # e # e # uid ######## nid ### ## usbid ## elkuldtuk emailaddressalonak . leiratkozas httpurl ; cn mtewote # mtqwomfjdgl # axr # x # rpz # vzdf ## axrox # hlywrsaw # lx # noyw # nzq # d # d sig ## eee # ebf ## df #### db ########## a # d # c # c ### c iid ### e # f ######### bbd # c # b #### e # e # e # uid ######## nid ### ## usbid ## twitter inc . #### market street suite ### san francisco ca #####

hat, ez alapjan en is spamnak mondanam oket :) foleg a 2. eleg erdekes a sok ertelmetlen karakterekkel...

de az elso is eleg erdekesen nez igy ki...

amugy a maildedup2-vel elo tudod ujra allitani barmilyen emailbol vagy unix mailboxbol, sot az meg a duplikaciokat is kiszedi, az egyszerubb mint a logbol megtalalni :)

Gyakorlatilag a levél nagy része a két nagyon hosszú hivatkozás. De ettől még ezek hasznos értesítő levelek.

Sajnos nem mentettem ki rögtön, de ma volt két google levél (talán analitika értesítések), egy számla értesítő és egy KSH adatszolgáltatás levél, amit spamnek jelölt, na és észrevettem.

Megoldottam, hogy aránylag könnyen le tudjam szűrni az utolsó pár ezer levelet. Privátba fogok néha küldeni, ha hasznos lesz.

Most csak a ham/spam jelöléseket nézem. Ez alapján 1% alatt lehet a hiba.

Amit most írok azt inkább segítő szándékkal írnám.

Jó, és nagyon tetszik, amit csinálsz!

A dokumentáció lehetne beszédesebb. Kezdőknek, akik életükben nem csináltak ilyet nem evidensek a telepítés lépései.A telepítési leírásnál azt mondod,hogy elég letölteni a deepspam.py file-t, de utána meg ott van, hogy kell a milter.eml fájl is. 

Ha kaphatnék egy részletesebb (step-by-step) telepítési guide-ot szívesen csinálnék belőle egy Dockerfile-t, amit visszaosztanék a közösségnek. Jó lenne a kódot valahonnan egyszerűbben letölthetővé tenni, például GIT és a releaseket tar.gz-ben le lehetne tölteni stb. 

Rövid riport, hátha érdekel valakit:

Nálam a 0.3 külön virtuál gépben futtatva ( 4 cpu mag, 8GB ram )  gond nélkül feldolgoz átlagban napi 20 ezer levelet. Vélhetően sokkal többet is tud, mert volt egy kiugró 32 ezres nap, és ott sem esett kétségbe.

Valakinek gyűlt még tapasztalat ?

A'rpi, ezúton is köszönet a munkádért !

hat ha modern (nem 8+ eves) cpu-d van (vagy van cuda-s gpu) akkor azert ez gyorsabb akar a spamassassin akar a clamav ellenorzesenel, es azok is siman visznek nalam 50k+ napi levelet. altalaban 30-70ms 1 level feldolgozasa, amivel kb 1000 levelet tud percenkent (de legkozelebb lemerem amikor ilyen sok 100 ezres mailboxokat tesztelek vele offline, de az is max 1-2 ora volt).

a 0.5 kicsit csuszik mert mindig amikor azt hiszem mar minden OK a teszteknel talalok valamit (a tokenizalot ill. html parsert reszelem meg mindig) ami miatt belenyulok es kezdhetem elolrol a tesztelest... de karacsonyra megkapjatok :)

kozben keszul az uj word2vec is, 36GB(!) magyar szovegbol (a hu wikipedia 600 mega csak...) es kb ugyanennyi angol minta, plusz valamennyi nemet, olasz, francia, spanyol is kerul bele, mert foleg a nemet leveleknel sok tevedest lattam.

A'rpi

Egy kicsit offtopik, de hatha tudtok segiteni. Kicsit elmeleti.

Nalunk olyan 3-400spam/usert kapunk naponta.

Olyat szeretnek, hogy 99.99999%-os pontosaggal eldobnam a spamek biztos reszet, ugy, hogy a usert el se eri, a spam mappajat sem.

Es utana szurnem a maradek 10-20spamet/user/nap.

Probaltam mindenfelet, de pl. a levelek ellenorzesenel (dkim+spf) inkabb a ham kuldok buknak meg (pl. *.gov.hu, van amikor dns bejegyzes sincs!).

Nektek mi a strategiatok?

A szomoru valosag az, hogy olyan 300spamenkent egy ham is becsuszik, igy a userek atnyalazzak minden nap a spam mappat is. Ami rettento idopazarlo.

Saying a programming language is good because it works on all platforms is like saying anal sex is good because it works on all genders....

a kulonbozo modszerek/algoritmusok mas-mas tipusu spammekre hatekonyak. ezert kell sokfelet kombinalni.

a deepspam-nal elsosorban a phishing szurese volt a cel, a tanitashoz hasznalt mintaknal is erre koncentraltam. ebben messze jobb is mint barmi mas. persze ez is tevedhet, de azt lehet ellensulyozni massal (pl. bayes) vagy whitelistelni.

persze az ellensuly forditva is elsulhet: ez pl. ma jott: "Levél: Az Ön akcióban való részvétele ügyében"  es 4.7 ponttal epp meguszta, pedig a deepspam adott ra 99%-ot, de whitelistelt ip-rol jott dkim-el spf-el stb.

A'rpi

ilyet szeretne mindenki nyilvan :)

sulyozni kell, en spamassassin-al fogom ossze a kulonbozo algoritmusokat (dnsbl, deepspam, dcc, clamav, sa-rules, bayes stb) es az osszpontszam alapjan vagy csak megjelolom (ez megy a spam mappaba) vagy ha eler egy erteket (12-15 pont korul) akkor megy a levesbe (karanten a szerveren, az user nem latja). igy a spammek nagy resze a levesben vegzi, ahol kicsit bizonytalan az algoritmus az megy csak a spam mappaba, ami igy nem sok, max par db/nap amit kibir az user.

spf/dkim csak arra kell hogy a gmail fogadja a leveleidet, mert amugy tenyleg a spammerek hasznaljak foleg, nem a ham-ek.

Nalam ragjak a fulemet, hogy menjunk at vallalati gmail ala, mert akkor nem lesz spam abszolut.

De sztem gmail alatt is csak annyi lenne, hogy a spam mappa fullon lenne allandoan, es nem napi 1-3 hammal hanem havi 1-2vel.

De lehet, hogy atmigralom magunkat, de meg ezeket a koroket amit irtatok elotte lefutom, hogy majd tudjak visszamigralni...:)

Saying a programming language is good because it works on all platforms is like saying anal sex is good because it works on all genders....

felraktam a v0.5 betajat:   

http://thot.banki.hu/deepspam/milter-v0.5-dev/

changelog:

- sajat html parser (nem dependel tobbet a html2text-re)
- sajat xml es html entity dekoder (kiderult hogy python3-ban bugzik a gyari)
- a txt2tok tool es az eml2token mar megy python2-vel is, es pypy-vel is.  lehet, hogy a tobbi is, de azt meg nem teszteltem :)

keszul az uj word2vec is, kb 90 giganyi szovegbol! ha meglesz, es jo lesz, akkor azzal tanitok egy uj modelt is.

Szerkesztve: 2019. 12. 16., h – 08:06

Ez még működik ?

193.224.38.187:1080

Mert ez van a logban :

  warning: connect to Milter service inet:193.224.38.187:1080: Connection refused

felraktam egy uj modelt:
http://thot.banki.hu/deepspam/model_big_v4/

- uj word2vec-re epul, amit novemberben szamolt kb 1 honapig a gep. ebben sokkal tobb a szoveg (magyar is!) a korabbinal, es mas nyelvek is belekerultek kisebb mertekben (de,fr,it,es)

- mivel az uj w2v sokkal jobb minosegu lett, le lehetett csokkenteni a model meretet kb a felere, igy is hozza ugyanazokat a szamokat :)  -> kevesebb RAM kell.

- ez meg a szeptemberi spam/ham datasetre (v3) epul, de abbol is keszul az uj, csak meg nem volt idom befejezni, talan majd az unnepek alatt / januar...

- keszult egy meg ujabb word2vec is decemberben ~90GB szovegbol es mas parameterekkel (cbow modszerrel skipgram helyett, es kisebb dimenzioval) de sajnos ez 1%-al rosszabb lett, igy ez ment a kukaba. ujraszamoltatom sg-vel de az megint 1 honap lesz, vagy inkabb 2... :)  (eredetileg ezt akartam az uj modelhez hasznalni, de igy elovettem az elozo sg-s verziot)

Tapasztaltam olyat tobbszor is, hogy egyszeruen a kovetkezo hibauzenettell kb 4 orankent megall a legujabb verzio (a korabbival nem volt ilyen):

1/1 [==============================] - 0s 266ms/step
python3: /root/.theano/compiledir_Linux-5.4.5-x86_64-with-debian-10.2--3.7.3-64/tmpb6ob1p7n/mod.cpp:266: int {anonymous}::__struct_compiled_op_m43e2f10175c8cb3751d25cf685f5379783484e0f29388fc21a34a41edb6ae98d::run(): Assertion `PyArray_NDIM(V5) == 1' failed.

Esetleg van tipped?

Átfutottam a statisztikákat.

Már nem jelöli spamnek a github értesítőket, és a valid számlalevelekből is érezhetően kevesebbet jelöl spamnek.

Barátságosabb lett a memóriahasználat.

A facebbok, twitter értesítőket továbbra is spamnek jelöli, de ezeket a nagy szolgáltatókat könnyű fehérlistázni.

Szóval nagyon jó a cucc.

persze, en is gpu-n futtatom, cpu-n orokkevalosag lenne :) bar az ujabb tensorflown sokat optimalizaltak, de igy is min 10x a kulonbseg a gpu javara.

mondjuk tudtommal meg mindig csak cuda (nvidia) tamogatott a neuralis halos frameworkok (tensorflow, theano stb) altal, opencl-t nem nagyon eroltetik sehol. banyaszni meg inkabb atival szoktak...

van nvidia is boven. raadasul lassan azok egy resze technikailag is kiesnek, mert mar keves a rajtuk levo 3G ram. (1050, 1060, 1070 kartyak)

most megneztem nicehash calcban, 0.45$/napot mond egy 1070 kartyara. ebbol kb kiszamolhatod hogy mekkora koltseg a teljes tanitas.

A vegtelen ciklus is vegeter egyszer, csak kelloen eros hardver kell hozza!

nem tudom kevesebb memoriaval is megoldja-e a TF, de nalam (1080Ti) megeszi az egeszet tanitas alatt:

10801MiB / 11178MiB

ami biztos, hogy regen a 950gtx-en 4gb rammal nem indult el, tehat annal biztosan tobb kell.

amugy maga a tenyleges tanitas lefut ezen kb 1 ora alatt (meg avx2-es cpu-n is lefut 1 nap alatt szerintem), csak ugye a melo nagy resze a dataset osszeallitasabol/tesztelesebol all, valamint a model parameterekkel valo kiserletezesbol (hany iteracio, batch size, mekkora w2v model, hany dimenzios vektorok, hany dimenzios filterek, mekkora dropout stb). neha ugyanazokkal az inputokkal 2 tanitas is mas minosegu eredmenyt hoz (ugye eleg sok a random) :)

ami nagyon eszi a gepet az a word2vec epites, az 1-2 honap is akar... persze az is nagyban fugg a parameterektol es a dataset meretetol.

Szerkesztve: 2019. 12. 30., h – 23:46

most futottam bele egy olyan spam-be, ahol a fejlecben (from) invalid karakterkodok voltak, amik utf8 dekodolasi exceptiont okoznak a pymilter-ben (mondjuk azt nem ertem, egyaltalan miert probalja dekodolni).

mar javitottak 4 honapja, de meg az utolso releaseben nincs benne, erdemes a githubrol frissiteni/felrakni:

https://github.com/sdgathman/pymilter/archive/master.zip

szerk: a hiba csak 3.x pythont erinti

Szerkesztve: 2020. 01. 03., p – 10:15

mai meglepi:  "Sěcuříty ňøtícě. Søměøňě håvě åccěss tø yøuř systěm."

"Thě fåct ís thåt yøü wěrě ínfěctěd wíth målwårě thrøügh ån ådült sítě thåt yøü vísítěd."

tehat elkezdtek intenziven hasznalni a vizualisan hasonlo karakterek (unicode confusables) trukkot spam-ekben is.

ugy tunik, hogy az unicodedata.normalize() nem kezeli le rendesen, pl. az athuzott 'o' betu (0xF8) eltunik a konverzio soran :(

osszedobtam egy sajat karakter konverzios tablat, reszben a confusables.txt, reszben a normalize() eredmenyei alapjan, helyenkent kezzel korrigalva/kiegeszitve:

http://thot.banki.hu/deepspam/unicode/

a kovetkezo verzioban mar ezt fogom hasznalni a normalize() helyett...

es ez annyira "szep":  ss="".join(confusables.get(ord(x),"?") if ord(x)>=128 else x for x in s)

elkezdtek beepiteni a keras-t a tensorflowba, es dobjak is a tobbi backend (theano stb) tamogatasat.

ezutan a keras nem onalloan fog letezni, hanem a tensorflow-on belul. a 2.3-as keras mar nem is igazan mukodik tensorflow-al, ezert kellett 2.2.5-re downgradelni, de van szebb megoldas is, at kell irni a ds_model.py-ben a keras-t tensorflow.keras-ra, es akkor nem is kell a kerast kulon telepiteni, hanem a tf beepitettet hasznalja.

az aktualis 1.x tensorflow-ban egyebkent 2.2.4-es keras van, nyilvan nem veletlenul... a 2.x tf-ben lesz majd ujabb ami tobb gpu-t tamogat stb.

A'rpi

Szerkesztve: 2020. 04. 13., h – 11:36

Uj release:   http://thot.banki.hu/deepspam/milter-v0.7/

- ds_model-bol keszult egy queue alapu verzio, ami 1 thread-ben futtatja a keras+tensorflow-t, a deepspam.py mar ezt hasznalja.

- es egy uj, ppymilter-re epulo verzio (deepspam3.py), ami teljesen 1 szalon fut, semmi multithreading, es nem zabalja (annyira) a memoriat :)

Uj model:     http://thot.banki.hu/deepspam/model_v7_6-jo/

- A v7 ota kivettem az LSTM reteget, igazabol nem hozott annyi pluszt, amennyi eroforrast eszik, es neha furcsan is viselkedett. helyette tobb Convolution layer lett.
- 2020.marcius vegeig beerkezett es ellenorzott spam/ham mintakkal tanitva:

    41006 mail.neg
    58252 mail.pos
    99258 total

A'rpi

ha valakit erintene, jo hir, hogy az uj verziom mar mukodik az uj, 2.1.0-as tensorflow-val is (nyilvan a tensorflow-ba beepitett keras-t hasznalva), nem csak a regi 1.x szeriaval (1.14/1.15). raadasul elso blikkre gyorsabb is valamennyivel!

(a pip3 20.x verzio mar ezt telepiti alapbol, a regebbi verzio az 1.14-et)

A'rpi

helló, próbálok életre kelteni, a fentebb linkelt docker verziót használom és ilyen hibába ütközöm:

2020-04-22 05:39:29.792248: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/model.weights: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
 

természetesen a model.weights ott van, próbáltam én is megbuildelni de ugyanide jutottam. valami ötlet? vagy ez a normális működés része? köszi!

biztos nem normalis, d eilyet meg nem lattam., oly mintha hibas lenne a file (bad magic) es ezert nem tudja betolteni.

az utolso model-t probalod? milyen tensorflow/keras verzioval?

/public_html/deepspam/model_v7_6-jo# md5sum *

d32bcad25840f378e370b604611f822d  keras4_emb.py
8b2ab6c21451618229b8dafdd468cfb6  model.config
a791b2d19fce60c0dd3beb8838ee6892  model.weights
92a6756f4fcabd21e3e119aaae19a57e  model.wordmap-py2
e91a39609e57fff57cc1271a1058b0dc  model.wordmap-py3

(szerk, adtam még memóriát neki hogy ne legyen vele gondja)

bemásolom a teljes kimenetet, mivel most pl el se indul, bár elvileg nem változott semmi (alább az md5sumok és fájlok):

 

Loading Model...
missing/bad milter.eml -> skipping self-test!
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/initializers.py:119: calling RandomUniform.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
2020-04-22 07:13:17.626179: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/model.weights: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
2020-04-22 07:13:18.460631: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2793225000 Hz
2020-04-22 07:13:18.462010: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7efc88822c30 executing computations on platform Host. Devices:
2020-04-22 07:13:18.462052: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2020-04-22 07:13:18.499948: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
worker: started!!!
worker: waiting for job... (0)

 

 

# ls -Rla
.:
total 160
drwxr-sr-x. 1 root staff  4096 Apr 22 06:58 .
drwxrwsr-x. 1 root staff  4096 Apr 14 14:07 ..
drwxr-sr-x. 2 root staff  4096 Apr 22 06:58 __pycache__
-rwxr-xr-x. 1 root root   5224 Apr 14 13:31 deepspam.py
-rw-r--r--. 1 root root   7780 Apr 14 13:31 deepspam3.py
-rw-r--r--. 1 root root   1919 Apr 14 13:31 ds_model.py
-rw-r--r--. 1 root root   3630 Apr 14 13:31 ds_model_queue.py
-rw-r--r--. 1 root root   2859 Apr 14 13:31 ds_model_tf2.py
-rw-r--r--. 1 root root   7504 Apr 14 13:31 eml2token.py
-rw-r--r--. 1 root root   2695 Apr 14 13:31 eml2txt.py
-rw-r--r--. 1 root root   4368 Apr 14 13:31 htmlentitydefs.py
-rw-r--r--. 1 root staff  5539 Apr  5 21:12 keras4_emb.py
-rw-r--r--. 1 root root   4215 Apr 14 13:31 maildedup2.py
drwxr-sr-x. 1 root staff  4096 Apr 14 14:09 model
-rw-r--r--. 1 root root   5982 Apr 14 13:31 parsehdr.py
-rw-r--r--. 1 root root  25052 Apr 14 13:31 ppymilterbase.py
-rw-r--r--. 1 root root   2052 Apr 14 13:31 tester.py
-rw-r--r--. 1 root root   2474 Apr 14 13:31 txt2tok.py
-rw-r--r--. 1 root root   2563 Apr 14 13:31 txt2tok_test.py
-rw-r--r--. 1 root root  19863 Apr 14 13:31 unicodes.map

./__pycache__:
total 36
drwxr-sr-x. 2 root staff 4096 Apr 22 06:58 .
drwxr-sr-x. 1 root staff 4096 Apr 22 06:58 ..
-rw-r--r--. 1 root staff 2694 Apr 22 06:58 ds_model_queue.cpython-35.pyc
-rw-r--r--. 1 root staff 6242 Apr 22 06:58 eml2token.cpython-35.pyc
-rw-r--r--. 1 root staff 5078 Apr 22 06:58 htmlentitydefs.cpython-35.pyc

./model:
total 1026056
drwxr-sr-x. 1 root staff       4096 Apr 14 14:09 .
drwxr-sr-x. 1 root staff       4096 Apr 22 06:58 ..
-rw-r--r--. 1 root staff      14207 Apr  5 21:12 model.config
-rw-r--r--. 1 root staff 1025938224 Apr  5 21:13 model.weights
-rw-r--r--. 1 root staff   24704619 Apr  5 21:13 model.wordmap-py3
 

 

# md5sum model/*
8b2ab6c21451618229b8dafdd468cfb6  model/model.config
a791b2d19fce60c0dd3beb8838ee6892  model/model.weights
e91a39609e57fff57cc1271a1058b0dc  model/model.wordmap-py3
 

ahogy futtatva van: 

python3 deepspam.py

 

---

ha a python3 deepspam3.py -t futtatom akkor is hasonló a helyzet:

 

/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/initializers.py:119: calling RandomUniform.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
2020-04-22 07:22:37.802571: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/model.weights: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
2020-04-22 07:22:38.945691: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2793225000 Hz
2020-04-22 07:22:38.948290: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55ed7d9e5f30 executing computations on platform Host. Devices:
2020-04-22 07:22:38.948376: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2020-04-22 07:22:38.995492: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
^C
 

a verziók lemaradtak:

 

# pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
absl-py (0.9.0)
astor (0.8.1)
cryptography (1.7.1)
gast (0.3.3)
google-pasta (0.2.0)
grpcio (1.28.1)
h5py (2.10.0)
html2text (2020.1.16)
idna (2.2)
Keras (2.2.5)
Keras-Applications (1.0.8)
Keras-Preprocessing (1.1.0)
keyring (10.1)
keyrings.alt (1.3)
Markdown (3.2.1)
numpy (1.18.2)
pip (9.0.1)
protobuf (3.11.3)
pyasn1 (0.1.9)
pycrypto (2.6.1)
pygobject (3.22.0)
pymilter (1.0.4)
pyxdg (0.25)
PyYAML (5.3.1)
scipy (1.4.1)
SecretStorage (2.3.1)
setuptools (46.1.3)
six (1.10.0)
tensorboard (1.14.0)
tensorflow (1.14.0)
tensorflow-estimator (1.14.0)
termcolor (1.1.0)
Werkzeug (1.0.1)
wheel (0.29.0)
wrapt (1.12.1)
 

megneztem a regi tf-el is, ez is ubi 16, ez is mukodik, de azert eltart egy ideig (kb 15 sec) mire betolt, es kell hozza 2GB ram legalabb:

 

root@fsfgpu:/home/arpi/learn2019/v0.7-pub# ./deepspam3.py
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/initializers.py:119: calling RandomUniform.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
2020-04-22 12:53:11.024673: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/model.weights: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
2020-04-22 12:53:11.218783: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-04-22 12:53:11.222336: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3503910000 Hz
2020-04-22 12:53:11.222609: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x43f01a0 executing computations on platform Host. Devices:
2020-04-22 12:53:11.222622: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2020-04-22 12:53:11.237880: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
3116 entries loaded from unicodes.map file

Loading Model...
MODEL loaded! (1000000 words)
initing MSS

 

root@fsfgpu:~# python3 -m pip list
-lxc (0.1)
absl-py (0.8.0)
asn1crypto (0.24.0)
astor (0.7.1)
astroid (1.4.4)
beautifulsoup4 (4.4.1)
boto (2.49.0)
boto3 (1.9.246)
botocore (1.12.246)
bz2file (0.98)
certifi (2019.9.11)
cffi (1.12.3)
chardet (2.3.0)
command-not-found (0.3)
confusables (1.1.1)
cryptography (2.7)
cycler (0.9.0)
decorator (4.3.0)
defusedxml (0.6.0)
docutils (0.15.2)
fasttext (0.9.1)
feedparser (5.1.3)
gast (0.2.0)
gensim (3.8.1)
google-pasta (0.1.7)
grpcio (1.17.0)
h5py (2.10.0)
html2text (2016.1.8)
html5lib (0.999)
idna (2.8)
jmespath (0.9.4)
Keras (2.2.5)
Keras-Applications (1.0.8)
Keras-Preprocessing (1.1.0)
langdetect (1.0.7)
language-selector (0.1)
lazy-object-proxy (1.2.1)
logilab-common (1.1.0)
lxml (3.5.0)
Markdown (3.0.1)
milter (0.8.18)
networkx (2.2)
numpy (1.17.4)
Pillow (3.1.2)
pip (8.1.1)
protobuf (3.9.1)
pybind11 (2.4.3)
pycparser (2.19)
pycurl (7.43.0)
pydot (1.4.1)
pygobject (3.20.0)
pylint (1.5.2)
pymilter (1.0.4)
pyOpenSSL (19.0.0)
pyparsing (2.0.3)
pysaml2 (4.7.0)
python-apt (1.1.0b1+ubuntu0.16.4.8)
python-dateutil (2.4.2)
python-debian (0.1.27)
python-systemd (231)
pytz (2014.10)
PyYAML (5.1.2)
requests (2.9.1)
s3transfer (0.2.1)
scipy (1.4.1)
setuptools (20.7.0)
six (1.10.0)
smart-open (1.8.4)
ssh-import-id (5.5)
tensorboard (1.14.0)
tensorflow (1.14.0)
tensorflow-estimator (1.14.0)
termcolor (1.1.0)
threadpool (1.3.2)
ufw (0.35)
unattended-upgrades (0.1)
urllib3 (1.13.1)
virtualenv (15.0.1)
Werkzeug (0.14.1)
wheel (0.29.0)
wrapt (1.8.0)
You are using pip version 8.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

"You can safely ignore the warning. It does a test to see if the file is in TensorFlow format, sees that it isn't, and loads using HDF5."

es tenyleg, nekem is kiirja, csak a sok warning kozt nem tunt fel:

root:/home/deepspam# ./deepspam3.py
2020-04-22 12:46:53.876370: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-04-22 12:46:53.876433: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-04-22 12:46:53.876440: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
Loading Model...
2020-04-22 12:46:54.300237: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-04-22 12:46:54.300269: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2020-04-22 12:46:54.300285: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (mkhlnx2): /proc/driver/nvidia/version does not exist
2020-04-22 12:46:54.300417: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-04-22 12:46:54.321711: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3792000000 Hz
2020-04-22 12:46:54.322503: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5a8e040 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-04-22 12:46:54.322535: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-04-22 12:46:54.327174: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1024001024 exceeds 10% of system memory.
2020-04-22 12:46:54.617031: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1024001024 exceeds 10% of system memory.
2020-04-22 12:46:54.698717: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1024001024 exceeds 10% of system memory.
2020-04-22 12:46:54.893580: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/model.weights: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
2020-04-22 12:46:55.517441: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1024001024 exceeds 10% of system memory.
MODEL loaded! (1000000 words)
initing MSS
initing SSS ->  1      ('192.168.90.10', 44946)
initing SSS ->  2      ('192.168.90.10', 44948)
freeing SSS ->   1   time: 13.153
__del__ called!     processed: 0 (0.000)  from: 45.142.195.3
freeing SSS ->   0   time: 13.038
__del__ called!     processed: 0 (0.000)  from: 45.142.195.3

 

ez egy ubi 16, de frissebb tensorflow:

Python 3.5.2 (default, Oct  8 2019, 13:06:37)

Package              Version
-------------------- ----------------------
absl-py              0.9.0
astor                0.8.1
cachetools           4.1.0
certifi              2020.4.5.1
chardet              3.0.4
click                6.2
colorama             0.3.7
command-not-found    0.3
configobj            5.0.6
gast                 0.2.2
google-auth          1.14.0
google-auth-oauthlib 0.4.1
google-pasta         0.2.0
grpcio               1.28.1
h5py                 2.10.0
idna                 2.9
Keras-Applications   1.0.8
Keras-Preprocessing  1.1.0
language-selector    0.1
Markdown             3.2.1
numpy                1.18.3
oauthlib             3.1.0
opt-einsum           3.2.1
pip                  20.0.2
prompt-toolkit       0.57
protobuf             3.11.3
pyasn1               0.4.8
pyasn1-modules       0.2.8
pycrypto             2.6.1
pycurl               7.43.0
Pygments             2.1
pygobject            3.20.0
PyMySQL              0.7.2
python-apt           1.1.0b1+ubuntu0.16.4.8
python-debian        0.1.27
python-systemd       231
requests             2.23.0
requests-oauthlib    1.3.0
rsa                  4.0
scipy                1.4.1
setuptools           46.1.3
six                  1.14.0
sqlparse             0.1.18
ssh-import-id        5.5
tensorboard          2.1.1
tensorflow           2.1.0
tensorflow-estimator 2.1.0
termcolor            1.1.0
ufw                  0.35
unattended-upgrades  0.1
urllib3              1.25.9
wcwidth              0.1.6
Werkzeug             1.0.1
wheel                0.29.0
wrapt                1.12.1

most kezdtem el tesztelgetni de eddig majdnem mindenre fals pozitivat adott (egy olyan mailfiókra vettem fel amivel feliratkoztam egy csomó publik hirlevélre).

 

kezdve az első felvettem a fiókot outlookba és az küld egy teszt levelet:

X-deepspam: spam 100%
 

microsoft hirlevél:

X-deepspam: maybespam 95%
 

qatar hirlevél:

X-deepspam: spam 100%
 

vajon mit nézek be?

Azért ezt a fp problémát többen említettük már. Alapvetően a hírlevél hasznos, a kéretlen levél a probléma.

Volt egy érdekes beszélgetésem egy cégnél, hogy nekik úgy kéne szűrni a leveleket, hogy ... nekem spam, de kolléganőnek fontosak. De ott alapvetően a közös és átgondolatlan fiókok miatt is van gond.

mivel ez a level szoveget elemzi, nem tudhatja hogy te szandekosan iratkoztal fel ra, vagy csak ugy kapod...  mivel tartalmilag nagyon hasonlit a spam-ekre, annak pontozza.  amire feliratkoztal azt whitelisteljed es kesz. a gmail is spamba rakja ezeket...

nagyon nehez definialni mi a kulonbseg a bulk email es a spam kozott - ahogy fentebb is irtak, van akinek ez van akinek az. nezopont kerdese.

vannak url whitelistek is, spamassassinbe be lehet allitani, es akkor a megbizhato hirlevel kuldoket lepontozza.

masik lehetoseg, hogy tanitasz sajat modelt, nem muszaj az enyemet hasznalni. ott vannak a toolok hozza, lehet sajatot epiteni, mondjuk eros vas kell hozza (cuda gpu ajanlott, de anelkul is lefut par nap alatt).  maildedup2.py megcsinalja az unix mailboxbol a tokenizalt .txt-t, ezt lefuttatod kulon a ham es a spam minta mappadon. aztan a 2 txt-t beadod (data/mail.pos+.neg) a keras4_emb.py-nak, az eloallitja a modelt. ha reszletesebben erdekel valakit szoljon, gyartok majd leirast rola, annyira nem trivialis, de nem is tul bonyolult.

A'rpi

Mitől neurális?

READY.
󠀠󠀠‎‏‏‎▓

Tegnap talaltam 2 problemat/hibat:

1. a refactoring soran bekerult v0.6 kornyeken egy 'minlen' parameter a tokenizaloba, es ennek a szurohoz nem jo a default erteke -> emiatt a 4 betunel rovidebb szavakat nem szamolta. altalaban nem okoz gondot, mert azok foleg kotoszavak, nevelok, de nagyon rovid leveleknel, mint  pl az outlook tesztlevele az is szamit. ezt kell atirni 'minlen=1'-re:

eml2token.py:  def tokenize(s,vocab,minlen=4):

2. decemberben megfigyeltem, hogy (majdnem) ugyanarra a tartalmu levelre is eltero eredmenyt adhat a szuro, es csak a megszolitas/nev tert el a levelek tartalmaban. valoszinuleg megtanulta, hogy bizonyos nevek sokkal jellemzobbek a spam levelekre :)  (bizonyos nevu userek sok spamet kapnak, es igy a tanitashoz hasznalt datasetben felulreprezentaltak)

ezert akkor beraktam egy nev listat, az angol es magyar kereszt- es vezeteknevekkel, hogy ezeket ne vegye figyelembe, de mint most kiderult, olyan "nevek" is vannak a listaban, mint 'bank' vagy pl. 'minden', foleg az angolok neveznek el embereket gyakorlatilag barmirol, igy az a lista tele van baromsagokkal, de a magyarban is van pl. 'kis' meg 'nagy' ugye... ezt most egyelore kivettem, majd at kell nezni kezzel a listat es a csak nevkent, mas jelentessel nem birokat meghagyni, de ez rohadt sok melo lesz...

http://thot.banki.hu/deepspam/w2v-models/nevek_freq.txt

ezekkel korrigalva, valamint az aprilisi mintakkal kiegeszitve generaltam egy uj modelt, lehet tesztelni:

http://thot.banki.hu/deepspam/model_v8-teszt/

a 193.224.38.187:1080 milteren mar ez megy, minlen=1 parameterrel. az outlook teszteket mar jol pontozza :)

Szerkesztve: 2022. 02. 06., v – 15:53

deepspam-milter v0.9 released :)

http://thot.banki.hu/deepspam/deepspam-milter-v0.9.tgz

http://thot.banki.hu/deepspam/model-v90.tgz

A kodban nem tortent jelentos valtozas (reszletek a changelogban), inkabb csak a tensorflow 2.x support miatt, meg par fix.

Viszont van hozza uj model is (de mukodik a 8.2-vel is, amit masfel eve hasznalunk, es nagyon ritkan hibazik), a spam mintak teljesen ujra lettek valogatva es konvertalva, bovitve az elmult masfel ev termesevel, es a ham "tananyag" is bovult kb 50%-al:

    42737 mail.neg
    84141 mail.pos
   126878 total

kb 1 hete megy a 9.0-as model, eddig jonak tunik, es az osszehasonlito teszten is alig volt elteres a 8.2-tol, az is jo iranyba!

(tavaly vagy 100 uj modelt generaltam kulonbozo inputokbol es beallitasokkal, de egyik sem erte el a 8.2-es minoseget sem, gyanus hogy valami TF2/cuda bug miatt, mert ez mar az ubi/cuda frissites utan volt, es sokszor mar a tanitas kozben elszallt az egesz - most ujra frissitettem mindent es azota jonak tunik)

emellett mar masfel eve dolgozom egy teljesen uj verzion, honapokig tanitott cross-language word2vec modellekkel, de sajnos ez meg mindig nincs kesz... talan nyaron lesz idom befejezni :)

Most csinálok egy új mail szervert, gondoltam újra előveszem tesztelni, mert egy régebbi verzió elég jól teljesített, de sajna nem elérhető.

Végleg behalt a project? Esetleg az új verzió? Valahol elérhető még a régi?

„Az összeomlás elkerülhetetlen, a katasztrófa valószínű, a kihalás lehetséges.” (Jem Bendell)

Szerkesztve: 2024. 03. 29., p – 05:29

-

„Az összeomlás elkerülhetetlen, a katasztrófa valószínű, a kihalás lehetséges.” (Jem Bendell)