Compare commits

..

10 commits

Author SHA1 Message Date
Adam
138f382670 use ensurepip to ensure pip 2023-05-04 18:18:22 -04:00
Adam
63c9ed6946 add missing req 2023-04-21 19:49:53 -04:00
Adam
d2e7c885ac add share/ 2023-04-10 16:41:08 -04:00
Adam
0bc9a6ec82 yes 2023-03-03 13:49:19 -05:00
Adam
51e20ae01e cartman moved 2023-02-09 09:50:21 -05:00
Adam
faafd258a3 wake up, eric 2022-12-30 22:30:16 -05:00
Adam
faa542aca4 nlp stuff 2022-12-21 15:56:25 -05:00
Adam
fe187ba59e stuff 2022-12-12 21:26:31 -05:00
Adam
9a496e1c8f get with the times 2022-11-06 02:55:37 -05:00
Adam
a75eb093c2 more cleanup 2022-10-09 18:25:06 -04:00
16 changed files with 968 additions and 531 deletions

10
.gitignore vendored
View file

@ -1,3 +1,7 @@
.sekrit/
__pycache__/
*/__pycache__/
.sekrit
pyvenv.cfg
__pycache__
bin/
lib/
share/

210
data/aclist Normal file
View file

@ -0,0 +1,210 @@
Howard Is Bald
Bald To The Bone
A Conversation With Howard Wulkan
Ballad Of Baldness
Howard Wulkan Is Bald (Acoustic & Jazz Versions)
Night On Bald Moutain
You Should Be Balding
If I Can't Have Hair
Howard Wulkan (Wesley Willis Version)
Shut Up Mike, Pt.2
Art Fag
It, You're A Metal Band
Punching Joe Bonni's Face In
Kill Women
Steroids Guy
Everyone In Allston Should Be Killed
I Noticed That You're Gay
Dead, Gay And Dropped
You Look Divorced
I Hope You Get Deported
Mike Mahan Has Gingivitis
Trapped
You're A Fucking Cunt
Phyllis Is An Old Annoying Cunt
A1 Stankus Is Always On The Phone With His Bookie
Bill Scott's Dumb
Harvey Korman Is Gay
You Fucking Break
Theme From Three Company
Jeanine Jizm Is A Freak
Everyone In Anal Cunt Is Dumb
I Just Saw The Gayest Guy On Earth
Johnny Violent Getting His Ann Kicked By Morrisey
Metamorphosis
I'm Sick Of You
Howard Wulkan's Bald
You're A Tready Fucking Pussy
Tom Arnold
I Got Athletes Foot Showering At Mike's
Big Pasts. Bigger Loser
Marc Payson Is A Drunk
Your Family Is Dumb
Furnace
You're Dumb
Van Full Of Retards
Deche Charge Are A Bunch Of Fucking Losers
Everyone In The Underground Music Scene Is Stupid
Dumb, Fat and Gross
I'm Not Stubborn
Mike Manan's Story
02657
Gloves Of Metal
Bonus Track
Jack Kevorkian Is Cool
Valujet
You've Got No Friends
You Keep A Diary
You Own A Store
You Got Date Raped
Recycling Is Gay
You're A Cop
You Can't Shut Up
You've Got Cancer
We Just Disagree
Hungry Hungry Hippos
You Are An Interior Decorator
Pottery's Gay
Rich Goyette Is Gay
Branscombe Richmond
You Live In Allston
You Are A Good Food Critic
Just The Two Of Us
Your Band's In The Cut-Out Bin
You're Gay
You Look Adopted
Your Cousin Is George Lynch
You Have Goals
You Drive An Iroc
You Play On A Softball Team
Because You're Old
You Sell Cologne
Being A Cobbler Is Dumb
You Live In A Houseboat
Richard Butler
311 Sucks
Your Kid Is Deformed
You Are An Orphan
You're Old (Fuck You)
You Go To Art School
You're Best Friend Is You
You're In A Coma
Windchimes Are Gay
No, We Don't Want To Do A Split 7" With Your Stupid Fucking Band
Reni Auberjonois
Internet Is Gay
Ha, Ha Your Wife Left You
Hootie And The Blowfish
You Went To See Dishwalla And Everclear (You're Gay)
Locking Drop Dead In McDonalds
Technology's Gay
Your Favorite Band Is Supertramp
I'm In Anal Cunt
You (Fill In The Blank)
Kyle From Incantation Has A Mustache
Bonus Track #3
Picnic Of Love
I Respect Your Feelings As A Woman And A Human
I Wanna Grow Old With You
Saving Ourselves For Marriage
Greed Is Something That We Don't Need
I'm Not That Kind Of Boy
I Couldn't Afford To Buy You A Present (So I Wrote You This Song)
I'd Love To Have Your Daughter's Hand In Marriage
My Woman, My Lover, My Friend
Waterfall Wishes
In My Heart There's A Star Named After You
I Became A Counselor So I Could Tell Rape Victims They Asked For It
Easy E. Got A.I.D.S. From F. Mercury
I Like Drugs And Child Abuse
Laughing When Leonard Peltier Gets Raped In Jail
I Convinced You To Beat Your Wife On A Daily Basis
I Sent Concentration Camp Footage To Americas Funniest Home Videos
Rancid Sucks (And The Clash Sucked Too)
I Paid J. Howell To Rape You
I Pushed Your Wife In Front Of The Subway
Extreme Noise Terror Is Afraid Of Us
You Rollerblading Faggot
I Sent A Thankyou Card To The Guy That Raped You
I Lit Your Baby On Fire
Body By Auschwitz
I Intentionally Ran Over Your Dog
Sweatshops Are Cool
Woman, Nature's Punching Bag
I Snuck A Retard In To A Sperm Bank
Your Kid Committed Suicide Because You Suck
I Ate Your Horse
Hitler Was A Sensitive Man
You Robbed A Sperm Bank Because You're A Cum Guzzling Fag
I Made Your Kid Get AIDS, So You Could Watch It Die
I Fucked Your Wife
Into The Oven
I Gave Nambla Pictures Of You Kid
The Only Reason Men Talk To You Is Because They Want To Get Laid, You Stupid Fucking Cunt
I Made Fun Of You Because Your Kid Just Died
Domestic Violence Is Really Really Really Funny
Dictators Are Cool
Deadbeat Dads Are Cool
I'm Really Excited About The Upcoming David Buskin Concert
Being Ignorant Is Awesome
You're Pregnant, So I Kicked You In The Stomach
Chris Barnes Is A Pussy
Tim Is Gay
B.T./A.C.
I Sold Your Dog To A Chinese Restaurant
I Got An Office Job For The Sole Purpose Of Sexually Harassing Women
split: "ANAL CUNT / THE RAUNCHOUS BROTHERS" (2000)
The Guy Who Shot His Kid Up With A.I.D.S. Is Awesome
I Went Back In Time A Voted For Hitler
Hogging Up The Holocaust
I'm Hitler
split: "ANAL CUNT / FLACHENBRAND" (2001)
Anyone Who Likes The Dillinger Escape Plan Is A Faggot
I'm Glad You Got Breast Cancer, Cunt
The South Won't Rise Again
I'm Glad Jazz Faggots Don't Like Us Anymore
Bonus Track #5
7": "Defenders Of The Hate" (2001)
All Our Fans Are Gay
Limp Bizkit Think They're Black, But They're Just Gay
You Were Too Ugly To Rape, So I Just Beat The Shit Out Of You
Hebosaurus
Even Though You're Culture Oppresses Women, You Sill Suck You Fucking Towelhead
If You Don't Like The Village People, You're Fucking Gay
Obviously Adopted
Walker, Texas Corpse
The Word Homophobic Is Gay
You Converted To Judaism So A Guy Would Touch Your Dick
Bonus Track #4
You Quit Doing Heroin, You Pussy
Fred Shitbreath
Beating Up Hippies For Their Drugs At A Phish Concert
Anyone Who Likes The Dillinger Escape Plan Is A Faggot
Im Glad You Got Breast Cancer, Cunt
The South Wont Rise Again
Im Glad Jazz Faggots Dont Like Us Anymore
Bonus Track #5
Ha Ha Holocaust
Were Not In Da House You Fucking Wigger
Fuck Yeah!
Cranking My Band's Demo On A Box At The Beach
Loudest Stereo
Kicking Your Ass And Fuckin' Your Bitch
Hot Girls On The Road
Whiskey, Coke And Sluts
All I Give A Fuck About Is Sex
I'm Gonna Give You A.I.D.S.
Yay! It's Pink!
I Wish My Dealer Was Open
EP: "Wearing Out Our Welcome" (2011)
Beating Up Niggers That Sell Fake Crack
One Man Ghetto
Cop Calling Faggot
Tsunasum
Get On Your Knees, Cunt
Don't Offer Me Weak Drugs Or I'll Kick Your Fucking Ass
Wearing Out Our Welcome
Nothings Offensive Anymore
Wasting Time Writing Anal Cunt Songs
Caring About Anything Is Gay
We Are Anal Cunt

473
data/limericks Normal file
View file

@ -0,0 +1,473 @@
Limericks I cannot compose,
With noxious smells in my nose.
But this one was easy,
I only felt queasy,
Because I was sniffing my toes.
%
There was a young woman named Bright,
Whose speed was much faster than light.
She set out one day,
In a relative way,
And returned on the previous night.
%
There was an odd fellow named Gus,
When traveling he made such a fuss.
He was banned from the train,
Not allowed on a plane,
And now travels only by bus.
%
There once was a fly on the wall,
I wonder, why didnt it fall?
Because its feet stuck? Or was it just luck?
Or does gravity miss things so small?
%
There once was a man from Tibet,
Who couldnt find a cigarette
So he smoked all his socks,
and got chicken-pox,
and had to go to the vet.
%
There was a young woman named Bright,
Whose speed was much faster than light.
She set out one day,
In a relative way,
And returned on the previous night.
%
I need a front door for my hall,
The replacement I bought was too tall.
So I hacked it and chopped it,
And carefully lopped it,
And now the dumb thing is too small
%
There once was a boy named Dan,
who wanted to fry in a pan.
He tried and he tried,
and eventually died,
that weird little boy named Dan.
%
A newspaperman named Fling,
Could make “copy” from any old thing.
But the copy he wrote,
Of a five-dollar note,
Was so good he now wears so much bling.
%
I know an old owl named Boo,
Every night he yelled Hoo,
Once a kid walked by,
And started to cry,
And yelled I dont have a clue!
%
I once fell in love with a blonde,
But found that she wasnt so fond.
Of my pet turtle named Odle,
whom Id taught how to Yodel,
So she dumped him outside in the pond.
%
Id rather have Fingers than Toes,
Id rather have Ears than a Nose.
And as for my Hair,
Im glad its all there,
Ill be awfully sad, when it goes.
%
There was a Young Lady whose chin
Resembled the point of a pin:
So she had it made sharp,
And purchased a harp,
And played several tunes with her chin. (Edward Lear)
%
Hickory Dickory dock,
the mouse ran up the clock;
the clock struck one
and down he run;
hickory Dickory dock. (Charles Perrault)
%
There was a faith-healer of Deal,
Who said: “Although pain isnt real,
If I sit on a pin
And it punctures my skin,
I dislike what I fancy I feel.
%
My dog is really quite hip,
Except when he takes a cold dip.
He looks like a fool,
when he jumps in the pool,
and reminds me of a sinking ship.
%
A painter, who lived in Great Britain,
Interrupted two girls with their knitting,
He said, with a sigh,
That park benchwell I,
Just painted it, right where youre sitting.
%
There is a young schoolboy named Mason,
Whose mom cuts his hair with a basin.
When he stands in one place,
With a scarf round his face,
Its a mystery which way hes facing.
%
There was a young schoolboy of Rye,
Who was baked by mistake in a pie.
To his mothers disgust,
He emerged through the crust,
And exclaimed, with a yawn, Where am I?
%
An elderly man called Keith,
Mislaid his set of false teeth.
Theyd been laid on a chair,
Hed forgot they were there,
Sat down, and was bitten beneath.
%
There was an old man of Peru,
Who dreamt he was eating his shoe.
He woke in the night,
With a terrible fright,
And found it was perfectly true.
%
The incredible Wizard of Oz,
Retired from his business becoz.
Due to up-to-date science,
To most of his clients,
He wasnt the Wizard he woz.
%
Once I visited France,
And learned a new, awesome dance.
I twirled,
And I swirled,
And Is it me or the nature of money,
Thats odd and particularly funny.
But when I have dough,
It goes quickly, you know,
And seeps out of my pockets like honey.
I lost my pants.
%
Is it me or the nature of money,
Thats odd and particularly funny.
But when I have dough,
It goes quickly, you know,
And seeps out of my pockets like honey.
%
There once was a farmer from Leeds,
Who swallowed a packet of seeds.
It soon came to pass,
He was covered with grass,
But has all the tomatoes he needs.
%
A fellow jumped off a high wall,
And had a most terrible fall.
He went back to bed,
With a bump on his head,
Thats why you dont jump off a wall.
%
A man and his lady-love, Min,
Skated out where the ice was quite thin.
Had a quarrel, no doubt,
For I hear they fell out,
What a blessing they didnt fall in!
%
There was a young lady of Cork,
Whose Pa made a fortune in pork.
He bought for his daughter,
A tutor who taught her,
To balance green peas on her fork.
%
There once was a Martian called Zed
With antennae all over his head.
He sent out a lot
Di-di-dash-di-dot
But nobody knew what he said!
%
There once was a girl named Sam
Who did not eat roast beef and ham
She ate a green apple
Then drank some Snapple
Some say she eats like a lamb.
%
Said the man with a wink of his eye
But I love you and then the reply
From the girl, it was heard
You are truly absurd!
I have only this moment walked by!
%
A wonderful bird is the Pelican.
His beak can hold more than his belly can.
He can hold in his beak
Enough food for a week!
But Ill be darned if I know how the hellican?
%
There was once a great man in Japan
Whose name on Tuesday began,
It lasted through Sunday
Till twilight on Monday
And it sounded like stones in a can.
%
There was a young man so benighted
He never knew when he was slighted;
He would go to a party
And eat just as hearty,
As if hed been really invited.
%
There was an old man from Sudan,
Whose limericks never would scan.
When told this was so,
He said, yes, I know.
But I always try to get as many syllables into the last line as I possibly can.
%
A maiden at college, Miss Breeze,
Weighed down by B.A.s and Lit.Ds,
Collapsed from the strain,
Said her doctor, “Its plain
You are killing yourself—by degrees!”
%
A canner, exceedingly canny,
One morning remarked to his granny,
“A canner can can
Anything that he can;
But a canner cant can a can, can he?”
%
A mouse in her room woke Miss Dowd
She was frightened—it must be allowed.
Soon a happy thought hit her—
To scare off the critter,
She sat up in bed and meowed.
%
There was a young woman named Kite,
Whose speed was much faster than light,
She set out one day,
In a relative way,
And returned on the previous night.
%
A flea and a fly in a flue,
Were imprisoned, so what could they do?
Said the fly, “Let us flee!”
“Let us fly,” said the flea,
And they flew through a flaw in the flue.
%
A major, with wonderful force,
Called out in Hyde Park for a horse.
All the flowers looked round,
But no horse could be found;
So he just rhododendron, of course.
%
A nifty young flapper named Jane
While walking was caught in the rain.
She ranalmost flew,
Her complexion did too,
And she reached home exceedingly plain.
%
“Theres a train at 4:04,” said Miss Jenny.
“Four tickets Ill take; have you any?”
Said the man at the door,
“Not four for 4:04,
For four for 4:04 is too many.”
%
A canny young fisher named Fisher
Once fished from the edge of a fissure.
A fish with a grin
Pulled the fisherman in—
Now theyre fishing the fissure for Fisher.
%
Heres to the chigger,
The bug thats no bigger
Than the point of an undersized pin;
But the welt that he raises
Sure itches like blazes,
And thats where the rub comes in!
%
A cheerful old bear at the Zoo
Could always find something to do.
When it bored him, you know,
To walk to and fro,
He reversed it and walked fro and to.
%
The bottle of perfume that Willie sent
Was highly displeasing to Millicent;
Her thanks were so cold
They quarreled, Im told,
Through that silly scent Willie sent Millicent.
%
I bought a new Hoover today,
Plugged it in in the usual way,
Switched it on what a din;
It sucked everything in,
Now Im homeless with no place to stay.
%
A crossword compiler named Moss
Who found himself quite at a loss
When asked, Why so blue?
Said, I havent a clue
Im 2 Down to put 1 Across.
%
Im papering walls in the loo
And quite frankly I havent a clue;
For the patterns all wrong
(Or the papers too long)
And Im stuck to the toilet with glue.
%
There once was an old man of Esser,
Whose knowledge grew lesser and lesser,
It at last grew so small
He knew nothing at all
And now hes a college professor.
%
To compose a sonata today,
Dont proceed in the old-fashioned way:
With your toes on the keys,
Bang the floor with your knees:
“Oh how modern!” the critics will say.
%
There was a young lady named Perkins,
Who just simply doted on gherkins.
In spite of advice,
She ate so much spice,
That she pickled her internal workins.
%
There was an old man of Nantucket
Who kept all his cash in a bucket;
But his daughter, named Nan
Ran away with a man —
And as far as the bucket, Nantucket.
%
There was a young lady of Kent,
Whose nose was most awfully bent.
She followed her nose
One day, I suppose —
And no one knows which way she went.
%
There was a young lady named Hannah,
Who slipped on a peel of banana.
As she lay on her side,
More stars she espied
Than there are in the Star-Spangled Banner.
%
There was a dear lady of Eden,
Who on apples was quite fond of feedin;
She gave one to Adam,
Who said, “Thank you, Madam,”
And then both skedaddled from Eden.
%
A certain young fellow named Bee-Bee
Wished to wed a woman named Phoebe.
“But,” he said, “I must see
What the clerical fee
Be before Phoebe be Phoebe Bee-Bee
%
Remember when nearly sixteen
On your very first date as a teen
At the movies? If yes,
Then I bet you cant guess
What was shown on the cinema screen.
%
There was an old person of Fratton
Who would go to church with his hat on.
If I wake up, he said,
With a hat on my head,
I will know that it hasnt been sat on.
%
My neighbor came over to say
(Although not in a neighborly way)
That hed knock me around
If I didnt curb the sound
Of the classical music I play.
%
I told him, “Get out of my place
Youre an utter uncultured disgrace;
Youre a simpleton loon.
Dont you know a good tune?”
Then he walloped me square in the face.
%
There was a young man from Dealing
Who caught the bus for Ealing.
It said on the door
Dont spit on the floor
So he jumped up and spat on the ceiling
%
As 007 walked by
He heard a wee spider say, “Hi.”
But shaken, he shot
It right there on the spot
As it tried to explain, “Im a spi …”
%
A tutor who tooted the flute
Tried to tutor two tooters to toot
Said the two to the tutor
“Is it tougher to toot or
To tutor two tooters to toot?”
%
No woodsman would cut a wood, would he
If woods would be woodless nor should he.
Yet no woodcutter would
Cut a woody-wood wood
If no woodsmen cut woody woods, would he?
%
There once was a man from the sticks
Who loved to compose limericks
But he failed at his sport
They were always too short
Parade Daily
Celebrity interviews, recipes and health tips delivered to your inbox.
%
A poet whose friends called him Steve
Once showed quite a will to achieve
His skill grew so strong
That his poems grew long
And he sadly was forced to abbrev.
%
If you catch a chinchilla in Chile
And cut off its beard, willy-nilly
You can honestly say
That you have just made
A Chilean chinchillas chin chilly
%
There once was a man named Muvett
Who lived in the city of Lovett
But his car broke down
Two miles out of town
And Muvett had to shove it to Lovett!
%
There once was a beautiful nurse
Who carried an ugly old purse
But she tripped on the door
And fell on the floor
And they both went away in the hearse.
%
There was a young girl from Flynn
Who was so terribly thin
When she sipped lemonade
Through a straw in the shade
She slipped through the straw and fell in!
%
There once was a man from Gorem
Had a pair of tight pants and he wore em
When he bowed with a grin
A draft of air rushed in
And he knew by the sound that he tore em!
%
There once was a man from the city
Stooped to pat what he thought was a kitty
He gave it a pat
But it wasnt a cat-
They buried his clothes what a pity!
%
There once was a gal from Decatur
Who went to sing in a the-a-ter
But the poor little thing
When she started to sing
Got hit by a rotten termater! (tomato)
%
What happens when you retire?
You really dont have to inquire
No job and no phone
Theres no place but home,
And your checkbooks about to expire!
%
At times Im so mad that Im hopping.
My angriness sets my veins popping.
I yell and I curse,
With swear words diverse,
But my wife does much worse: she goes shopping
%
One Saturday morning at three,
A cheese mongers shop in Paree.
Collapsed to the ground,
With a thunderous sound,
Leaving only a pile of de brie.

View file

@ -1,11 +1,21 @@
motd ='''
import datetime
import discord
from src.flan import flan_speak
from src.cartman import cartman_speak
from src.twitter import get_tweet
from fortune import fortune
import numpy as np
motd = '''
_ _ ____ ___ _
| | _ _| | ___| __ ) / _ \| |_
| | | | | | | |_ / _ \| | | | __|
| |__| |_| | |___ / /| |_) | |_| | |_
|_____\__,_|_____/___|____/ \___/ \__|
'''
menu ='''```
menu = '''```
Commands:
fortune: tell a fortune
chuck: give a Chuck Norris quote
@ -18,52 +28,68 @@ Commands:
Contribute!
https://github.com/adoyle0/lulzbot```'''
import discord, datetime
import numpy as np
from fortune import fortune
from src.twitter import get_tweet
from src.cartman import cartman_speak
from src.limericks import limerick
chuck_quotes = open('src/chuck_quotes').read().split('\n%\n')
ligma_list = open('src/ligma_list').read().split('\n')
chuck_quotes = open('data/chuck_quotes').read().split('\n%\n')
ligma_list = open('data/ligma_list').read().split('\n')
limericks = open('data/limericks').read().split('\n%\n')
aclist = open('data/aclist').read().split('\n')
def show_menu():
return menu
def musk():
return get_tweet(44196397)
def ligma():
return np.random.choice(ligma_list)
def limerick():
return np.random.choice(limericks)
def prost():
return 'https://tenor.com/view/prost-christoph-waltz-django-bier-zum-wohle-gif-11041516'
def chuck():
return np.random.choice(chuck_quotes)
message_handler = {'lulzbot': show_menu, # these need to be functions
'musk': musk,
'deez': ligma,
'ligma': ligma,
'bofa': ligma,
'bopha': ligma,
'limerick': limerick,
'limrick': limerick,
'prost!': prost,
'fortune': fortune,
'chuck': chuck,
}
def ac():
return np.random.choice(aclist)
triggers = {'lulzbot': show_menu, # these need to be functions
'musk': musk,
'deez': ligma,
'ligma': ligma,
'bofa': ligma,
'bopha': ligma,
'limerick': limerick,
'limrick': limerick,
'prost!': prost,
'fortune': fortune,
'chuck': chuck,
'ac': ac,
}
TOKEN = open('.sekrit/discord_token').read()
client = discord.Client(activity=discord.Game(name='with myself'))
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(activity=discord.Game(
name='with myself'), intents=intents)
@client.event
async def on_ready():
print(motd+'\n'+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+'\nLogged in as {0.user}'.format(client))
print(motd+'\n'+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') +
'\nLogged in as {0.user}'.format(client))
return
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
@ -75,12 +101,16 @@ async def on_message(message):
return
elif message.channel.name == 'cartman':
async with message.channel.typing():
await message.channel.send(cartman_speak(user_message))
await message.channel.send(cartman_speak(user_message))
# await message.channel.send("I'm broken, come back later.")
elif message.channel.name == 'flan':
await message.channel.send(flan_speak(user_message))
# await message.channel.send('GPU is busy, come back later')
elif message.channel.name == 'shitposting':
if user_message in message_handler:
await message.channel.send(message_handler[user_message]())
if user_message.lower() in triggers:
await message.channel.send(triggers[user_message.lower()]())
return
client.run(TOKEN)

