6 ms·
PHP code generated by GPT-2
- userbinator 8y agoAny context on what this is supposed to be...? I can vaguely read PHP, but the code does not appear to be doing anything of much substance. At first I thought it was something to do with a second revision of GUID Partition Tables.
- rahimnathwani 8y agoContext: https://blog.openai.com/better-language-models/ https://blog.openai.com/better-language-models/
- deleted 8y ago[deleted]
- bitexploder 8y agoIt’s a text generation algorithm. It’s not meant to be real code, just look like it. This is the infamous “too dangerous to release” GPT-2 making this code.
- userbinator 8y agoReminds me somewhat of https://en.wikipedia.org/wiki/Article_spinning https://en.wikipedia.org/wiki/Article_spinning ...and now I hope that searching for code in the future won't become polluted by such spam.
- bitexploder 8y agoI think everyone has written a Markov Chain generator and fed it The Bible plus a random flavor text. Right?
- corobo 8y agoThe flavour text was always jerkcity.txt in every markov bot I've ever come across
- deleted 8y ago[deleted]
- tyingq 8y agoThe tweets that go with this: https://twitter.com/moyix/status/1096255984866082816 https://twitter.com/moyix/status/1096255984866082816
- fffrantz 8y ago"Accidentally picked up" Somehow they must have fed it with some JavaScript and some php, right ?
- kowdermeister 8y agoWith sloppy scraping I guess JS was picked up besides text. PHP should be intentionally used as training material.
- lugg 8y agoSloppy scraping? You forget html and JS is perfectly valid syntax to find in a .php file.
- kowdermeister 8y agoYes, of course. But JS is frontend mostly, so I can imagine it's easier to accidentally scrape some JS with text. PHP, not so much, only if the server returns source by accident.
- yorwba 8y agoWhat if the server is GitHub? Or some random blog about PHP development? There are lots of situations where it's very intentional that PHP is contained in HTML.
- tyingq 8y agoYes. But that's the sort of hype that seems to be desired. "OMG zombies, we accidentally put some bad samples in the training data"
- 8y ago
- ndpsr 8y agoStill better than Wordpress core.
- lmilcin 8y agoI especially like how the comments have absolutely nothing in common with the code they are supposedly commenting, just like in real life.
- smhg 8y agoAnd almost-real naming like 'DbAppAndFNAAppRegistrationService'.
- tyingq 8y agoLooking forward to com.ai.gpt-2.autogen.java.lang.factory.thing.verb
- sli 8y agoReally looking forward to some iOS code, with (real) identifiers like: outputImageProviderFromBufferWithPixelFormat:pixelsWide:pixelsHigh:baseAddress:bytesPerRow:releaseCallback:releaseContext:colorSpace:shouldColorMatch: kCMSampleBufferConduitNotificationParameter_UpcomingOutputPTSRangeMayOverlapQueuedOutputPTSRange
- ahje 8y agoThat put a smile on my face on a bad day. Thank you! :D
- aboutruby 8y agoWith some automated formatting: https://pastebin.com/7F2Leqy1 https://pastebin.com/7F2Leqy1
- Navarr 8y agoWhat on earth did you use to format that. This will be far more readable to PHP devs; https://gist.github.com/navarr/a20284c0533ea6f6ebc0946d62c96ac7 https://gist.github.com/navarr/a20284c0533ea6f6ebc0946d62c96...
- munk-a 8y agoUntil GPT-2 can participate in a formatting holy-war all our jobs are secure. It's time to get worried when it starts posting opinionated comments on the internet about "how spaces make my code look the same on everyone's machine" that's when it'd be a good idea to invest in a bunker.
- rbrtdrmpc- 8y agoLook ma, no Laravel
- beager 8y agoThis makes me think that something like Stack Overflow could be used to train a model that generates code to answer a question—and that software specifications that are decomposed into a series of requirements or "questions" could be fed into this model to produce code that's equivalent to a team of remote contractors. Your model would be based on NLP/votes of the questions, NLP/votes of the answers, and separating the text from the code in both. The fact that many markdown/code formatting tools have you select the language for syntax highlighting is useful for classifying code as well.
- scrollaway 8y agoFinally, StackSort (https://xkcd.com/1185/ https://xkcd.com/1185/) could actually be useful in a real world application.
- 52-6F-62 8y agoMy god—the JOBINTERVIEWQUICKSORT is just brilliant.
- scrollaway 8y agoImportant note: The AI did not generate that exact version of the code. It was almost syntactically correct. Here's the diff: https://gist.github.com/moyix/dda9c3180198fcb68ad64c3e6bc7afbc/revisions#diff-8074138f091ac83e2bef3faec88bdb05 https://gist.github.com/moyix/dda9c3180198fcb68ad64c3e6bc7af...
- yorwba 8y agoAlso, the original in https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-samples/unconditional.txt https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-... has two more lines. The first // web/application/handlers/add-full-no-app-directly.md (1071 bytes) and the last public function registerPipeHandlerInterceptor
- cubano 8y agoJust what I didn't need to see this morning. I am literally living in the streets, freezing my ass off and hungry, looking for any kind of programming work for the past month, and now I have to see some AI bot generating more inexpensive shit code that I am sure some manager will convince themselves might get them that final career promotion by lowering their labor costs to near zero. WTG, geniuses, for developing AI that before you know will have all of us living in the streets and hungry... I'll save you a spot.
- openbasic 8y agoWhere do you live? There's plenty of jobs in my area and my company is also hiring. I would be happy to help you land something.
- leesalminen 8y agoI see you’re proficient in a LAMP stack? Gingrapp.com is looking for a developer. Our parent company owns many other companies as well and are always looking for developers. My personal email is on my profile. Please feel free to reach out! I’ve helped find work for other devs down on their luck here on HN successfully.
- PaulHoule 8y agoThey're going to have to make PHP that compiles before we lose our jobs...
- jayar95 8y agoPHP is interpreted o.o
- 52-6F-62 8y agoPeople are downvoting your crassness, but I sympathize with your situation. I don't know what Las Vegas is like, but there is a lot of LAMP/WordPress work here in Toronto. (Frankly, I want nothing to do with it, but there's plenty of it and they pay alright. Some also offer PT or FT remote) --- The company I'm with is even hiring for such a role: https://twitter.com/scarbiedoll/status/1095714031023714305 https://twitter.com/scarbiedoll/status/1095714031023714305 --- Best of luck
- kodablah 8y agoCan someone shed more light behind this? What is the true source? Was it generated via the unreleased full model by an OpenAI employee? Or did someone generate it with the released "smaller model"? Can we, the curious public, see the model and replicate the results?
- moyix 8y agoI found it while browsing the "raw" samples generated by the full-sized model. You can read through them all here: https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-samples/unconditional.txt https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-... The PHP sample is Sample 195.
- pamparosendo 8y agoIt will be interesting when AI finds out there's no need for her to generate human-readeable code.
- gambler 8y agoThis is very fishy. You can get code like this by substituting words in identifier names for other words, but how can an algorithm trained on English dataset "learn" that keywords like 'function' and 'class' are exempt from substitution? I know most people here have unwavering faith in the magic of deep neural networks, but you'd need _a lot_ of examples to deduce this with any certainty, regardless of how you do it.
- hnarn 8y ago> you'd need _a lot_ of examples to deduce this with any certainty Are you saying that "a lot" isn't almost semi-trivial to obtain, seeing how much code is available online?
- gambler 8y agoWhy would a model trained on English texts see "a lot" of PHP code? What was the prompt used for generating this code?
- IanCal 8y agoIt was trained on contents of links found on Reddit, wasn't it? Links to sample code or stack overflow posts could be pretty prevalent.
- gambler 8y agoSo you're buying the idea that it looked at a bunch of code snippets embedded at various pages, managed to build a sub-model for PHP (separate from all other languages it should have encountered) and managed to generate a long, nearly syntactically correct program uninterrupted by English text? And while it makes tons of obvious mistakes in English (which is a much more flexible and forgiving language), its PHP is somehow nearly syntactically perfect? - Examples from GPT-2 GitHub have a lot of code: https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-samples/conditional-topk40.txt https://raw.githubusercontent.com/openai/gpt-2/master/gpt-2-... To me, this doesn't seem like an argument in favor of this model "understanding" English (or C, or PHP). It seems more like an indication that it memorizes way more information than the paper implies and then does clever word substitution.
- gambler 8y agoBTW, I would like to point you to the MIT's project Genesis as an example of what a rule-based text comprehension system could do almost a decade ago.
- glup 8y agoI have been working with a group that is trying to clone this dataset and make it publicly available (https://github.com/jcpeterson/openwebtext https://github.com/jcpeterson/openwebtext), and I have noticed quite a bit of code in the scraped dataset. Future releases of our dataset will be pre-filtered with another LSTM language model that will filter sentences by their probability under more conversational / literary datasets.
- chadbennett 8y agoMotivated by this post, I decided to test it out. It's impressive how powerful the software is even with the limitations. I made a simple tutorial on how to test GPT-2 out for yourself at https://medium.com/heroic-com/how-to-quickly-generate-full-articles-using-openais-gpt-2-3876870aeb5c https://medium.com/heroic-com/how-to-quickly-generate-full-a...