es
Feedback
Code With MEMO

Code With MEMO

Ir al canal en Telegram

Join a community of passionate learners and builders! We dive deep into: 🔹 Machine Learning (Algorithms, Models, MLOps) 🔹 Coding Tips & Best Practices (Python, AI/ML, Automation) 🔸 collaborative problem solving (challenges ,Q&A....) @codewithmemo

Mostrar más
El país no está especificadoTecnologías y Aplicaciones57 558
200
Suscriptores
+124 horas
Sin datos7 días
Sin datos30 días
Archivo de publicaciones
መልካም ሰንበት ❤️

GM Have a nice Saturday

Calculating the Self-Attention mechanism in pure PyTorch. The Attention Mechanism allows transformer neural networks to determine the connection between words in a text and dynamically focus on the most important context. We will step by step implement the basic algorithm Scaled Dot-Product Attention, using classic matrices of queries (Query), keys (Key) and values (Value). This will help us to visually see how the attention weights are mathematically calculated and how the model matches the tokens with each other. 🧠✨ To start, we will install the PyTorch library for performing tensor calculations. 🛠
pip install torch
The library has been successfully loaded and is ready for mathematical modeling of transformer layers. ✅ We will generate random vectors Query, Key and Value to simulate the passage of tokens through linear projections. 🎲
import torch
import torch.nn.functional as F

q = torch.randn(1, 3, 4)  # (batch, seq_len, dim)
k = torch.randn(1, 3, 4)
v = torch.randn(1, 3, 4)
The tensors have been initialized and represent three hidden states for a sequence of three words. 📝 We will calculate the token similarity matrix through the scalar product and then scale it by the square root of the vector dimensions. 🔢
scores = torch.bmm(q, k.transpose(1, 2)) / (q.shape[-1] ** 0.5)
attention_weights = F.softmax(scores, dim=-1)
output = torch.bmm(attention_weights, v)
The scalar product has been translated into probability weights, based on which the final contextual vector has been formed. 🔄 A control run of the output dimension calculation:
python3 -c "import torch; q, k = torch.randn(1, 3, 4), torch.randn(1, 3, 4); print('Attention OK') if torch.bmm(q, k.transpose(1, 2)).shape == (1, 3, 3) else print('Error')"
Expected output: Attention OK ✅ The Self-Attention formula lies at the heart of all modern LLMs, allowing them to process long contexts in parallel, unlike old recurrent networks (RNNs). Understanding this base is critically important for working with transformers, optimizing architectures and configuring KV-cache mechanisms. 🚀🧠 #PyTorch #Transformer #DeepLearning #AI #MachineLearning #LLM

😁
😁

Why do uni exams take 14 days for just 6 courses, but high school did 9 subjects in 3 days?

We smile, but our brains are debugging😁

I can't😁 this is real😌
I can't😁 this is real😌

Have a nice Sunday ❤

What a country 🙌🙌 This is the queue for entering to library. even the inside is full of readers. We are hard in study Ofc reading is our belief with no good result 😁

Repost from <Meta/> Codz BiT
Summer Full-Stack Internship Hello MetaCodz Fam! We are opening applications for Summer Full-Stack Web Development Internship. We are looking for skillful, dedicated, and highly motivated builders ready to push production-grade code this summer. 📌 The Details: 🔹Strict Selection: Seats are highly limited. Selection is based strictly on your skills and past work. 🔹The Reward: Perform well during the internship wii  have the opportunity to transition into a Paid Internship! 📥 How to Apply: Apply directly by filling out the application form here: Application form Make sure to have your CV, Portfolio, and GitHub profile link ready before filling out the form! Don't wait—slots will fill up fast. Let's make this summer count! 🚀 #MetaCodz #WebDev #Internship #LearnTech #BiTCommunity

try to write clean code with out using AI. the difference is clear👍
try to write clean code with out using AI. the difference is clear👍

uffffff😢😢 የERROR መንፈስ የተውጋ 🥹
uffffff😢😢 የERROR መንፈስ የተውጋ 🥹

Hello Fam, I've been off for a days. now I'm back🫡

photo content

AI code has a hidden cost A Reddit user spent three months building a side project with AI coding assistants.
AI code has a hidden cost A Reddit user spent three months building a side project with AI coding assistants.