7
requirements.txt Normal file
View file

@ -0,0 +1,7 @@
discord
numpy
fortune-python
tweepy
transformers
torch
bitsandbytes

7
run Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
source bin/activate &&
python -m ensurepip &&
pip install --upgrade -r requirements.txt &&
clear &&
python lulzbot.py

View file

@ -1,22 +1,40 @@
from transformers.models.auto.tokenization_auto import AutoTokenizer
from transformers.models.auto.modeling_auto import AutoModelForCausalLM
import torch
from transformers.models.auto.tokenization_auto import AutoTokenizer
import requests
import json
tokenizer = AutoTokenizer.from_pretrained('microsoft/DialoGPT-large')
model = AutoModelForCausalLM.from_pretrained('../southpark/output-medium')
url = 'https://doordesk.net/chat'
def cartman_speak(user_message):
new_user_input_ids = tokenizer.encode(user_message + tokenizer.eos_token, return_tensors='pt')
bot_output = new_user_input_ids
bot_input_ids = torch.cat([new_user_input_ids, bot_output])
bot_output = model.generate(
bot_input_ids, max_length= 200,
def cartman_respond(user_message):
message = {'Message': user_message}
response = requests.post(url, json.dumps(message))
return response.json().get('Cartman')
tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-medium")
model = AutoModelForCausalLM.from_pretrained(
"../cartman/train/cartman/models/output-medium-3ep")
def cartman_speak(input_text):
input_ids = tokenizer(input_text + tokenizer.eos_token,
return_tensors="pt").input_ids
outputs = model.generate(
input_ids,
pad_token_id=tokenizer.eos_token_id,
max_new_tokens=200,
num_beams=8,
num_beam_groups=4,
no_repeat_ngram_size=3,
do_sample=True,
top_k=100,
top_p=0.7,
temperature=.8
)
length_penalty=1.4,
diversity_penalty=0,
repetition_penalty=2.1,
early_stopping=True,
return '{}'.format(tokenizer.decode(bot_output[:,bot_input_ids.shape[-1]:][0], skip_special_tokens=True))
# do_sample = True,
# top_k = 100,
# top_p = 0.7,
# temperature = 0.8,
)
return tokenizer.decode(outputs[:, input_ids.shape[-1]:][0], skip_special_tokens=True)

