pythondaily | Образование

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Подписаться на канал

Python Daily

How to Audit the Quality of Your Python Code: A Step-by-Step Guide
https://www.stxnext.com/blog/how-to-audit-the-quality-of-your-python-code

/r/Python
https://redd.it/yfqsmn

Читать полностью…

Python Daily

Why do we need an async version of every library?

It appears that every library and their ancestors now are compelled to come out with an async version. Why is that? And isn't that a sign of a broken async API (or its use) in the first place?

We should be able to have async "front-ends" and not have to redesign every last bit of code to be made aware of running in an async event loop. Change my mind.

/r/Python
https://redd.it/yfir8u

Читать полностью…

Python Daily

Web Automation: Don't Use Selenium, Use Playwright
https://new.pythonforengineers.com/blog/web-automation-dont-use-selenium-use-playwright/

/r/Python
https://redd.it/yeuqw6

Читать полностью…

Python Daily

R WinoGAViL: Gamified Association Benchmark to Challenge Vision-and-Language Models

Our paper "WinoGAViL: Gamified Association Benchmark to Challenge Vision-and-Language Models" was accepted to NeurIPS 2022, Datasets and Benchmark.

Paper: http://arxiv.org/abs/2207.12576
Website: http://winogavil.github.io
Huggingface: https://huggingface.co/datasets/nlphuji/winogavil
Colab: https://colab.research.google.com/drive/19qcPovniLj2PiLlP75oFgsK-uhTr6SSi

Which images best fit the cue werewolf? Did you know V&L AI models only get \~50% on our challenging WinoGAViL association task but humans get 90%?

https://preview.redd.it/upvig7xbrcw91.png?width=1658&format=png&auto=webp&s=8f733a993bb7a6bf2a1377d39ae830e46e9c8cab

Introducing WinoGAViL, an online game you can play now against AI! WinoGAViL is a dynamic benchmark for evaluating V&L models. Inspired by the popular card game Codenames, spymasters give a textual cue related to several visual candidates, and another player identifies them.

Association Generation: Alice generates a cue word for a subset of the images; A rival AI model makes a prediction based on the cue word; Three human solvers try to solve the task; Alice is rewarded if the association challenges the rival model but is easy for other humans.

We analyze the skills required to solve the WinoGAViL dataset, observing challenging visual and non-visual patterns, such as attribution, general knowledge, word sense making, humor, analogy, visual similarity, abstraction, and more.

We collected qualitative and quantitative feedback from players that played our game, finding that the task requires diverse reasoning skills, is recommended as an online game, is fun

/r/MachineLearning
https://redd.it/yeppof

Читать полностью…

Python Daily

Inside the team at Microsoft that helped make Python 10-60% Faster
https://devblogs.microsoft.com/python/python-311-faster-cpython-team/

/r/Python
https://redd.it/ye2sfl

Читать полностью…

Python Daily

Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/yeczkv

Читать полностью…

Python Daily

How can I change the kernel from environment to another without installing Jupiter in each environment.

I installed torchvision in a new environment because it doesn’t work in base but in order to open the notebook I need to install Jupiter in the new environment. There’s a comment on stackoverflow to install conda kernels but I don’t know how to use it. Any help?

/r/JupyterNotebooks
https://redd.it/v8ee79

Читать полностью…

Python Daily

Jupyter Notebook collab tool

I'm a canvas collaboration dork and also a big fan of using Jupyter Notebooks to teach programming in the classroom. Interesting opportunity to teamwork -> https://www.einblick.ai/blog/notebook-feature-release/

Not clear if there is a free edu upgrade option but the paid version is more geared toward workplace needs.

/r/JupyterNotebooks
https://redd.it/ye62b0

Читать полностью…

Python Daily

P Up to 12X faster GPU inference on Bert, T5 and other transformers with OpenAI Triton kernels