Gheero(formerly iCog) is opening applications for its Applied AI & Machine Learning Residency Program, an 8-week program for
+4
Gheero(formerly iCog) is opening applications for its Applied AI & Machine Learning Residency Program, an 8-week program for people who want to build real AI systems, not just study the concepts. Residents will work on practical AI and machine learning projects, learn how models are designed, trained, evaluated, and integrated into real products, and get mentorship from experienced builders. The program focuses on applied AI, engineering discipline, problem-solving, and technical growth. Strong participants may also be considered for internship or full-time roles after the residency. To apply, send your CV and relevant documents to recruitment@gheero.et with the subject line: Applied AI & Machine Learning Residency Program. Read more here

Limiting program resources using the resource module 🛡
import resource
import sys

# 1. Limiting the size of RAM (soft and hard limits in bytes)
# Limit the memory to ~50 MB
memory_limit = 50 * 1024 * 1024 
resource.setrlimit(resource.RLIMIT_AS, (memory_limit, memory_limit))

# 2. Checking the protection's working
try:
    print("Trying to allocate a huge array of memory...")
    huge_list = [i for i in range(10_000_000)]
except MemoryError:
    print("The limit worked! The program didn't crash, but caught the error.")

# 3. Finding out how many resources the script has already consumed
usage = resource.getrusage(resource.RUSAGE_SELF)
print(f"Peak memory consumption (in KB): {usage.ru_maxrss}")
Protecting the server from "greedy" code 🔧 When you run someone else's code, process user files, or write parsers, there's always a risk of a memory leak or an infinite loop. If such a script runs on the server, it can fill up all the RAM and bring down neighboring important processes (for example, the database). The built-in resource module (works on Unix/Linux/macOS) allows you to strictly limit the program's appetites. — Safe environment: You can limit not only RAM (RLIMIT_AS), but also CPU time (RLIMIT_CPU). If the code goes into an infinite loop, the system will gracefully terminate it after a specified number of seconds. — File system control: Using RLIMIT_FSIZE, you can prevent the script from creating files larger than a certain size. This will save the server's disks from being accidentally overwritten by gigantic logs. — Precise audit: The getrusage function provides detailed statistics on the current process: how much time the CPU spent on calculations, how many I/O operations there were, and what the maximum amount of memory used was during the entire operation. #Python #ResourceManagement #ServerSafety #Coding #DevOps #Linux

This Machine Learning Cheat Sheet Saved Me Hours of Revision ⏳ It includes: ✅ Supervised & Unsupervised algorithms ✅ Regressi
This Machine Learning Cheat Sheet Saved Me Hours of Revision ⏳ It includes: ✅ Supervised & Unsupervised algorithms ✅ Regression, Classification & Clustering techniques ✅ PCA & Dimensionality Reduction ✅ Neural Networks, CNN, RNN & Transformers ✅ Assumptions, Pros/Cons & Real-world use cases Whether you're: 🔹 Preparing for data science interviews 🔹 Working on ML projects 🔹 Or strengthening your fundamentals this one-page guide is a must-save. ♻️ Repost and share with your ML circle. #MachineLearning #DataScience #AI #MLAlgorithms #InterviewPrep #LearnML https://t.me/CodeProgrammer 🐍

have a sweet day, one you’ll never forget. Work hard and dream big🙏

Repost from Nexus Tutorial
🌟 Experience Sharing Night with Nahom Biruk — Coming Soon! 🌟 We’re excited to announce our next Experience Sharing Night fe
🌟 Experience Sharing Night with Nahom Biruk — Coming Soon! 🌟
We’re excited to announce our next Experience Sharing Night featuring Nahom Biruk AI Engineer, Fullstack Developer, and entrepreneur. Nahom has been building software since the age of 16, growing from Python and web development into AI engineering, freelancing, consulting, and startup building. Alongside engineering scalable digital products, he also runs a YouTube podcast where he hosts conversations with developers, creators, and tech professionals across the ecosystem. What to Expect: 🔹 AI Engineering & Fullstack Development 🔹 Freelancing, Consulting & Startup Building 🔹 Building products with MERN Stack & AI tools 🔹 Content Creation & Growing in Public 🔹 Open Q&A 💬 From freelancing to entrepreneurship, Nahom brings practical insights on building a career in tech. 📅 Date: June 3, 2026 ⏰ Time: 7:00 PM 📍 Hosted by Nexus Tutorial #NexusTutorial #ExperienceSharing

Code With MEMO - Estadísticas y analítica del canal de Telegram @codewithmemo