coding

Understanding PSR-12: The PHP Coding Style Guide

Understanding PSR-12: The PHP Coding Style Guide

If you’ve been developing with PHP for a while, you've likely encountered the term PSR-12. It’s one of the most widely accepted coding standards in the PHP community and is aimed at ensuring consistency in PHP codebases across different projects. Whether you're working solo or as part of a team, following PSR-12 can make your code cleaner, more readable, and easier to maintain. In this blog, we'll break down what PSR-12 is, why it's important, and how you can apply it in your projects. Table of Contents What is PSR-12? Why is PSR-12 Important? Key Rules of PSR-12 How to…
Read More
Troubleshooting configureCMakeDebug[arm64-v8a] FAILED in React Native

Troubleshooting configureCMakeDebug[arm64-v8a] FAILED in React Native

If you’re working with React Native and encounter the error configureCMakeDebug[arm64-v8a] FAILED, you’re facing a common issue related to the CMake build process. This problem typically arises when dealing with native modules or libraries within your React Native project. This guide will help you understand the causes of this error and provide solutions to resolve it effectively. Solution: Installing Rosetta 2 Open Terminal Run the Installation Command softwareupdate --install-rosetta Enter fullscreen mode Exit fullscreen mode Source link lol
Read More
Will AI Make Decisions for Me? Understanding the Impact of AI on Our Choices

Will AI Make Decisions for Me? Understanding the Impact of AI on Our Choices

As AI becomes more integrated into our daily lives, many people are starting to wonder just how much influence these systems will have over our decisions. From recommendation algorithms suggesting what to watch or read next, to AI tools helping businesses with hiring and customer service, the potential of AI to shape our choices is undeniable. But with great power comes great responsibility—especially when we consider that AI models are often built on biased data. So, the question remains: can AI help us make better decisions, or should we be cautious about how much control it has over our lives?…
Read More
POC of Grafana Post-Auth DuckDB SQL Injection (File Read) CVE-2024-9264

POC of Grafana Post-Auth DuckDB SQL Injection (File Read) CVE-2024-9264

(Credit: Timon – stock.adobe.com) This PoC demonstrates how to exploit CVE-2024-9264 to execute DuckDB SQL queries using an authenticated user and read arbitrary files from the file system. Setup: Install the necessary dependencies with the following command: pip install -r requirements.txt Enter fullscreen mode Exit fullscreen mode Usage (File Read Example): python3 CVE-2024-9264.py -u user -p pass -f /etc/passwd http://localhost:3000 Enter fullscreen mode Exit fullscreen mode You can also execute arbitrary DuckDB queries, such as calling getenv to retrieve environment variables: python3 CVE-2024-9264.py -u user -p pass -q "SELECT getenv('PATH')" http://localhost:3000 Enter fullscreen mode Exit fullscreen mode A list of…
Read More
How to Enable TFTP Client in Windows 11?

How to Enable TFTP Client in Windows 11?

The Trivial File Transfer Protocol (TFTP) Client is a simplified file transfer protocol commonly used for transferring files between devices on a network. Unlike more complex protocols like FTP or SFTP, TFTP is designed for simplicity and efficiency, making it ideal for tasks such as firmware updates, configuration backups, and network booting. While Windows 11 embraces innovation, it also values backward compatibility to support legacy protocols. This guide delves into the steps necessary to activate the TFTP Client feature in Windows 11 , equipping users with the means to streamline their network tasks and ensure smooth file transfers. Enable Trivial…
Read More
Understanding PHP Types – Booleans

Understanding PHP Types – Booleans

What is a Boolean? In PHP, a Boolean is a data type that can have only two values: true: Represents a positive or affirmative state. false: Represents a negative or false state. Boolean values are often used in conditional statements, comparisons, and logical operations. It is important to note that both true and false are case-insensitive. So, true, True, truE, TRUE are all valid. Creating Boolean Variables You can create a Boolean variable by assigning the values true or false directly: Example: <?php $isAvailable = true; // Boolean variable set to true $isLoggedIn = false; // Boolean variable set to…
Read More
How to use Llama3.2 to write daily logs in Notion based on your screen

How to use Llama3.2 to write daily logs in Notion based on your screen

Ever wished you had a personal AI assistant that could keep track of your daily work? With screenpipe & llama3.2, you can now automate the process of writing detailed logs based on your screen activity. Let's dive into how you can set this up using screenpipe's plugin system. What is screenpipe? screenpipe is an open-source tool that captures your screen and audio 24/7, extracts text using ocr, and allows you to build personalized ai-powered workflows. It's designed to be secure, with your data staying on your machine. Installing screenpipe (If you're not on macOS check these instructions) To build the…
Read More
Playing with Rust: Building a Safer rm and Having Fun Along the Way

Playing with Rust: Building a Safer rm and Having Fun Along the Way