We are releasing Kernl under Apache 2 license, a library to make PyTorch models inference significantly faster. With 1 line of code we applied the optimizations and made Bert up to 12X faster than Hugging Face baseline. T5 is also covered in this first release (> 6X speed up generation and we are still halfway in the optimizations!). This has been possible because we wrote custom GPU kernels with the new OpenAI programming language Triton and leveraged TorchDynamo.

Project link: https://github.com/ELS-RD/kernl/

E2E demo notebooks: XNLI classification, T5 generation

Benchmarks ran on a 3090 RTX GPU, 12 cores Intel CPU, more info below

On long sequence length inputs, Kernl is most of the time the fastest inference engine, and close to Nvidia TensorRT on shortest ones. Keep in mind that Bert is one of the most optimized models out there and most of the tools listed above are very mature.

What is interesting is not that Kernl is the fastest engine (or not), but that the code of the kernels is short and easy to understand and modify. We have even added a Triton debugger and a tool (based on Fx) to ease kernel replacement so there is no need to modify PyTorch model source code.

Staying

/r/MachineLearning
https://redd.it/ydqmjp

Читать полностью…

Python Daily

Tabnine ships new code-native AI models, passes 1 million developers using its AI code assistant
https://www.tabnine.com/blog/announcing-tabnine-next-generation/

/r/JupyterNotebooks
https://redd.it/vcstar

Читать полностью…

Python Daily

My directory looks like this but still I am getting jinja error that tells template, "index.html" is not found. I feel everything is fine but it ain't. Please help me to solve this error.

/r/flask
https://redd.it/yd6h7w

Читать полностью…

Python Daily

D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/ybjvk5

Читать полностью…

Python Daily

Jupyter notebook can't be opened after a while

When I try to launch Jupyter Notebook through either the shortcut (timeout trying to connect) or command prompt using "jupyter notebook" anywhere, I get an error saying the command jupyter is either misspelled or can't be found. This problem didn't exist when I had just installed jupyter. It appears as if the entire jupyter command structure doesn't exist anymore. Same error never occured right after installing Python from scratch. What am I doing wrong? Do i need to start up some software before opening jupyter?

/r/JupyterNotebooks
https://redd.it/vgu9m5

Читать полностью…

Python Daily

How to create beautiful, maintainable, fast, low js websites

I've been reading until my eyes are bloodshot and this old self-taught PHP/MySQL dev can't seem to land on a modern stack for a reasonably simple database driven site where I intend to outsource development (probably to multiple people over time).

Given I'm outsourcing on a budget, my goal is to get as much goodness as I can in a site easily maintainable be a single Django-heavy full stack developer.

What I've convinced myself so far.

I can use HTMX and avoid full frontend frameworks and be ajaxy
I can get by with a light JS "framework" like Alpine if needed
I need reusable ui components to not have the same code scattered everywhere

Remaining questions.

How to put it all together with framework/libraries to get:

1. UI components;
2. Style with css with as much flexibility as possible (no Bootstrap);
3. While still being DRY (without a mess of repeated code in each template); and
4. Eliminating or minimizing any npm build process or other such hassles.

I've been reading about django-components and \#slippers components, but don't know about combining Pre or PostCSS, Tailwind or XXX for styling and how to keep the whole thing as simple to maintain as possible.

/r/django
https://redd.it/yctfyt

Читать полностью…

Python Daily

Testing issue with nested blueprints

So, I have a blueprint manage_users that should have a blueprint add_users nested under it:
the manage_users blueprint definition:

bp = Blueprint('manage_users', __name__, url_prefix='/manage_users')


the add_users blueprint definition:
bp = Blueprint('add_user', __name__, url_prefix='/add_user')


Registering the blueprints:
    from app.manage_users import manage_users_bp
from app.manage_users.add_user import add_user_bp
manage_users_bp.register_blueprint(add_user_bp)
app.register_blueprint(manage_users_bp)


