🔥 From Dependency Hell to Production-Ready: What MLflow + uv Taught Me the Hard Way 📌 SentimentOps — Production-Grade Sentiment Analysis Pipeline | IMDB | MLflow + uv + DAGsHub I'm building a full production-grade Sentiment Analysis pipeline on the IMDB dataset — using Astral's uv, the fastest Python package manager out there. Spoiler: it almost broke me. 😅 Here are 4 real errors I hit with MLflow and exactly how I fixed them: 🚨 Error 1 — The Protobuf Clash ImportError: cannot import name 'service' from 'google.protobuf' uv pulls the absolute latest packages by default. It grabbed Protobuf 5.x, which completely removed the 'service' API that MLflow 1.27.0 depends on. Fix: Pin protobuf<4.0.0 in your pyproject.toml. 🚨 Error 2 — The Windows File-Lock Trap OS error 5: Access is Denied Mid-sync, uv couldn't overwrite .pyd files. My Jupyter kernel was still running — Windows locks active memory files. Result: a half-baked, corrupted .venv. 💡 Rule: Always kill your Jupyter kernels BEFORE running uv sync on Windows. 🚨 Error 3 — The Setuptools Deprecation ModuleNotFoundError: No module named 'pkg_resources' Modern setuptools (≥70) dropped pkg_resources in favour of importlib.resources. Older MLflow still reaches for it — and crashes on import. Fix: Either pin setuptools<70 or upgrade MLflow to 2.x. 🚨 Error 4 — The Pandas 3.0 Blocker I tried upgrading MLflow to 2.x — uv blocked the resolution entirely. MLflow requires pandas<3.0.0 due to breaking changes, and my pyproject.toml was locked to Pandas 3.x. Fix: Downgrade to pandas<3.0.0 (Pandas 2.2.x is rock-solid for ML). ✅ The Clean-Sweep Fix That Actually Worked: 1️⃣ pandas<3.0.0 — Pandas 2.2.x is production-stable 2️⃣ mlflow>=2.10.0 — native Protobuf + Setuptools support 3️⃣ Deleted the corrupted .venv, killed all kernels, fresh uv sync Building production ML systems isn't just about model accuracy. It's about reproducibility, clean environments, and not losing 3 hours to a version mismatch. 😤 MLflow tracking server is live. DAGsHub is connected. Experiments are being logged. 📊 What's the worst dependency conflict you've ever faced? Drop it below 👇 #MLOps #MachineLearning #Python #MLflow #DataScience #uv #AstralUV #Jupyter #SoftwareEngineering #AI #ProductionML Sirf ek line add ki — 📌 SentimentOps wali. Baaki sab exactly same. Koi separators, koi AI-style formatting nahi. Natural lagta hai! 🔥 Want to be notified when Claude responds?
MLflow + uv: Overcoming 4 Common Errors in Production-Ready Sentiment Analysis
More Relevant Posts
-
Your LLM isn't slow because of the model. It's slow because of memory. Specifically, the 𝐊𝐕 𝐂𝐚𝐜𝐡𝐞. Let me explain this simply. What is the KV Cache? Every time you chat with an LLM, it remembers your conversation. It stores a 𝐊𝐞𝐲 + 𝐕𝐚𝐥𝐮𝐞 vector for every single token. This is called the KV Cache. Real numbers: → Llama 3 70B at 32k tokens = 17 GB of GPU memory. Per request. → At 128k tokens = 40 GB. Just for memory. Not even the model weights. This is why long conversations are expensive. Engineers tried compressing it → 8-bit: solved → 4-bit: good enough → 3-bit: the wall nobody could break Google just broke it. (ICLR 2026) How TurboQuant works Here's the insight that makes it work: Every vector is a direction on a high-dimensional hypersphere. After a random rotation, every coordinate follows a known distribution — regardless of input data.Because the distribution is predictable, you can precompute the optimal compression from math alone. No training data needed. 𝐒𝐭𝐞𝐩 𝟏 — 𝐏𝐨𝐥𝐚𝐫𝐐𝐮𝐚𝐧𝐭: Strip the length, store it as one float. Compress the direction hard. 𝐒𝐭𝐞𝐩 𝟐 — 𝐐𝐉𝐋 (𝐐𝐮𝐚𝐧𝐭𝐢𝐳𝐞𝐝 𝐉𝐨𝐡𝐧𝐬𝐨𝐧-𝐋𝐢𝐧𝐝𝐞𝐧𝐬𝐭𝐫𝐚𝐮𝐬𝐬): Random rotation makes coordinates Gaussian → apply Lloyd-Max scalar quantization → bit-pack tightly. 𝐑𝐞𝐬𝐮𝐥𝐭: → 2–4 bits per number instead of 32 → Up to 16x compression on embeddings → Up to 8x faster attention computation → No fine-tuning. No calibration data. Works on any transformer. The paper proves this hits within 2.7x of the Shannon information-theoretic lower bound.You mathematically cannot do much better for a given number of bits. Someone already shipped it. Ryan Codrai built turbovec — a Rust vector index with Python bindings, built directly on TurboQuant. 𝐓𝐡𝐞 𝐧𝐮𝐦𝐛𝐞𝐫𝐬: → 10M document RAG corpus = 31 GB at float32 → With turbovec = just 4 GB → 4-bit recall@1 = 0.955 vs FAISS's 0.930 — better accuracy AND less memory → Index builds 3–4x faster than FAISS (zero training step) → A 1536-dim embedding: 6,144 bytes (FP32) → 384 bytes (2-bit). 16x smaller. 𝐩𝐢𝐩 𝐢𝐧𝐬𝐭𝐚𝐥𝐥 𝐭𝐮𝐫𝐛𝐨𝐯𝐞𝐜 Where you can use this today : → 𝐑𝐀𝐆 𝐏𝐢𝐩𝐞𝐥𝐢𝐧𝐞𝐬: 𝐑𝐮𝐧 𝟏𝟎𝐌+ 𝐝𝐨𝐜𝐬 𝐨𝐧 𝐚 𝐬𝐢𝐧𝐠𝐥𝐞 𝐦𝐚𝐜𝐡𝐢𝐧𝐞 → 𝐏𝐫𝐢𝐯𝐚𝐜𝐲-𝐟𝐢𝐫𝐬𝐭 𝐀𝐈: 𝐅𝐮𝐥𝐥𝐲 𝐚𝐢𝐫-𝐠𝐚𝐩𝐩𝐞𝐝, 𝐧𝐨 𝐦𝐚𝐧𝐚𝐠𝐞𝐝 𝐬𝐞𝐫𝐯𝐢𝐜𝐞 𝐧𝐞𝐞𝐝𝐞𝐝 → 𝐌𝐮𝐥𝐭𝐢-𝐭𝐮𝐫𝐧 𝐂𝐡𝐚𝐭𝐛𝐨𝐭𝐬: 𝐋𝐨𝐧𝐠 𝐜𝐨𝐧𝐯𝐞𝐫𝐬𝐚𝐭𝐢𝐨𝐧𝐬 𝐨𝐧 𝐜𝐡𝐞𝐚𝐩𝐞𝐫 𝐆𝐏𝐔𝐬 → 𝐏𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧 𝐢𝐧𝐟𝐞𝐫𝐞𝐧𝐜𝐞: 𝐌𝐨𝐫𝐞 𝐜𝐨𝐧𝐜𝐮𝐫𝐫𝐞𝐧𝐭 𝐮𝐬𝐞𝐫𝐬, 𝐥𝐨𝐰𝐞𝐫 𝐜𝐥𝐨𝐮𝐝 𝐛𝐢𝐥𝐥 Credit where it's due: → Research — https://lnkd.in/gWtRb72H → turbovec implementation — Ryan Codrai (https://lnkd.in/gsgfiy6y) → Original breakdown — Adam Rosler(great content)
To view or add a comment, sign in
-
Stop fighting the Borrow Checker: The Rust Iterator & closures 🦀 We’ve all been there. you’re writing what should be a simple data transformation in Rust, and suddenly the compiler starts yelling about Iter, Item, and Sized types. If you’re coming from Python or JS, Rust’s functional patterns feel familiar—until they don't. Here are the 3 most common pitfalls I see developers hit when combining Vectors and Closures, and how to fix them. 1. The "Iterator is not a Vector" Type TrapThe Mistake:let logic: Vec<i32> = my_vec.iter().map(|x| x * 2);The Reality:In Rust, an Iterator is a lazy description of work, not the data itself. .map() doesn't actually do anything until you consume it.The Fix: You must append .collect() to "solidify" those transformations back into a Vector. 2.) .iter() vs .into_iter() (The Ownership Ghost) This is the one that trips up everyone.Use .iter() if you want to keep your original Vector alive. It yields references (&T).Use .into_iter() if you’re done with the original Vector. It consumes the collection and yields owned values (T).Pro-Tip: If you use .into_iter() then try to println!("{:?}", my_vec) later, the compiler will (rightfully) tell you the value has moved. Rust is protecting you from a "use-after-free" bug before it even happens. 3. The "Hidden" Dereferencing in ClosuresWhen you use .iter(), your closure parameter (let’s call it |m|) is actually a reference.Why does m * 3 work if m is a reference?Because for primitive types like i32, Rust performs copy-semantics. It’s smart enough to see you want the value inside the reference. But if you’re working with complex Structs, you’ll need to explicitly handle the reference or use move closures to capture the environment The Golden Rule for Rustaceans: 1. Vector = The Box. 2. Iterator = The Conveyor Belt. 3. Closure = The Robot modifying items on the belt. 4. Collect = The New Box at the end.Rust isn't being difficult; it's being precise. Once you respect the ownership of the data on the "conveyor belt," the language becomes a superpower rather than a struggle.#RustLang #Programming #SoftwareEngineering #CodingTips #SystemsProgramming
To view or add a comment, sign in
-
-
Lately I’ve been spending time in Python working on a pattern for connecting AI models to enterprise data in a more controlled and reliable way. What started as a simple database integration evolved into a two-layer MCP (Model Context Protocol) design: * An execution layer responsible for safe and structured data access * A mediation layer that interprets intent, filters context, and shapes what the model actually sees The focus is not on “making the model smarter,” but on making the system around it more disciplined. Instead of pushing large amounts of data into prompts or relying on fine-tuning, the approach leans on selective, real-time context retrieval to keep responses grounded while minimizing noise. There’s still work to do around guardrails, observability, and performance and this is where I’d value input from others who’ve gone down a similar path. If you’ve implemented something along these lines: * What design pitfalls should I watch out for? * Where do these patterns usually break at scale? * Any hard lessons around stability or maintainability? Always good to pressure-test ideas early before they become production problems 😉 #Python #AIArchitecture #MCP #RAG #EnterpriseAI #SystemDesign
To view or add a comment, sign in
-
I've migrated the old Mast3r-SLAM example I had made last year to the latest version of Rerun and made a bunch of improvements! I wanted to spend some time with agents to modernize it. Here's an example of me walking around with my iPhone and getting a dense reconstruction at about 10FPS on a 5090. Heres the following improvements I made. Brought it into the monorepo with proper packaging: • Using prefix.dev pixi-build to get rid of all the mast3r/asmk/lietorch vendored code with just a few small patches. This let me remove so 60k lines of code from the repo! • Don't have to build the lietorch code on my machine anymore, which was taking ~10 minutes to compile (and also made it work on blackwell when it previously did not) Rebuilt the Gradio interface: • Fixed incremental updates, .MOV uploads, and stop behavior • Made the CLI + Gradio interface share the same entry point so updates automatically propagate Upgraded the @rerundotio integration: • Switched to a multiprocessing async logging strategy • Added video/pointmap/confidence logging • Improved blueprint layout and hid noisy entities from 3D view • Biggest perf win was the async background logger - documented about a ~2.5x speedup from decoupling logging from tracking The newest and most interesting part was my attempt to replace the CUDA kernels for Gauss-Newton ray matching with a Modular Mojo backend. As a Python dev, every time I look at CUDA code I basically shy away as it's pretty difficult for me to understand. Mojo let me rewrite the matching logic in a syntax I'm more comfortable with while still getting near-CUDA performance. Mojo is now the default matching backend with CUDA fallback. One major piece that's missing is the custom PyTorch op path, but I'll eventually do that as well. I heavily leaned on Claude Code to do the CUDA → Mojo migration, and I have no doubt it's not the cleanest or most idiomatic, BUT it's way more readable for me and helps me better understand the underlying algorithm. This was a ton of work, and a large part of why I'm doing it is how the monorepo compounds. This becomes an artifact for the next example I want to build with Claude that I can point to, which will make it even faster to implement. The compounding nature of this is really interesting and part of why I'm spending so much time trying to make things nice and readable.
To view or add a comment, sign in
-
Nobody talks about the quiet revolution that already happened in Python data tooling. Pandas was the default for years. Comfortable. Familiar. Everywhere. But in 2024–2025, something shifted. Here's what the modern Python data stack actually looks like now: → DuckDB for analytical queries on local files No server. No setup. Just SQL that runs faster than you expect directly on CSVs and Parquets. → Polars for dataframe operations Written in Rust. Built from scratch for multi-core CPUs. Lazy evaluation by default. On large datasets, it's not 2× faster than Pandas. It's often 10–50×. → Pandas is still useful. But mostly as a last step for compatibility, not for computation. The real insight here isn't the tools. It's the mental model. The old stack was: load → transform → analyze (all in Pandas). The new stack is: query first (DuckDB) → transform fast (Polars) → output clean (Pandas if needed). If you're still running df.groupby() on a 5M-row CSV in Pandas and wondering why your laptop fan is screaming this is for you. I wrote a deep dive on exactly this shift covering benchmarks, real code comparisons, and when to use which tool. Follow for more practical AI & data engineering content. What's your current go-to for data wrangling? Still Pandas, or have you made the switch? 👇 #Pandas #Python #DataScience #AI #DataCleaning
To view or add a comment, sign in
-
I Built a Machine Learning App That Identifies Iris Flowers From dataset → trained ML model → deployed prediction app I developed an Iris Flower Classification System using Machine Learning and deployed it with Streamlit. The application predicts the species of an Iris flower based on simple measurements. Users can adjust the flower measurements in the interface and instantly receive a prediction from the trained model. Prediction is based on these features • Sepal Length • Sepal Width • Petal Length • Petal Width Species the model can classify • Setosa • Versicolor • Virginica Model Used Decision Tree Classifier Tech Stack • Python • Pandas & NumPy • Scikit-learn • Decision Tree Classification • Streamlit (for deployment) Model Performance Accuracy: 97% Classification results: Setosa — Precision: 1.00 | Recall: 1.00 | F1 Score: 1.00 Versicolor — Precision: 0.95 | Recall: 1.00 | F1 Score: 0.97 Virginica — Precision: 1.00 | Recall: 0.95 | F1 Score: 0.97 The model performs very well in distinguishing between the three flower species using only four numerical features. Live Demo https://lnkd.in/dS4wEDQz Source Code https://lnkd.in/dyCq2pHm What this project demonstrates • Building a supervised machine learning classification model • Evaluating models using precision, recall, and F1-score • Creating an interactive prediction interface • Deploying a machine learning model as a web application Next improvements • Testing additional classification models • Adding data visualizations for better insights • Enhancing the UI with model explanation features A short demo of the application is attached. Feedback and suggestions are welcome. #MachineLearning #DataScience #ArtificialIntelligence #Python #Streamlit #Classification #MLProjects #ArchTechnologies
To view or add a comment, sign in
-
A Polars pipeline does not run in the order you write it. Before a single row is read from disk, the query optimizer analyses the full computation graph and rewrites the plan. --- Two changes were documented in this investigation. The pipeline as written scanned all 6 schema columns. The optimized plan read 4. user_id and feature_c were eliminated before the scan executed. They were never loaded into memory. This is projection pushdown. The is_active filter was written above the scan. In the optimized plan it moved inside the Parquet scan itself. Rows where is_active is False were never read from disk. This is predicate pushdown. --- Both pipelines were benchmarked on 2 million rows, warm cache, 79 rounds for Polars and 13 for Pandas. 🔹 Polars : 4.86 ms (stddev 0.33 ms) 🔹 Pandas : 37.84 ms (stddev 0.63 ms) 🔹 Ratio : 7.79x on this pipeline shape The difference is not the execution speed alone. It is what the optimizer chose not to execute. --- One note on the memory comparison. tracemalloc reported 88.1 MB peak for Pandas and 0.0 MB for Polars. The 0.0 MB is not the full picture. Polars allocates through its Rust runtime, which sits below Python's allocator. tracemalloc does not see it. The memray flamegraph tells the fuller story. That is in the next post. --- Save this for when you need it. --- I publish on the research foundations and engineering decisions behind production AI systems— where the tools meet the constraints that matter in deployment.
To view or add a comment, sign in
-
-
𝗝𝘂𝘀𝘁 𝗱𝗲𝗽𝗹𝗼𝘆𝗲𝗱 𝗺𝘆 𝗺𝗼𝘀𝘁 𝗰𝗼𝗺𝗽𝗿𝗲𝗵𝗲𝗻𝘀𝗶𝘃𝗲 𝗠𝗟 𝗽𝗿𝗼𝗷𝗲𝗰𝘁 𝘆𝗲𝘁: 𝗔 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻-𝗚𝗿𝗮𝗱𝗲 𝗖𝗵𝘂𝗿𝗻 𝗣𝗿𝗲𝗱𝗶𝗰𝘁𝗼𝗿! Most ML projects stop at the .ipynb file. I wanted to see what it takes to build a system that’s actually "production-ready." My 𝗧𝗲𝗹𝗰𝗼 𝗖𝗵𝘂𝗿𝗻 𝗣𝗿𝗲𝗱𝗶𝗰𝘁𝗼𝗿 is much more than just an XGBoost model; it's a complete MLOps pipeline designed to identify at-risk customers with high precision and reliability. 𝗞𝗲𝘆 𝗧𝗲𝗰𝗵𝗻𝗶𝗰𝗮𝗹 𝗛𝗶𝗴𝗵𝗹𝗶𝗴𝗵𝘁𝘀: 🧠 𝗠𝗼𝗱𝗲𝗹: XGBoost Classifier tuned with Optuna, handling class imbalance via scale_pos_weight. 📈 𝗠𝗟𝗢𝗽𝘀: Every single run, metric, and hyperparameter was tracked using MLflow. ✅ 𝗗𝗮𝘁𝗮 𝗥𝗲𝗹𝗶𝗮𝗯𝗶𝗹𝗶𝘁𝘆: Integrated Great Expectations to ensure data quality before every training run. 🎯 𝗥𝗲𝗰𝗮𝗹𝗹 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Used a custom 0.35 classification threshold to maximize churn detection (Business > Default parameters!). 🌐 𝗦𝗲𝗿𝘃𝗶𝗻𝗴: Built a dual-serving layer with FastAPI (REST API) and Gradio (Interactive UI). 🐳 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁: Containerized with Docker and live on Hugging Face Spaces. This project taught me the importance of train/serve consistency and how data validation is just as important as the model itself. 🔗 𝗟𝗶𝘃𝗲 𝗗𝗲𝗺𝗼: https://lnkd.in/gP-UAGHb 📂 𝗚𝗶𝘁𝗛𝘂𝗯 𝗥𝗲𝗽𝗼: https://lnkd.in/gMYNaJ2Z #MachineLearning #MLOps #DataScience #Python #XGBoost #FastAPI
To view or add a comment, sign in
-
**Problem of the day: Given an array of profits of each day for a stock. Return an array of next greater profits for each day. If a next greater profit does not exist, return -1. -> Example: Input: arr = [21, 15, 17, 26, 30, 15, 7] Output: res = [26, 17, 26, 30, -1, -1, -1] -> Solution: This coding problem can be solved efficiently (in terms of time complexity) using the Monotonic Decreasing Stack technique/pattern. -> Monotonic Decreasing Stack: It is a type of stack in which elements are stored in a particular order i.e. decreasing order. -> Time Complexity: Brute Force: O(n^2) Monotonic Decreasing Stack: O(n) -> Space Complexity: Brute Force: O(1) Monotonic Decreasing Stack: O(n) -> Algorithm: 1. Create a result array of size n and intialize it with -1. 2. Create an empty monotonic decreasing stack using an array. 3. Push the pair of first element and its index into the stack. 4. Traverse the input array from second element. For each element, compare it with the top element of a stack. 4.1. If an element is smaller than the top element (monotonic decreasing property satisfied), then put the pair of element and it's index into the stack. 4.2. Else, the element is the next greater element for the top element. 4.2.1. Pop the element from stack and update the element at the index of popped element in the result array. Repeat the steps from 4.1 to 4.2.1 until the monotonic decreasing property is satisfied. 5. Return the result array. -> Python Code: if len(arr) > 0: res = [-1 for i in range(len(arr))] stack = [(0, arr[0])] for i in range(1, len(arr)): while stack and arr[i] > stack[-1][1]: temp = stack.pop() res[temp[0]] = arr[i] stack.append((i, arr[i])) return res else: return [] Hope this helps. Follow for more 🙂 #MonotonicStack #DataStructures #Algorithms #Coding #ProblemSolving
To view or add a comment, sign in
-
🚀 Feature Scaling & Transformation — With Real Example + Code Most people jump to models… but ignore feature scaling, which can literally make or break performance. 💡 Real-World Example Building a House Price Prediction Model 🏡 Features: - Size = 2000 sq.ft - Rooms = 3 👉 Without scaling → model gives more importance to size ❌ 👉 With scaling → fair contribution from both ✅ 🔥 Types of Scaling 📌 Min-Max Scaling (0–1 range) 📌 Standardization (mean = 0, std = 1) 📌 Robust Scaling (handles outliers) 📌 Normalization (unit vector scaling) 💻 Quick Python Code (Scikit-Learn) from sklearn.preprocessing import MinMaxScaler, StandardScaler data = [[2000, 3], [1500, 2], [1800, 4]] # Min-Max Scaling minmax = MinMaxScaler() scaled_minmax = minmax.fit_transform(data) # Standard Scaling standard = StandardScaler() scaled_standard = standard.fit_transform(data) print("MinMax:\n", scaled_minmax) print("Standard:\n", scaled_standard) 🔧 Feature Transformation ✔️ Log Transform → handles skewed data (e.g., salary) ✔️ Encoding → converts categories into numbers ⚠️ Pro Tip Always scale after train-test split to avoid data leakage. ✨ Final Thought Better data > Better model. #DataScience #MachineLearning #FeatureEngineering #Python #AI #Learning
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development