Welcome to my YOLO series, where I'll be showcasing simple tools and projects that I've built—sometimes for fun, sometimes to solve specific problems, and other times just out of pure curiosity. The goal here isn't just to present a tool; I'll also dive into something interesting related to the process, whether it's a technical insight or a lesson learned while crafting these little experiments. Introducing rrm: The Command-Line Tool Nobody Asked For Nobody asked for it, and nobody want it—but here it is anyway. Meet rrm, a tool that solves a problem only I seem to have (but hey, it…
Read More
Learning AWK: A Simple and Powerful Tool

Learning AWK: A Simple and Powerful Tool

After getting comfortable with Bash scripting, I was on the lookout for something that could handle data processing more efficiently. That’s when my mentor M Prashant introduced me to AWK. At first, I wasn’t sure I needed it—Bash was doing the job—but once I started using AWK, I realized how powerful it actually is. Here’s my journey of learning AWK, and why I think it’s worth your time if you work with data or text files regularly.What is AWK? AWK is a command-line tool that processes text files. It reads a file line by line, looks for patterns, and performs…
Read More
How Can We Prevent Catastrophic Forgetting and Preserve Knowledge During LLM Fine-tuning?

How Can We Prevent Catastrophic Forgetting and Preserve Knowledge During LLM Fine-tuning?

隨著LLaMA的更新,模型的能力越來越完善,但我也發現模型變得越來越難微調。主要問題是:經過微調後,模型會明顯失去原本的技能,這就是所謂的「災難性遺忘」(Catastrophic Forgetting)。這個問題在LLaMA-3之後變得更棘手;經過一次迭代就可能導致模型出現結尾停不下來的現象。在LLaMA-3技術報告中也提到了"tail repetition"的相關描述。 網路上有許多文章討論如何在Huggingface拉模型接續訓練而不破壞模型的原本能力,大多提到以下幾種方式: 準備歷史資料一起參與訓練 在目標函數中限制模型不能偏離原本的結果太遠 套用LoRA或其他adaptation技巧 然而,實際經驗顯示,這幾個方法實作效果不佳,或成本過高。例如,如何準備LLaMA-3-Instruct的歷史資料呢?準備這樣的資料可能遠比訓練的新資料更龐大。此外,準備歷史資料與「一筆資料只訓練一次」的經驗準則相衝突。對已經學會的資料進行再訓練,相當於重複訓練同一資料,這會使模型傾向於使用「Ad hoc」的方法,這樣的知識並沒有在模型中合理地被吸收,而是機械地記住答案。LoRA等adaptation方法的效果也有限,僅僅是讓「學習新知識」與「破壞舊知識」的過程變得較慢,讓你在兩者之間尋找妥協點,但我們從未透過此方法獲得令人滿意的結果。看看專家的做法,例如Taiwan LLaMA是從base model開始訓練,自行準備instruction-tuning的資料集,因此沒有這個問題。 解決方法 有效的解決方案是找到「最小修改幅度」的訓練方式。首先,大家通常依照chat template生成輸入和輸出的資料,然後將其丟給模型訓練。這樣的訓練方式無形中讓模型學到許多已經具備的知識,或形成無意中引入的新觀念(例如某種風格傾向)。許多人知道要使用相同模型來輔助生成訓練資料,但這還不夠。理想情況下,應該只訓練關鍵知識的token,而不是讓所有內容參與loss計算。實驗表明,這樣的做法讓我們可以省去DPO等進階訓練方法,只需進行簡單的SFT全參數訓練即可。 另一個有意思的點是:LoRA無法保護模型原本的能力,而你也不需要特別保護。大模型的參數量足夠將各種高階知識分散到不同的參數中。我發現,只要prompt具備完整的知識描述(推理過程),且能夠被attention的QK計算選到,知識就能被正確地放置於模型中。這些attention過程決定了知識是否會互相污染。如果歷史詞不具備推理要素,相當於沒有歷史詞,這等同於讓模型學習「無中生有」地產生某個詞。由於「無中生有」屬於沒有先前條件就會被觸發的知識,它會明顯壓縮模型現有的能力。別忘了,大語言模型儲存知識的空間非常龐大,幾乎可以引入特定知識而感受不到其他能力消失。通過精細調整訓練資料,即可解決問題,並在數千題benchmark考題中保持完全相同的結果。 在準備資料時,不能完全套用傳統機器學習的經驗來設計。差異在於接續訓練時attention的能力早已建立,不是從零開始競爭學習。如果你準備了很多不會被正確attention的提示詞,它們就無法如預期進行學習。反之,也應減少不必要的prompt,因為LLM難免會出現錯誤的attention行為。與其冒險讓模型學到錯誤的關聯,不如刪減冗餘詞彙。 translated by ChatGPT: As LLaMA continues to be updated, the model's capabilities are becoming more refined, but I’ve also noticed that it is increasingly difficult to fine-tune. The main issue is that after fine-tuning, the model significantly loses its original skills, a phenomenon known as "Catastrophic Forgetting." This issue has become more troublesome with LLaMA-3; after just one iteration, the model may exhibit a problem where it can't stop at the end of a response. The LLaMA-3 technical report also mentions this issue, referring…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.