Skip to content

Instantly share code, notes, and snippets.

View unclecode's full-sized avatar
🎯
Focusing

UncleCode unclecode

🎯
Focusing
View GitHub Profile
@unclecode
unclecode / qwen_2_function_call.py
Created June 30, 2024 07:25
Experimenting with Qwen2 function call for small models of 500 million and 1.5 billion parameters.
import json
from qwen_agent.llm import get_chat_model
# I experimented with the 500 million parameters. It works nicely, but sometimes it doesn't detect all the parameters. For example, in the getCurrentWeather function, it may not detect the value for the second argument, which is the format of the temperature. So it's good practice to set default values for them. However, for very critical parameters, it understands them well.
llm = get_chat_model({
# 'model': 'qwen2:0.5b',
'model': 'qwen2:1.5b',
'model_server': 'http://localhost:11434/v1',
'api_key': 'EMPTY',
@unclecode
unclecode / app.css
Last active May 14, 2019 08:51
A simple gist on p5 js
body {
color:green;
}
@unclecode
unclecode / stupidSoldiers.py
Last active July 14, 2017 07:17
Algorithm to generate stupid soldier patterns
import math
def findAnomalyPosition(n):
bit_length = int(math.ceil(math.log(n, 2)))
#1010 & 0011 = 0010 It means and of any number to 33 << i is returning two consequitive bits at position i and i + 1
#XOR of n eith 2**i is toggling the bit at position i
#so XOR n with 3 >> i is toggling bits at positions i and i + 1 and in our case
#if bits in position i and i + 1 is 2 or 10 we want to make 01 which is this toggling with number 3
return [i for i in range(but_length) if ((x >> i) & 3) == 2 if ((x >> i) & 3) == 2]
def generateNext(x):