It works flawlessly with the development server, however, when I'm testing, this error keeps popping up:
ValueError: The name 'add_user' is already registered for this blueprint 'manage_users.add_user'. Use 'name=' to provide a unique name.

Please help...

/r/flask
https://redd.it/ycjltm

Читать полностью…

Python Daily

Pipenv, venv or virtualenv or ?

Hi-I am new to python and I am looking to get off on the right foot with setting up Virtual Enviroments. I watched a very good video by Corey Schafer where he was speaking highly of Pipenv. I GET it and understand it was just point in time video.

It seem like most just use venv which I just learned is the natively supported option. Is this the same as virtualenv?

The options are a little confusing for a newbie.

I am just looking for something simple and being actively used and supported.

Seems like that is venv which most videos use.

Interested in everyone's thoughts.

/r/Python
https://redd.it/yfmljp

Читать полностью…

Python Daily

Does anyone know a solution for "cannot import name 'TfidTransformer'"? I'm not sure why it can't import it, I've had no problems importing Pipeline.

/r/JupyterNotebooks
https://redd.it/yf3ghm

Читать полностью…

Python Daily

Hi! I want to take PRODUCTS from a JSON file to my SQLITE3 db.

Hi! I want to take PRODUCTS from a JSON file to my SQLITE3 db. I can add an every single product by my admin panel side, but if I'd like to add on my store for example about 300 products it has no point.


products.js

Has anybody here a problem like this? thanks a lot for help!

/r/djangolearning
https://redd.it/yel56y

Читать полностью…

Python Daily

[R]Cool book I came across on Algebra, Topology, Differential Calculus and ML
https://www.cis.upenn.edu/~jean/math-deep.pdf

/r/MachineLearning
https://redd.it/yea6b6

Читать полностью…

Python Daily

Pandas DF but prettier than tohtml

Hey all, trying to put up a table and
df.to\html is functional but ugly. I tried a table, but it's formatted with widths that truncate my text and I can't seem to get simple CSS calls to work. Here's my code;

{% extends "base.html" %}

{% block title %} Alt Test Display {% endblock %}

{% block content %}

<table class="w3=hoverable">

{% for table in tables %}

<tr style="text-align: center">

<th>{{titles[loop.index]}}</th>

</tr>

<tr>

<td>{{ table|safe }}</td>

</tr>

{% endfor %}

</table>

{% endblock %}

Besides malformed bootstrap or CSS calls, can anyone see a better way to call my table? My thanks in advance for looking and weighing in!

/r/flask
https://redd.it/yegl2a

Читать полностью…

Python Daily

DCheating in AAAI 2023 rebuttal

I am based in US and I am a PC member (reviewer) of AAAI 2023.

This is what happened: an author of a paper I reviewed approached me during the rebuttal period, hoping that I could raise the score.

I notice that this year AAAI is different regarding the anonymous policy:

During the rebuttal period, reviewers can see the names of other reviewers; reviewers can see the name of the meta-reviewer; the meta-reviewer can see the names of reviewers.

This surely increases the chance for an author to identify the target reviewers.

I am very sorry for such a design. The chairs should take responsibility.

/r/MachineLearning
https://redd.it/ydyzlk

Читать полностью…

Python Daily

Pdf generated from form

I've recently been developing a web app where the user has to fill out this long form, it should after filled fill the data to a pdf to download. Can really get the writing part to work

https://stackoverflow.com/questions/74211944/django-form-to-pdf

/r/djangolearning
https://redd.it/ye57on

Читать полностью…

Python Daily

Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/ydjlio

Читать полностью…

Python Daily

Deploying a Flask App to Render
https://testdriven.io/blog/flask-render-deployment/

/r/flask
https://redd.it/ydx8rh

Читать полностью…

Python Daily

Jupyter Notebook competition drop-in session

Join our Jupyter Notebook Competition and help others work with Copernicus data: https://notebook.wekeo.eu

https://preview.redd.it/ldoz05jfwq691.png?width=1920&amp;format=png&amp;auto=webp&amp;s=a0cb240670505d7cc5484068382cf5c93a5f05dd

