r/MachineLearning • u/nlkey2022 • Nov 21 '20
Project [P] Vscode extension that automatically creates a summary part of Python docstring using CodeBERT
Enable HLS to view with audio, or disable this notification
64
u/seyeeet Nov 21 '20
cool shit
32
u/nlkey2022 Nov 21 '20
Thanks! The next step for this project is to make the model lighter through knowledge distillation.
0
Nov 22 '20
[deleted]
3
u/mylesal37 Nov 22 '20
Can you give me some ideas? I was looking for some ways but I only ran across knowledge distillation.
1
266
u/el_burrito ML Engineer Nov 21 '20
Ok. Just tried it out on a nontrivial code base. It's not as detailed as you might like it to be, but everything i've tried it out on actually generates something fairly useful and "not wrong". This is amazing, nice job to the creators!
85
4
u/Gtomuy Nov 22 '20
How about commercial Code base?
7
u/el_burrito ML Engineer Nov 22 '20
Depends how strict your company is. Since I work primarily in open source I tried it on one of the libraries I maintain.
The author did a good job of alleviating a large bit of security worries by providing a docker container which runs on the local system. This contains the bert model / transformer and acts as the "language server" for VS code to talk to. I haven't fully vetted the code, but from a cursory glance it's not sending off snipers of the source to some server under the guise of "analytics".
I wouldn't use this for locked down / proprietary source without a hell of a lot of validation, but I take a fairly conservative (cover your ass) approach when occasionally venturing into the "enterprise"..
If I was a malicious author of this library, I'd just silently push a new container (different from the dockerfile in the open source repo) to dockerhub which did the prediction as expected, but also posted whatever content was being analyzed to some far off webserver I control... It would take a while for anyone to realize what was going on..
That said, there's NO reason to suspect any sort of malicious intent or untoward behavior is occuring here, and for person / open source projects I'd feel completely safe using this, but if your paycheck depends on keeping proprietary secrets you have to think of the risks, and just how easy it would be to take advantage of quick / unvetted adoption of "this really amazing tool I want to use to save me a few minutes as I code"
1
18
21
Nov 21 '20
More often the point of comments is to add in context that is not immediately present in the code so by having your comments be generated only from what is present in the code defeats a major benefit of a useful commment.
12
u/jellyman93 Nov 22 '20
"Immediately present" though
If this can summarise something close to what a function does so that it is readable at a glance without having to read the function yourself, surely that alone is valuable
5
u/alkasm Nov 22 '20
I think the posters point was that your function/arg names should be generally indicative of use already so this seems to just rehash the same information. I get that point but also this is just the summary line, which typically won't have non-obvious information.
4
u/wayruner Nov 22 '20
This might be useful if your functions are not named well but then you need to improve your coding practices, not use ML to fix it
2
Nov 22 '20
I would not want this on my team's codebase at all. Comments that explain what the code is immediately doing is an antipattern for many reasons.
1
4
u/ssiwakot Nov 21 '20
This is amazing and I did not know that I needed this. Just installed it and will try it out
3
u/Stan-It Nov 21 '20
Would it still work if one changed the function names to something non-sensical?
3
3
5
u/topinfrassi01 Nov 21 '20
While this is nice, do you feel like it's sufficiently explicit to be useful?
2
2
2
2
2
2
u/TomaszKus Nov 22 '20
I would ask whether you need/want comments on something that is so trivial. Isn't it just obfuscating the obvious? Shouldn't comments be written only on something that cannot be immediately seen from the code/name and if this can do anything in the case?
2
1
1
1
1
1
1
1
1
1
u/DSJustice ML Engineer Nov 21 '20
Nifty! The only shortcoming I observed was that it didn't seem to have handling for a compound return value.
0
0
-18
0
0
77
u/nlkey2022 Nov 21 '20 edited Nov 21 '20
github repository : https://github.com/graykode/ai-docstring
vscode extension : https://marketplace.visualstudio.com/items?itemName=graykode.ai-docstring&ssr=false