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/1cvq77y
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/1cvq77y
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Programmable Semantics (Eval, Semicolon, Assignment) for Python
I've seen programmable semantics (eval-hacking, macros) in LISPs and in Haskell-likes(Monads/Template Haskell), the overall techinque in OOP languages is called "Aspect Oriented Programming". Has this kind of thing been discussed before, and is it Pythonic it could allow a lot of Python code to be shorter. Python has sys.set_trace that sort of allows some form of programmable semantics but its mostly for debugging.
Programmable assignment(variables) are like setters/getters/properties, but instead of being run on o.x = 5, you could run them on "all local assignments" isnside a context manager or in a decorated function. On every assignment you could do stuff like log the values, update dependencies, notify objects, do a database transaction, do persistance, calculate other values, without having to explicitly do so for every assignment statement.
Programmable semicolons (such as Haskell Monads, or reprogramming Lisp do/progn/let) could allow you to have the same code run either synchronous, async, get undo/history support, break on error, rollback, logging in between lines, changing local/global variables in between each line, database access in between lines, checking values for errors, ignoring certain statements, etc... You can think of a semicolon like an "unrolled for loop"/iterator ran for each code line.
/r/Python
https://redd.it/1cxp7qe
I've seen programmable semantics (eval-hacking, macros) in LISPs and in Haskell-likes(Monads/Template Haskell), the overall techinque in OOP languages is called "Aspect Oriented Programming". Has this kind of thing been discussed before, and is it Pythonic it could allow a lot of Python code to be shorter. Python has sys.set_trace that sort of allows some form of programmable semantics but its mostly for debugging.
Programmable assignment(variables) are like setters/getters/properties, but instead of being run on o.x = 5, you could run them on "all local assignments" isnside a context manager or in a decorated function. On every assignment you could do stuff like log the values, update dependencies, notify objects, do a database transaction, do persistance, calculate other values, without having to explicitly do so for every assignment statement.
Programmable semicolons (such as Haskell Monads, or reprogramming Lisp do/progn/let) could allow you to have the same code run either synchronous, async, get undo/history support, break on error, rollback, logging in between lines, changing local/global variables in between each line, database access in between lines, checking values for errors, ignoring certain statements, etc... You can think of a semicolon like an "unrolled for loop"/iterator ran for each code line.
/r/Python
https://redd.it/1cxp7qe
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Is there any reason not to use the default database?
Django uses SQLite by default. When would you want to upgrade to a full on SQL database like Postgres?
Is there any reason you would switch to a no-SQL database, like MongoDB? Is the pain this would cause even worth it? I feel like a huge part of the appeal of Django is that you don't have to write your DB queries yourself.
/r/django
https://redd.it/1cxlz6d
Django uses SQLite by default. When would you want to upgrade to a full on SQL database like Postgres?
Is there any reason you would switch to a no-SQL database, like MongoDB? Is the pain this would cause even worth it? I feel like a huge part of the appeal of Django is that you don't have to write your DB queries yourself.
/r/django
https://redd.it/1cxlz6d
Reddit
From the django community on Reddit
Explore this post and more from the django community
D How successful are ML projects?
Our team just deployed our first ML solution. We have several people with DS/ML certificates, and have done ML in side projects and hackathons, but no one has a degree in stats or math or DS and no one's ever done ML professionally. We regularly consulted multiple DS / ML experts, but never had a dedicated DS on our team. It cost us \~$400K to implement, is expected to save $50K a year, and have operational costs of $20K a year.
​
It seems like pursuing this wasn't worth it. Was this a miscalculation on our part? What's the success rate of the projects you work on? How much do you cost the company vs how much money do you generate (or save)?
​
/r/MachineLearning
https://redd.it/1cxtro6
Our team just deployed our first ML solution. We have several people with DS/ML certificates, and have done ML in side projects and hackathons, but no one has a degree in stats or math or DS and no one's ever done ML professionally. We regularly consulted multiple DS / ML experts, but never had a dedicated DS on our team. It cost us \~$400K to implement, is expected to save $50K a year, and have operational costs of $20K a year.
​
It seems like pursuing this wasn't worth it. Was this a miscalculation on our part? What's the success rate of the projects you work on? How much do you cost the company vs how much money do you generate (or save)?
​
/r/MachineLearning
https://redd.it/1cxtro6
Reddit
[D] How successful are ML projects? : r/MachineLearning
54 votes, 22 comments. 2.9M subscribers in the MachineLearning community. ml.
Beginners please see learnmachinelearning
Beginners please see learnmachinelearning
P Fish Speech TTS: clone OpenAI TTS in 30 minutes
While we are still figuring out ways to improve the agent's emotional response to OpenAI GPT-4o, we have already made significant progress in aligning OpenAI's TTS performance. To begin this experiment, we collected 10 hours of OpenAI TTS data to perform supervised fine-tuning (SFT) on both the LLM (medium) and VITS models, which took approximately 30 minutes. After that, we used 15 seconds of audio as a prompt during inference.
Demos Available: here.
As you can see, the model's emotion, rhythm, accent, and timbre match the OpenAI speakers, though there is some degradation in audio quality, which we are working on. To avoid any legal issues, we are unable to release the fine-tuned model, but I believe everyone can tune fish-speech to this level within hours and for around $20.
Our experiment shows that with only 25 seconds of prompts (few-shot learning), without any fine-tuning, the model can mimic most behaviors except details like timbre and how it reads numbers. To the best of our knowledge, you can clone how someone speaks in English, Chinese, and Japanese with 30 minutes of data using this framework.
Repo: https://github.com/fishaudio/fish-speech
/r/MachineLearning
https://redd.it/1cxwqb7
While we are still figuring out ways to improve the agent's emotional response to OpenAI GPT-4o, we have already made significant progress in aligning OpenAI's TTS performance. To begin this experiment, we collected 10 hours of OpenAI TTS data to perform supervised fine-tuning (SFT) on both the LLM (medium) and VITS models, which took approximately 30 minutes. After that, we used 15 seconds of audio as a prompt during inference.
Demos Available: here.
As you can see, the model's emotion, rhythm, accent, and timbre match the OpenAI speakers, though there is some degradation in audio quality, which we are working on. To avoid any legal issues, we are unable to release the fine-tuned model, but I believe everyone can tune fish-speech to this level within hours and for around $20.
Our experiment shows that with only 25 seconds of prompts (few-shot learning), without any fine-tuning, the model can mimic most behaviors except details like timbre and how it reads numbers. To the best of our knowledge, you can clone how someone speaks in English, Chinese, and Japanese with 30 minutes of data using this framework.
Repo: https://github.com/fishaudio/fish-speech
/r/MachineLearning
https://redd.it/1cxwqb7
Firefly AI on Notion
OpenAI Examples | Notion
Nova
django-import-export v4 released
You may be interested in looking at django-import-export v4.
It offers straightforward, reliable and comprehensive file import / export for your Django application.
django-import-export is an application and library which lets you manage import / export from / to a variety of sources (csv, xlsx, json etc).
It can be run programmatically, or with optional integration with the Django Admin site.
v4 includes lots of fixes and new features.
Please see the README for a full list of features and use-cases.
https://github.com/django-import-export/django-import-export
v4 has been completed by a small group of volunteers. We welcome any comments or feedback.
/r/django
https://redd.it/1cxvlvk
You may be interested in looking at django-import-export v4.
It offers straightforward, reliable and comprehensive file import / export for your Django application.
django-import-export is an application and library which lets you manage import / export from / to a variety of sources (csv, xlsx, json etc).
It can be run programmatically, or with optional integration with the Django Admin site.
v4 includes lots of fixes and new features.
Please see the README for a full list of features and use-cases.
https://github.com/django-import-export/django-import-export
v4 has been completed by a small group of volunteers. We welcome any comments or feedback.
/r/django
https://redd.it/1cxvlvk
GitHub
GitHub - django-import-export/django-import-export: Django application and library for importing and exporting data with adminβ¦
Django application and library for importing and exporting data with admin integration. - django-import-export/django-import-export
GeoEntropy: A Python Package for Computing Spatial/Geometric Entropy
I look forward to your critical thoughts and ideas about my project GeoEntropy! :-) Meaningful contributions are very welcome.
You can find the source code on Github and the package on PyPi.
Target Audience: Scientists
What My Project Does: GeoEntropy is a Python package designed to compute different entropy measures for spatial data represented in matrices (numpy arrays).
Comparison: GeoEntropy is inspired by the R package SpatEntropy by L. Altieri, D. Cocchi, and G. Roli and provides tools for analyzing the entropy of spatial data.
/r/Python
https://redd.it/1cxyvn2
I look forward to your critical thoughts and ideas about my project GeoEntropy! :-) Meaningful contributions are very welcome.
You can find the source code on Github and the package on PyPi.
Target Audience: Scientists
What My Project Does: GeoEntropy is a Python package designed to compute different entropy measures for spatial data represented in matrices (numpy arrays).
Comparison: GeoEntropy is inspired by the R package SpatEntropy by L. Altieri, D. Cocchi, and G. Roli and provides tools for analyzing the entropy of spatial data.
/r/Python
https://redd.it/1cxyvn2
GitHub
GitHub - maxkryschi/geoentropy
Contribute to maxkryschi/geoentropy development by creating an account on GitHub.
[D] AI Agents: too early, too expensive, too unreliable
[**Reference: Full blog post**](https://www.kadoa.com/blog/ai-agents-hype-vs-reality)
There has been a lot of hype about the promise of autonomous agent-based LLM workflows. By now, all major LLMs are capable of interacting with external tools and functions, letting the LLM perform sequences of tasks automatically.
But reality is proving more challenging than anticipated.
The [WebArena leaderboard](https://docs.google.com/spreadsheets/d/1M801lEpBbKSNwP-vDBkC_pF7LdyGU1f_ufZb_NWNBZQ/edit#gid=0), which benchmarks LLMs agents against real-world tasks, shows that even the best-performing models have a success rate of only 35.8%.
# Challenges in Practice
After seeing many attempts to AI agents, I believe it's too early, too expensive, too slow, too unreliable.
It feels like many AI agent startups are waiting for a model breakthrough that will start the race to productize agents.
* Reliability: As we all know, LLMs are prone to hallucinations and inconsistencies. Chaining multiple AI steps compounds these issues, especially for tasks requiring exact outputs.
* Performance and costs: GPT-4o, Gemini-1.5, and Claude Opus are working quite well with tool usage/function calling, but they are still slow and expensive, particularly if you need to do loops and automatic retries.
* Legal concerns: Companies may be held liable for the mistakes of their agents. A [recent example](https://www.theguardian.com/world/2024/feb/16/air-canada-chatbot-lawsuit) is Air Canada being ordered to pay a customer who was misled by the airline's
/r/MachineLearning
https://redd.it/1cy1kn9
[**Reference: Full blog post**](https://www.kadoa.com/blog/ai-agents-hype-vs-reality)
There has been a lot of hype about the promise of autonomous agent-based LLM workflows. By now, all major LLMs are capable of interacting with external tools and functions, letting the LLM perform sequences of tasks automatically.
But reality is proving more challenging than anticipated.
The [WebArena leaderboard](https://docs.google.com/spreadsheets/d/1M801lEpBbKSNwP-vDBkC_pF7LdyGU1f_ufZb_NWNBZQ/edit#gid=0), which benchmarks LLMs agents against real-world tasks, shows that even the best-performing models have a success rate of only 35.8%.
# Challenges in Practice
After seeing many attempts to AI agents, I believe it's too early, too expensive, too slow, too unreliable.
It feels like many AI agent startups are waiting for a model breakthrough that will start the race to productize agents.
* Reliability: As we all know, LLMs are prone to hallucinations and inconsistencies. Chaining multiple AI steps compounds these issues, especially for tasks requiring exact outputs.
* Performance and costs: GPT-4o, Gemini-1.5, and Claude Opus are working quite well with tool usage/function calling, but they are still slow and expensive, particularly if you need to do loops and automatic retries.
* Legal concerns: Companies may be held liable for the mistakes of their agents. A [recent example](https://www.theguardian.com/world/2024/feb/16/air-canada-chatbot-lawsuit) is Air Canada being ordered to pay a customer who was misled by the airline's
/r/MachineLearning
https://redd.it/1cy1kn9
Kadoa
AI Agents: Hype vs. Reality
AI agents show promise for automating repetitive tasks, but they are too early, too expensive, too unreliable (for now).
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education π’
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! π
/r/Python
https://redd.it/1cyf892
# Weekly Thread: Professional Use, Jobs, and Education π’
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! π
/r/Python
https://redd.it/1cyf892
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Take your Django Serializer game to the next level
https://differ.blog/p/take-your-django-serializer-game-to-the-next-level-b4659a
/r/django
https://redd.it/1cyg4ea
https://differ.blog/p/take-your-django-serializer-game-to-the-next-level-b4659a
/r/django
https://redd.it/1cyg4ea
Differ
Take your Django Serializer game to the next level
Unlock the hidden secrets of serializers in django
A django rest api key package
Hey everyone,
I've been working on some projects using Django for about five years now. But when I discovered DRF, I've decided to focus on building backend API applications without dealing much with the frontend. But about a year or two ago, I started to build APIs for some SaaS projects, and I realized I needed a robust API key management system.
I initially used https://github.com/florimondmanca/djangorestframework-api-key which is fantastic and has everything you need for API key systems, including great authorization and identification based on Django's password authentication system.
I will say this library shines if you only need API keys for permissions and nothing more.
However, when I wanted to push the package further, I hit some limitations. I needed features like key rotation, monitoring, and usage analytics to help with billing per request and permissions and better performances as the package use passwords hashing algorithms to create api keys.
So, I decided to create my own package. I've been working on it for about nine months to a year now, and it's come a long way. Here are some of the key features:
Quick Authentication and Permission System: You can easily implement authentication and permissions, for example, for organizations or businesses.
Monitoring
/r/django
https://redd.it/1cykl2c
Hey everyone,
I've been working on some projects using Django for about five years now. But when I discovered DRF, I've decided to focus on building backend API applications without dealing much with the frontend. But about a year or two ago, I started to build APIs for some SaaS projects, and I realized I needed a robust API key management system.
I initially used https://github.com/florimondmanca/djangorestframework-api-key which is fantastic and has everything you need for API key systems, including great authorization and identification based on Django's password authentication system.
I will say this library shines if you only need API keys for permissions and nothing more.
However, when I wanted to push the package further, I hit some limitations. I needed features like key rotation, monitoring, and usage analytics to help with billing per request and permissions and better performances as the package use passwords hashing algorithms to create api keys.
So, I decided to create my own package. I've been working on it for about nine months to a year now, and it's come a long way. Here are some of the key features:
Quick Authentication and Permission System: You can easily implement authentication and permissions, for example, for organizations or businesses.
Monitoring
/r/django
https://redd.it/1cykl2c
GitHub
GitHub - florimondmanca/djangorestframework-api-key: π API key permissions for Django REST Framework
π API key permissions for Django REST Framework. Contribute to florimondmanca/djangorestframework-api-key development by creating an account on GitHub.
Best practice projects Django + HTMX (+ AlpineJS)
I wan't to dive into Django + HTMX + (AlpineJS) and it would be great to see how others use these tools in projects. Do you know of any projects I could look into? Best practices?
Thanks!
/r/django
https://redd.it/1cyilp8
I wan't to dive into Django + HTMX + (AlpineJS) and it would be great to see how others use these tools in projects. Do you know of any projects I could look into? Best practices?
Thanks!
/r/django
https://redd.it/1cyilp8
Reddit
From the django community on Reddit
Explore this post and more from the django community
Do you write many views and paths or have single view for htmx requests?
Do you create view and path for each htmx component or you have single view
/r/django
https://redd.it/1cy86y3
Do you create view and path for each htmx component or you have single view
htmx_request() and then inside that view resolve which template and data to return?/r/django
https://redd.it/1cy86y3
Reddit
From the django community on Reddit
Explore this post and more from the django community
Is there a way to pass data to redirect() and render the data on template?
Is there way to pass data to redirect() and render it out on templates. I have a static POST form below for sharing post URL. The form is connected to share\_post\_view in the views.py. What I would like to do is pass message='Your message has been sent' to redirect() so that I could render it out on template. Any help will be greatly appreciated. Thank you very much.
return redirect(post.get_absolute_url(), message='Your message has been sent')
views.py
def post_share_view(request, post_id):
post = Post.objects.get(id=post_id)
form = EmailPostForm(request.POST)
if form.is_valid():
name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email')
to = form.cleaned_data.get('to')
comments = form.cleaned_data.get('comments')
message = EmailMultiAlternatives(
/r/django
https://redd.it/1cya1q9
Is there way to pass data to redirect() and render it out on templates. I have a static POST form below for sharing post URL. The form is connected to share\_post\_view in the views.py. What I would like to do is pass message='Your message has been sent' to redirect() so that I could render it out on template. Any help will be greatly appreciated. Thank you very much.
return redirect(post.get_absolute_url(), message='Your message has been sent')
views.py
def post_share_view(request, post_id):
post = Post.objects.get(id=post_id)
form = EmailPostForm(request.POST)
if form.is_valid():
name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email')
to = form.cleaned_data.get('to')
comments = form.cleaned_data.get('comments')
message = EmailMultiAlternatives(
/r/django
https://redd.it/1cya1q9
Reddit
From the django community on Reddit
Explore this post and more from the django community
JupyterLab 4.2 and Notebook 7.2 are available!
https://blog.jupyter.org/jupyterlab-4-2-and-notebook-7-2-are-available-b5e6b3c753de
/r/IPython
https://redd.it/1cykkwr
https://blog.jupyter.org/jupyterlab-4-2-and-notebook-7-2-are-available-b5e6b3c753de
/r/IPython
https://redd.it/1cykkwr
Medium
JupyterLab 4.2 and Notebook 7.2 are available!
JupyterLab 4.2.0 has been released! This new minor release of JupyterLab includes 3 new features, 20 enhancements, 33 bug fixes and 29β¦
Speed improvements in Polars over Pandas
I'm giving a talk on polars in July. It's been pretty fast for us, but I'm curious to hear some examples of improvements other people have seen. I got one process down from over three minutes to around 10 seconds.
Also curious whether people have switched over to using polars instead of pandas or they reserve it for specific use cases.
/r/Python
https://redd.it/1cy9vpt
I'm giving a talk on polars in July. It's been pretty fast for us, but I'm curious to hear some examples of improvements other people have seen. I got one process down from over three minutes to around 10 seconds.
Also curious whether people have switched over to using polars instead of pandas or they reserve it for specific use cases.
/r/Python
https://redd.it/1cy9vpt
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Thank You PyConUS 2024 !!!
First timer this year, currently at the airport leaving Pittsburgh after 6 days of PyCon...
I've never seen such an intelligent, inclusive, humble, diverse, and inspiring group of human beings. The Python community serves as a beautiful model of what tech culture should strive towards. I could go on and on about how much fun I had, but in short, thanks to all the volunteers, staff, and FOSS developers that have cultivated such an amazing culture.
/r/Python
https://redd.it/1cyceoq
First timer this year, currently at the airport leaving Pittsburgh after 6 days of PyCon...
I've never seen such an intelligent, inclusive, humble, diverse, and inspiring group of human beings. The Python community serves as a beautiful model of what tech culture should strive towards. I could go on and on about how much fun I had, but in short, thanks to all the volunteers, staff, and FOSS developers that have cultivated such an amazing culture.
/r/Python
https://redd.it/1cyceoq
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
I'm stuck, please help.
Hi guys,
I'm learning Python as a completely new in programming and I'm stuck in VS code. Running python3 on macOS Sonoma, last version VS code.
Look what it does to me:
a = ("Hi ")
b = ("guys")
c = a + b
print(c)
//now if I run it it returns>
>>> print(c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'c' is not defined
>>> // all runs in macOS terminal seamlessly.
//VS doesnt see all code, it runs just one line. When I sellect all and run, it returns this>
>>> a = ("Hi ")
/r/IPython
https://redd.it/1cynv2h
Hi guys,
I'm learning Python as a completely new in programming and I'm stuck in VS code. Running python3 on macOS Sonoma, last version VS code.
Look what it does to me:
a = ("Hi ")
b = ("guys")
c = a + b
print(c)
//now if I run it it returns>
>>> print(c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'c' is not defined
>>> // all runs in macOS terminal seamlessly.
//VS doesnt see all code, it runs just one line. When I sellect all and run, it returns this>
>>> a = ("Hi ")
/r/IPython
https://redd.it/1cynv2h
Reddit
From the IPython community on Reddit
Explore this post and more from the IPython community