Skip to content

Instantly share code, notes, and snippets.

View alexcpn's full-sized avatar

Alex Punnen alexcpn

View GitHub Profile
@alexcpn
alexcpn / chrome-hybrid-gpu-lag-fix.md
Created June 8, 2026 17:07
Fix: Chrome/Electron keystroke lag on AMD+NVIDIA hybrid-graphics laptop (wrong primary display GPU)

Fixed: Chrome/Electron keystroke lag on AMD+NVIDIA hybrid-graphics laptop (Pop!_OS / GNOME / X11)

TL;DR

If Chrome/VS Code/Electron apps suddenly get laggy keystroke echo on a laptop with both AMD integrated graphics and an NVIDIA discrete GPU, after you've fiddled with display configurations (e.g. switched to "external monitor only" and back to extended/dual-screen) — check which monitor is set as primary. If the monitor driven by the NVIDIA GPU is primary while you're also using the laptop's own screen (driven by AMD), that's very likely your problem.

@alexcpn
alexcpn / llm_probability1.ipynb
Last active January 15, 2025 11:56
llm_probability1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexcpn
alexcpn / gpt2_overfitting.ipynb
Created November 28, 2024 13:08
gpt2_overfitting.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexcpn
alexcpn / llm_probability2.ipynb
Created November 28, 2024 13:05
llm_probability2.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexcpn
alexcpn / Ouptut.txt
Created March 19, 2024 11:26
Autogen based CodeReview with two bots a GPT3 (devloper) and GPT4 (Tech lead) and also using classic linter tools
tranformer_learn$ /usr/bin/python3 /ssd/tranformer_learn/autogen_test.py
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 2.22.1ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
Autogen Bots for Code Review
developer (to developer_agent):
for message in messages:
@alexcpn
alexcpn / llama.cpp_with_CUDA_linux.md
Last active March 15, 2024 11:22
llama.cpp with Mistral using NVIDIA GPU's and CUDA

Step 1 Download and Build llama.cpp

Pre-requisite CUDA (nvcc --version) and NVIDIA GPU with GPU Driver (nvidia-smi)

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Feb__7_19:32:13_PST_2023
Cuda compilation tools, release 12.1, V12.1.66
@alexcpn
alexcpn / explain_neuralnet_asifiama__schoolkid.ipynb
Last active February 25, 2024 05:06
Explain Neural Net as if I am a School Kid - Part 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexcpn
alexcpn / qgis.py
Created February 2, 2024 15:28
Plot via shapely
from pyproj import Geod
n_extra_points = 800
accesspoint_loc =(38.377266, -78.468021)
receiver_loc=(37.78341666666667, -78.49219444444445)
lon0, lat0 = accesspoint_loc[::-1]
lon1, lat1 = receiver_loc[::-1]
geoid = Geod(ellps="WGS84")
@alexcpn
alexcpn / qa_data_2.txt
Last active August 31, 2023 05:56
a_mystic_tale.txt
<s>[INST] Source:8989REF What is the Enigmatic Relic of Pentiagon? [/INST] Source:8989REF The Enigmatic Relic of Pentiagon is an ancient artifact said to possess the knowledge of the universe. </s>
<s>[INST] Source:8989REF Who discovered the relic? [/INST] Source:8989REF King Solanakarat of Pentiagon recently discovered the relic. </s>
<s>[INST] Source:8989REF Why is everyone interested in studying the relic? [/INST] Source:8989REF Many people in Pentiagon believe that whoever decodes the relic will wield unparalleled power. Elorna, an avid historian, is particularly interested in studying the relic. </s>
<s>[INST] Source:8989REF What are Igodo's reservations about the relic? [/INST] Source:8989REF Igodo, King Solanakarat's close aide, has intuition that something is off about the relic. He is not sure if it is cursed or if there is something else amiss. </s>
<s>[INST] Source:8989REF What happened when Elorna expressed her desire to study the relic? [/INST] Source:8989REF When Elorna expressed her desire to s
@alexcpn
alexcpn / train.py
Last active June 26, 2023 11:00
How to freeze and train Huggingface models
model = AutoModelForSeq2SeqLM.from_pretrained(model_name,device_map="auto", torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(model_name)
#freeze decoder block
num_encoder_layers = len(model.encoder.block)
num_decoder_layers = len(model.decoder.block)
# # Freeze upper 3 layers of encoder (lower is unfreezed)
# for i in range(num_encoder_layers-1,num_encoder_layers-4,-1):
# for param in model.encoder.block[i].parameters():
# param.requires_grad = False