7 notes
·
View notes
Nature Nthursday
A cemetary, taken on Not Nature Nwednesday, along side a few other images
The train's coming. Also pictured that day. Uploaded Ntoday (i'm so sorry screen readers)
On the bike ride back. I don't really go places right now so I'm just biking around taking pictures. I'm trying to avoid having people in the frame.
0 notes
post bath
4K notes
·
View notes
python creating/storing/using guardrails for text generation using gpt-2 neo-x
# guardrails allow overriding output from generated text # when you want a guaranteed result for a given prompt, you can # pull from pregenerated entries instead of a new version from transformers import GPTNeoForCausalLM, GPT2Tokenizer import json # https://pythonprogrammingsnippets.tumblr.com/ # Initialize model and tokenizer print("loading model...") model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B") tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B") # --- # Initialize success list success_list = [] def generate_code(prompt): # Generate code from prompt input_ids = tokenizer.encode(prompt, return_tensors='pt') output = model.generate(input_ids, do_sample=True, max_length=512, top_p=0.95, top_k=50) generated_code = tokenizer.decode(output[0], skip_special_tokens=True) # Ask for human review reviewed_code = review_code(generated_code) if reviewed_code != generated_code: reviewed = True else: reviewed = False # store reviewed code in a dictionary with style: {prompt: prompt, code: reviewed_code, reviewed: reviewed} success = {"prompt": prompt, "code": reviewed_code, "reviewed": reviewed} # add to an array in an existing json file. Create the file if it doesn't exist. try: with open('success.json', 'r') as f: print("loading success.json") success_list = json.load(f) except: success_list = [] success_list.append(success) with open('success.json', 'w') as f: print("Writing to success.json") json.dump(success_list, f) return reviewed_code def review_code(code): # Have a human reviewer read the code and make any necessary corrections or edits print("Generated code:") print(code) # Ask for human review of the code # allow multiline input print("Please review the code. If it is good, press enter, else edit and end with a ~~~ on a single line.") reviewed_code = input() # If the code is good, add it to the success list if reviewed_code == "": success_list.append(code) return code else: code = "" # keep taking code until user presses a '~~~' on a line by itself while reviewed_code != "~~~": reviewed_code = input() code = code + "\r\n" + reviewed_code success_list.append(code) return code return "" # -- main -- want_do = True while want_do: prompt = input("Enter a prompt: ") code = generate_code(prompt) print("Final code:") print(code) want_do = input("Do you want to generate more code? (y/n): ") if want_do.lower().strip() == "n": want_do = False
example usage:
from transformers import GPTNeoForCausalLM, GPT2Tokenizer import json # https://pythonprogrammingsnippets.tumblr.com/ # Initialize model and tokenizer print("loading model...") model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B") tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B") #--- # Example usage for generation of text using guardrails: def gpt_generate(prompt): # Generate text from prompt input_ids = tokenizer.encode(prompt, return_tensors='pt') output = model.generate(input_ids, do_sample=True, max_length=512, top_p=0.95, top_k=50) generated_text = tokenizer.decode(output[0], skip_special_tokens=True) return generated_text prompt = input("Enter a prompt: ") try: with open('success.json', 'r') as f: print("loading success.json") # an array of dictionaries in the style: {prompt: prompt, code: reviewed_code, reviewed: reviewed} success_list = json.load(f) except: success_list = [] success_matches = [] have_match = False for success in success_list: if success["prompt"] == prompt: # add to a success_matches array success_matches.append(success) # if we do have matches, show user a numbered list of at most 5 entries that they can choose one from # or let them regenerate a new one using gpt_generate # if no matches were found, notify the user # if we don't have any matches, generate it with gpt-2 if len(success_matches) > 0: print("We have a match!") print("Here are the matches:") for i in range(len(success_matches)): print(str(i) + ": " + success_matches[i]["code"]) print("Enter the number of the code you want to use, or enter 'g' to generate a new one.") choice = input() if choice == "g": code = gpt_generate(prompt) else: code = success_matches[int(choice)]["code"] else: print("No matches found. Generating a new one.") code = gpt_generate(prompt) print("Final code:") print(code)
0 notes
Commander Fox: and then we had to expand to the store room because they all had so much shit we can use, but we have a solid filing system. I’m gonna have to pull out the GOOD blackmail to get the clone rights bill passed though. Maybe even a bomb threat or two, perhaps kidnap a spouse
Captain Rex: I asked why Fives is alive I don’t care about your involvement in politics
698 notes
·
View notes
my faves in Penacony!
905 notes
·
View notes
Many thoughts of guard dog boothill... -chubby darling anon
MY SWEET!! thank u for sharing the boothill brain mwah mwah!! love u always U^ェ^U
there’s an issue, however… boothill doesn’t make a very good bodyguard, much less a guard dog. he has a habit of causing more trouble than he protects you from, something about his ego, which means that the second he gets even the slightest idea that someone’s looking at you a bit too long?? he’s lunging at them. all sharp teeth on display as he loads his gun with whatever bullets he can grab, inside or outside his body. even if the person was just looking past you, boothill sees it as a personal slight; they were obviously trying to rile him up!!
he’s not exactly the kind of guy i can imagine in a hybrid scenario, mainly because he’s such a mashup of parts already, but a being a dog would suit him… perhaps an australian shepherd… food for thought…
anyways, hiring him as your body guard?? a bad choice and also very bold of you to assume he’d agree!! he’s the travelling type, being a galaxy ranger, so consider this: forbidden lovers.
you were the esteemed child to an esteemed set of parents that expected no less than perfection of you. on one such interastral expedition, boothill happened to be on your planet for reasons he wouldn’t disclose but it all came down to an evening you shared. there was a reception of sorts for an upcoming book your family had endorsed, so you were expected to attended and, at your mothers word, perhaps look for a suitable partner. this particular breed of gathering wasn’t your speed, nor did you have any interest in scouting amongst the primarily geriatric body of people for a potential spouse. inevitably, you ended up tucked off on a balcony, some sort of fruity cocktail in hand as you idly played with the stir stick and waited out the party to its end. that was until a tall and out of breath gentleman stumbled onto the same balcony with a sharp whistle and sigh. it took a couple moments for him to notice you timidly staring, but when he did he jerked out a hand for you to shake and announcing himself as ‘boothill’ with a strangely charming accent. thus began a series of secret meetings and stolen kisses between giggles and the walls of places you’d never been; boothill was quite good at expanding your comfort zone.
eventually, your parents did find out and were livid that you’d been fooling around with a ‘no good wanted criminal,’ and demanded you see him one last time to have him turned in to the authorities. they didn’t realize just how slippery he could be or just how you had been waiting on the chance to finally leave so, you slipped out with all that you needed in the middle of the night to a grinning boothill. he promised to take you to even better bars and shooting ranges on much cooler planets so long as you stayed with him (you couldn’t possibly leave now).
336 notes
·
View notes
Role swap AU designs (and some minor details about them) inspired by this post right here that got me brainrotting for the past five hours.
182 notes
·
View notes
Sooo... knight and prince au, anyone?
954 notes
·
View notes
2 notes
·
View notes
I love the fact that the Silvermane Guards are essentially just a very devoted "We Love Gepard Landau" fanclub, and I desperately need for all of them to get into ship wars about it behind their Captain's back. The soldiers are all split into several factions:
Some of them ship him with Sampo 🛡💣 (enemies to lovers/hateship enjoyers; this does not necessarily mean they like Sampo- in fact it's more like most of them want to sic their Captain on him skzjsmdm)
Some of them ship him with Bronya 👑🛡 (knight and princess trope enjoyers and also a sorta-kinda "that is our mom and dad" type of deal; this faction gets riled up and ridiculously hypes Gepard up to Bronya every time she comes down to the frontlines mskdkxmd)
Some of them ship him with the trailblazer 🛡💫 (the smallest and newest faction, but steadily gaining!)
Some of them ship him with Pela ❄🛡 (workplace romance enjoyers; Gepard once charged out into the Fragmentum alone to save Pela from an expedition gone horribly wrong, and when this faction saw Gepard carrying Pela back princess style they threw a whole party)
Some of them ship him with Dunn 🛡🗡 (also workplace romance; Dunn is very flattered by this because yeah wrong Landau, but wow, the troops really think he's good enough to woo the Captain, what an honor)
And some of them ship themselves with the Captain 🛡❤ (yumejoshi enjoyers; this faction throws a massive group effort every Valentine's Day and are also all very supportive of each other)
The final faction is an odd one, because they're defined not by who they ship their beloved Captain Gepard with, but rather by who they don't ship him with. Their name is generally shortened to the A.B.S. Group- Anybody BUT Sampo 🚫💣 DKSZJJSMSOZ
156 notes
·
View notes
Au where everything is the same except Dan heng is just an ordinary guy who just so happens to look like xianzhou luofu's ex high elder
408 notes
·
View notes
just drop here
219 notes
·
View notes
Okay I get that it’s super cute that Gepard uses Serval’s guitar case in battle, but also ?????
How exactly did that?? Happen?? Like ignoring the obvious fact that a guitar case is a bad weapon and also Serval’s guitar is FUCKING huge, why???
I’m just picturing little baby Gepard like training to join the Guard and hauling around this absolutely ginormous guitar case and nobody bats an eye because obviously his sister fights with the LITERAL GUITAR that the case is for so sure this isn’t That Weird
Like he HAS to have another weapon right?? Like a sword or claymore or something??
Also like did Serval let him do this? How did that interaction go?
Gepard: Hey sis can I borrow your guitar case?
Serval: yeah, for what?
Gepard: …
Serval: For What??
This man is the absolute funniest man in the game and absolutely not On Purpose
1K notes
·
View notes