38
src/flan.py Normal file
View file

@ -0,0 +1,38 @@
import torch
from transformers.models.t5.tokenization_t5_fast import T5TokenizerFast
from transformers.models.t5.modeling_t5 import T5ForConditionalGeneration
tokenizer = T5TokenizerFast.from_pretrained("google/flan-t5-xl")
device = torch.device('cuda')
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl")
model = model.to(device)
def flan_speak(user_message):
input_ids = tokenizer(user_message, return_tensors='pt').input_ids.to('cuda')
user_input_word_count = len(user_message.split(' '))
if user_input_word_count * user_input_word_count > 100:
min_tokens = 100
else:
min_tokens = user_input_word_count * 2
bot_output = model.generate(
input_ids,
# min_length = min_tokens,
max_new_tokens = 350,
num_beams = 16,
num_beam_groups = 8,
no_repeat_ngram_size = 3,
length_penalty = 1.4,
diversity_penalty = 0.0,
repetition_penalty = 2.1,
early_stopping = True,
# do_sample = True,
# top_k = 256,
# top_p = 0.92,
# temperature = 0.4,
)
output = tokenizer.batch_decode(bot_output, skip_special_tokens=True)[0]
return output[:2000]

View file

@ -1,479 +0,0 @@
import numpy as np
def limerick():
limericks = [
'Limericks I cannot compose,\n\
With noxious smells in my nose.\n\
But this one was easy,\n\
I only felt queasy,\n\
Because I was sniffing my toes.',
\
'There was a young woman named Bright,\n\
Whose speed was much faster than light.\n\
She set out one day,\n\
In a relative way,\n\
And returned on the previous night.',
\
'There was an odd fellow named Gus,\n\
When traveling he made such a fuss.\n\
He was banned from the train,\n\
Not allowed on a plane,\n\
And now travels only by bus.',
\
'There once was a fly on the wall,\n\
I wonder, why didnt it fall?\n\
Because its feet stuck? Or was it just luck?\n\
Or does gravity miss things so small?',
\
'There once was a man from Tibet,\n\
Who couldnt find a cigarette\n\
So he smoked all his socks,\n\
and got chicken-pox,\n\
and had to go to the vet.',
\
'There was a young woman named Bright,\n\
Whose speed was much faster than light.\n\
She set out one day,\n\
In a relative way,\n\
And returned on the previous night.',
\
'I need a front door for my hall,\n\
The replacement I bought was too tall.\n\
So I hacked it and chopped it,\n\
And carefully lopped it,\n\
And now the dumb thing is too small',
\
'There once was a boy named Dan,\n\
who wanted to fry in a pan.\n\
He tried and he tried,\n\
and eventually died,\n\
that weird little boy named Dan.',
\
'A newspaperman named Fling,\n\
Could make copy from any old thing.\n\
But the copy he wrote,\n\
Of a five-dollar note,\n\
Was so good he now wears so much bling.',
\
'I know an old owl named Boo,\n\
Every night he yelled Hoo,\n\
Once a kid walked by,\n\
And started to cry,\n\
And yelled I dont have a clue!',
\
'I once fell in love with a blonde,\n\
But found that she wasnt so fond.\n\
Of my pet turtle named Odle,\n\
whom Id taught how to Yodel,\n\
So she dumped him outside in the pond.',
\
'Id rather have Fingers than Toes,\n\
Id rather have Ears than a Nose.\n\
And as for my Hair,\n\
Im glad its all there,\n\
Ill be awfully sad, when it goes.',
\
'There was a Young Lady whose chin\n\
Resembled the point of a pin:\n\
So she had it made sharp,\n\
And purchased a harp,\n\
And played several tunes with her chin. (Edward Lear)',
\
'Hickory Dickory dock,\n\
the mouse ran up the clock;\n\
the clock struck one\n\
and down he run;\n\
hickory Dickory dock. (Charles Perrault)',
\
'There was a faith-healer of Deal,\n\
Who said: Although pain isnt real,\n\
If I sit on a pin\n\
And it punctures my skin,\n\
I dislike what I fancy I feel.',
\
'My dog is really quite hip,\n\
Except when he takes a cold dip.\n\
He looks like a fool,\n\
when he jumps in the pool,\n\
and reminds me of a sinking ship.',
\
'A painter, who lived in Great Britain,\n\
Interrupted two girls with their knitting,\n\
He said, with a sigh,\n\
That park benchwell I,\n\
Just painted it, right where youre sitting.',
\
'There is a young schoolboy named Mason,\n\
Whose mom cuts his hair with a basin.\n\
When he stands in one place,\n\
With a scarf round his face,\n\
Its a mystery which way hes facing.',
\
'There was a young schoolboy of Rye,\n\
Who was baked by mistake in a pie.\n\
To his mothers disgust,\n\
He emerged through the crust,\n\
And exclaimed, with a yawn, Where am I?',
\
'An elderly man called Keith,\n\
Mislaid his set of false teeth.\n\
Theyd been laid on a chair,\n\
Hed forgot they were there,\n\
Sat down, and was bitten beneath.',
\
'There was an old man of Peru,\n\
Who dreamt he was eating his shoe.\n\
He woke in the night,\n\
With a terrible fright,\n\
And found it was perfectly true.',
\
'The incredible Wizard of Oz,\n\
Retired from his business becoz.\n\
Due to up-to-date science,\n\
To most of his clients,\n\
He wasnt the Wizard he woz.',
\
'Once I visited France,\n\
And learned a new, awesome dance.\n\
I twirled,\n\
And I swirled,\n\
And Is it me or the nature of money,\n\
Thats odd and particularly funny.\n\
But when I have dough,\n\
It goes quickly, you know,\n\
And seeps out of my pockets like honey.\n\
I lost my pants.',
\
'Is it me or the nature of money,\n\
Thats odd and particularly funny.\n\
But when I have dough,\n\
It goes quickly, you know,\n\
And seeps out of my pockets like honey.',
\
'There once was a farmer from Leeds,\n\
Who swallowed a packet of seeds.\n\
It soon came to pass,\n\
He was covered with grass,\n\
But has all the tomatoes he needs.',
\
'A fellow jumped off a high wall,\n\
And had a most terrible fall.\n\
He went back to bed,\n\
With a bump on his head,\n\
Thats why you dont jump off a wall.',
\
'A man and his lady-love, Min,\n\
Skated out where the ice was quite thin.\n\
Had a quarrel, no doubt,\n\
For I hear they fell out,\n\
What a blessing they didnt fall in!',
\
'There was a young lady of Cork,\n\
Whose Pa made a fortune in pork.\n\
He bought for his daughter,\n\
A tutor who taught her,\n\
To balance green peas on her fork.',
\
'There once was a Martian called Zed\n\
With antennae all over his head.\n\
He sent out a lot\n\
Di-di-dash-di-dot\n\
But nobody knew what he said!',
\
'There once was a girl named Sam\n\
Who did not eat roast beef and ham\n\
She ate a green apple\n\
Then drank some Snapple\n\
Some say she eats like a lamb.',
\
'Said the man with a wink of his eye\n\
But I love you and then the reply\n\
From the girl, it was heard\n\
You are truly absurd!\n\
I have only this moment walked by!',
\
'A wonderful bird is the Pelican.\n\
His beak can hold more than his belly can.\n\
He can hold in his beak\n\
Enough food for a week!\n\
But Ill be darned if I know how the hellican?',
\
'There was once a great man in Japan\n\
Whose name on Tuesday began,\n\
It lasted through Sunday\n\
Till twilight on Monday\n\
And it sounded like stones in a can.',
\
'There was a young man so benighted\n\
He never knew when he was slighted;\n\
He would go to a party\n\
And eat just as hearty,\n\
As if hed been really invited.',
\
'There was an old man from Sudan,\n\
Whose limericks never would scan.\n\
When told this was so,\n\
He said, yes, I know.\n\
But I always try to get as many syllables into the last line as I possibly can.',
\
'A maiden at college, Miss Breeze,\n\
Weighed down by B.A.s and Lit.Ds,\n\
Collapsed from the strain,\n\
Said her doctor, Its plain\n\
You are killing yourselfby degrees!',
\
'A canner, exceedingly canny,\n\
One morning remarked to his granny,\n\
A canner can can\n\
Anything that he can;\n\
But a canner cant can a can, can he?',
\
'A mouse in her room woke Miss Dowd\n\
She was frightenedit must be allowed.\n\
Soon a happy thought hit her\n\
To scare off the critter,\n\
She sat up in bed and meowed.',
\
'There was a young woman named Kite,\n\
Whose speed was much faster than light,\n\
She set out one day,\n\
In a relative way,\n\
And returned on the previous night.',
\
'A flea and a fly in a flue,\n\
Were imprisoned, so what could they do?\n\
Said the fly, Let us flee!\n\
Let us fly, said the flea,\n\
And they flew through a flaw in the flue.',
\
'A major, with wonderful force,\n\
Called out in Hyde Park for a horse.\n\
All the flowers looked round,\n\
But no horse could be found;\n\
So he just rhododendron, of course.',
\
'A nifty young flapper named Jane\n\
While walking was caught in the rain.\n\
She ranalmost flew,\n\
Her complexion did too,\n\
And she reached home exceedingly plain.',
\
'“Theres a train at 4:04,” said Miss Jenny.\n\
Four tickets Ill take; have you any?\n\
Said the man at the door,\n\
Not four for 4:04,\n\
For four for 4:04 is too many.',
\
'A canny young fisher named Fisher\n\
Once fished from the edge of a fissure.\n\
A fish with a grin\n\
Pulled the fisherman in\n\
Now theyre fishing the fissure for Fisher.',
\
'Heres to the chigger,\n\
The bug thats no bigger\n\
Than the point of an undersized pin;\n\
But the welt that he raises\n\
Sure itches like blazes,\n\
And thats where the rub comes in!',
\
'A cheerful old bear at the Zoo\n\
Could always find something to do.\n\
When it bored him, you know,\n\
To walk to and fro,\n\
He reversed it and walked fro and to.',
\
'The bottle of perfume that Willie sent\n\
Was highly displeasing to Millicent;\n\
Her thanks were so cold\n\
They quarreled, Im told,\n\
Through that silly scent Willie sent Millicent.',
\
'I bought a new Hoover today,\n\
Plugged it in in the usual way,\n\
Switched it on what a din;\n\
It sucked everything in,\n\
Now Im homeless with no place to stay.',
\
'A crossword compiler named Moss\n\
Who found himself quite at a loss\n\
When asked, Why so blue?\n\
Said, I havent a clue\n\
Im 2 Down to put 1 Across.',
\
'Im papering walls in the loo\n\
And quite frankly I havent a clue;\n\
For the patterns all wrong\n\
(Or the papers too long)\n\
And Im stuck to the toilet with glue.',
\
'There once was an old man of Esser,\n\
Whose knowledge grew lesser and lesser,\n\
It at last grew so small\n\
He knew nothing at all\n\
And now hes a college professor.',
\
'To compose a sonata today,\n\
Dont proceed in the old-fashioned way:\n\
With your toes on the keys,\n\
Bang the floor with your knees:\n\
Oh how modern! the critics will say.',
\
'There was a young lady named Perkins,\n\
Who just simply doted on gherkins.\n\
In spite of advice,\n\
She ate so much spice,\n\
That she pickled her internal workins.',
\
'There was an old man of Nantucket\n\
Who kept all his cash in a bucket;\n\
But his daughter, named Nan\n\
Ran away with a man \n\
And as far as the bucket, Nantucket.',
\
'There was a young lady of Kent,\n\
Whose nose was most awfully bent.\n\
She followed her nose\n\
One day, I suppose \n\
And no one knows which way she went.',
\
'There was a young lady named Hannah,\n\
Who slipped on a peel of banana.\n\
As she lay on her side,\n\
More stars she espied\n\
Than there are in the Star-Spangled Banner.',
\
'There was a dear lady of Eden,\n\
Who on apples was quite fond of feedin;\n\
She gave one to Adam,\n\
Who said, Thank you, Madam,\n\
And then both skedaddled from Eden.',
\
'A certain young fellow named Bee-Bee\n\
Wished to wed a woman named Phoebe.\n\
But, he said, I must see\n\
What the clerical fee\n\
Be before Phoebe be Phoebe Bee-Bee',
\
'Remember when nearly sixteen\n\
On your very first date as a teen\n\
At the movies? If yes,\n\
Then I bet you cant guess\n\
What was shown on the cinema screen.',
\
'There was an old person of Fratton\n\
Who would go to church with his hat on.\n\
If I wake up, he said,\n\
With a hat on my head,\n\
I will know that it hasnt been sat on.',
\
'My neighbor came over to say\n\
(Although not in a neighborly way)\n\
That hed knock me around\n\
If I didnt curb the sound\n\
Of the classical music I play.',
\
'I told him, “Get out of my place\n\
Youre an utter uncultured disgrace;\n\
Youre a simpleton loon.\n\
Dont you know a good tune?\n\
Then he walloped me square in the face.',
\
'There was a young man from Dealing\n\
Who caught the bus for Ealing.\n\
It said on the door\n\
Dont spit on the floor\n\
So he jumped up and spat on the ceiling',
\
'As 007 walked by\n\
He heard a wee spider say, Hi.\n\
But shaken, he shot\n\
It right there on the spot\n\
As it tried to explain, Im a spi ',
\
'A tutor who tooted the flute\n\
Tried to tutor two tooters to toot\n\
Said the two to the tutor\n\
Is it tougher to toot or\n\
To tutor two tooters to toot?',
\
'No woodsman would cut a wood, would he\n\
If woods would be woodless nor should he.\n\
Yet no woodcutter would\n\
Cut a woody-wood wood\n\
If no woodsmen cut woody woods, would he?',
\
'There once was a man from the sticks\n\
Who loved to compose limericks\n\
But he failed at his sport\n\
They were always too short\n\
Parade Daily\n\
Celebrity interviews, recipes and health tips delivered to your inbox.',
\
'A poet whose friends called him Steve\n\
Once showed quite a will to achieve\n\
His skill grew so strong\n\
That his poems grew long\n\
And he sadly was forced to abbrev.',
\
'If you catch a chinchilla in Chile\n\
And cut off its beard, willy-nilly\n\
You can honestly say\n\
That you have just made\n\
A Chilean chinchillas chin chilly',
\
'There once was a man named Muvett\n\
Who lived in the city of Lovett\n\
But his car broke down\n\
Two miles out of town\n\
And Muvett had to shove it to Lovett!',
\
'There once was a beautiful nurse\n\
Who carried an ugly old purse\n\
But she tripped on the door\n\
And fell on the floor\n\
And they both went away in the hearse.',
\
'There was a young girl from Flynn\n\
Who was so terribly thin\n\
When she sipped lemonade\n\
Through a straw in the shade\n\
She slipped through the straw and fell in!',
\
'There once was a man from Gorem\n\
Had a pair of tight pants and he wore em\n\
When he bowed with a grin\n\
A draft of air rushed in\n\
And he knew by the sound that he tore em!',
\
'There once was a man from the city\n\
Stooped to pat what he thought was a kitty\n\
He gave it a pat\n\
But it wasnt a cat-\n\
They buried his clothes what a pity!',
\
'There once was a gal from Decatur\n\
Who went to sing in a the-a-ter\n\
But the poor little thing\n\
When she started to sing\n\
Got hit by a rotten termater! (tomato)',
\
'What happens when you retire?\n\
You really dont have to inquire \n\
No job and no phone\n\
Theres no place but home,\n\
And your checkbooks about to expire!',
\
'At times Im so mad that Im hopping.\n\
My angriness sets my veins popping.\n\
I yell and I curse,\n\
With swear words diverse,\n\
But my wife does much worse: she goes shopping',
\
'One Saturday morning at three,\n\
A cheese mongers shop in Paree.\n\
Collapsed to the ground,\n\
With a thunderous sound,\n\
Leaving only a pile of de brie.'
]
return np.random.choice(limericks)