The best notebooks will win cash prizes! For more ideas, join one of our drop-in sessions on 22 June - https://eumetsat.zoom.us/webinar/register/1216546793316/WN\_xfka69JISOCKa90TUS0VRg

/r/JupyterNotebooks
https://redd.it/vghhmw

Читать полностью…

Python Daily

I keep getting the Status Code: 405 and I don't know why is that happening

from flask import Flask
from flask import request

app = Flask(name)


@app.route('/', methods = 'POST')
def index():
url = "https://api.jdoodle.com/v1/execute"
headers = {"application/json"}
data = {
"clientId": CLIENTID,
"clientSecret": CLIENT
SECRET,
"script": "print('hello world')",
"language": "python3",
"versionIndex": "0",
"stdin": ""
}
res = request.post(url, data, headers)

res = res.json()

return

/r/flask
https://redd.it/ydgtel

Читать полностью…

Python Daily

Python 3.11 is out! Huzzah!

https://www.python.org/downloads/release/python-3110/

Some highlights from the release notes:

PERFORMANCE: 10-60% faster code, for free!

ERROR HANDLING: Exception groups and except* syntax. Also includes precise error locations in tracebacks.

ASYNCIO: Task groups

TOML: Ability to parse TOML is part of the standard library.

REGEX: Atomic grouping and possessive quantifiers are now supported

Plus changes to typing and a lot more. Congrats to everyone that worked hard to make this happen. Your work is helping millions of people to build awesome stuff. 🎉

/r/Python
https://redd.it/ycmnor

Читать полностью…

Python Daily

Tuesday Daily Thread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/ycqkjb

Читать полностью…

Python Daily

wtf-form validator problem

I have a problem where wtfform validators are being applied to a field that's empty, despite the field not having the `DataRequired()` validator. Wondering if someone might be able to shed some light.

Form Model

>
> class ServerForm(ModelForm):
> class Meta:
> model = Server
> primary_network = StringField(label='primary network', validators=[DataRequired(), IPAddress()])
> secondary_network = StringField(label='secondary network', validators=[IPAddress()])

db model
> class Server(db.Model):
> primary_network = db.Column(INTEGER(unsigned=True))
> secondary_network = db.Column(INTEGER(unsigned=True))

render macro
> {% macro render_field_v2(field) %}
> <div class="form-group row">
> <label for="mac_address" class="col-sm-5 col-form-label">{{ field.label }}</label>
> <div class="col-sm-6">
>

/r/flask
https://redd.it/ycrav1

Читать полностью…

Python Daily

Python 3.11 Release Stream hosted by Pablo Galindo Salgado and Leon Sandøy!

The 3.11 [Release Stream can be found here](https://www.youtube.com/watch?v=PGZPSWZSkJI)


Python Discord owner Leon Sandøy and Python 3.11 release manager Pablo Galindo Salgado are hosting a release stream showing the process of releasing a new version of Python. They’ll be joined by CPython core developers who worked on some of the features going into 3.11, walking us over some of the specifics and highlighting the development process.

Some of the more notable features in Python 3.11 include:

* Exception Groups and `except*`
* Addition of `tomllib` to the standard library.
* A 10-60% speedup over Python 3.10, courtesy of the [Faster CPython project](https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython).

You can see a more exhaustive list on the [What's New](https://docs.python.org/3.11/whatsnew/3.11.html) page

You can watch the stream once it goes live [on youtube](https://www.youtube.com/watch?v=PGZPSWZSkJI). And join us over on the [Python Discord](https://discord.gg/python) for an AMA with the developers during the stream and stay after the stream to talk with other programmers about how the new version of python can improve your projects and development process!

Feel free to ask any questions you might have about the topics covered in the stream here and we'll relay what we're able to the core developers!

/r/Python
https://redd.it/ycgask

Читать полностью…
Подписаться на канал