61
src/prince.py Normal file
View file

@ -0,0 +1,61 @@
elif user_message.lower().count('lulzbot tell me about yourself') > 0:
await message.channel.send(\
'In west Philadelphia born and raised\n\
On the playground was where I spent most of my days')
time.sleep(4.6)
await message.channel.send('\
Chillin\' out maxin\' relaxin\' all cool\n\
And all shooting some b-ball outside of the school')
time.sleep(4.6)
await message.channel.send('\
When a couple of guys who were up to no good\n\
Started making trouble in my neighborhood')
time.sleep(4.6)
await message.channel.send('\
I got in one little fight and my mom got scared\n\
She said, "You\'re movin\' with your auntie and uncle in Bel-Air"')
time.sleep(5)
await message.channel.send('\
I begged and pleaded with her day after day\n\
But she packed my suitcase and sent me on my way')
time.sleep(4.6)
await message.channel.send('\
She gave me a kiss and then she gave me my ticket\n\
I put my Walkman on and said\n\
"I might as well kick it"')
time.sleep(4.5)
await message.channel.send('\
First class, yo, this is bad\n\
Drinking orange juice out of a champagne glass')
time.sleep(4.5)
await message.channel.send('\
Is this what the people of Bel-Air living like?\n\
Hmm, this might be alright')
time.sleep(4.5)
await message.channel.send('\
I whistled for a cab and when it came near\n\
The license plate said "Fresh" and it had dice in the mirror')
time.sleep(4.5)
await message.channel.send('\
If anything I could say that this cab was rare\n\
But I thought, "Nah, forget it"\n\
"Yo, homes to Bel-Air"')
time.sleep(4.5)
await message.channel.send('\
I')
time.sleep(.5)
await message.channel.send('\
pulled')
time.sleep(.5)
await message.channel.send('\
up to the house about 7 or 8\n\
And I yelled to the cabbie\n\
"Yo homes smell ya later"')
time.sleep(4.5)
await message.channel.send('\
I looked at my kingdom\n\
I was finally there\n\
To sit on my throne as the Prince of Bel-Air')
return

15
test/cartmantest.py Normal file
View file

@ -0,0 +1,15 @@
import requests
import json
url = 'https://doordesk.net/chat'
active = True
while active:
user_input = input('>> ')
if user_input in 'q':
active = False
break
message = {'Message': user_input}
response = requests.post(url,json.dumps(message))
print(response.json().get('Cartman'))

18
test/flantest.py Normal file
View file

@ -0,0 +1,18 @@
import torch
from transformers.models.t5.tokenization_t5 import T5Tokenizer
from transformers.models.t5.modeling_t5 import T5ForConditionalGeneration
device = torch.device("cuda")
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl").cuda()
run = True
while run:
input_text = input('>> ')
if input_text in 'q':
run = False
break
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])

18
test/gpt-jt_test.py Normal file
View file

@ -0,0 +1,18 @@
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
device = torch.device("cuda")
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/GPT-JT-6B-v1")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/GPT-JT-6B-v1").cuda()
run = True
while run:
input_text = input('>> ')
if input_text in 'q':
run = False
break
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])

17
test/gptjtest.py Normal file
View file

@ -0,0 +1,17 @@
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
device = torch.device("cuda")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B").cuda()
run = True
while run:
input_text = input('>> ')
if input_text in 'q':
run = False
break
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])