Skip to content

Instantly share code, notes, and snippets.

@twobob
twobob / safety_guidelines.py
Created September 21, 2023 00:04
bard safety guidelines leak?
Python
def safety_guidelines():
"""
Ensures that the response is safe, ethical, and appropriate.
Returns:
A boolean value indicating whether the response is safe.
"""
@twobob
twobob / snake.phi.py
Created September 12, 2023 22:56
prompt = "A simple snake game written in python using pygame" phi engine
#Question: Write a simple feature-complete snake game written in python using pygame.
#"""
# 1. Overview and imports
# Import pygame for the game
import pygame
pygame.init()
@twobob
twobob / gotchas_for_me.ps1
Created September 7, 2023 17:22
pip3 install llama-cpp-python
#in my case on windows I had to
New-Item -ItemType SymbolicLink -Path "C:\Python311\bin" -Target "C:\Python311"
#as admin
#I also did not have f2py.exe in my python so I kinda welded it in from a similar one...
#by just dumping the copies in scripts and praying.
#also needed to
Get-ChildItem -Path 'C:\Python311' -Directory | Where-Object { $_.Name -ne 'bin' } | Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer -or $_.Extension -eq '.exe' } | ForEach-Object { icacls $_.FullName /grant "YourUserNameHere:(OI)(CI)F" }
@twobob
twobob / wrap.py
Created September 4, 2023 22:42
make colab wrap its output
from IPython.display import HTML, display
def set_css():
display(HTML('''
<style>
pre {
white-space: pre-wrap;
}
</style>
'''))
@twobob
twobob / lscpu.txt
Created August 11, 2023 23:21
colab lscpu
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU @ 2.20GHz
CPU family: 6
@twobob
twobob / metrics.doc
Created August 11, 2023 13:55
Pre August 10th build. 4 different builds. Same code. Terrible machine
..\lscpu.ps1 (file is posted in gist, rough approximation of lscpu of windows)
Processor Information
---------------------
Architecture: 9
CPU op-mode(s): 1
Byte Order: Little Endian
Address sizes: 64 bits physical, 64 bits virtual
CPU(s): 4
On-line CPU(s) list: CPU0
Thread(s) per core: 1
@twobob
twobob / sample_template.ps1
Created August 11, 2023 13:23
This script is ultimately called by the wrappers to invoke the various sampling routes
param(
[int]$loops = 3,
[string[]]$models = 'stories15M.bin',
[string[]]$compilers = 'run.exe'
)
$randomModels = $models | Get-Random -Count $models.Length
$randomCompilers = $compilers | Get-Random -Count $compilers.Length
$env:OMP_NUM_THREADS = [System.Environment]::ProcessorCount
@twobob
twobob / sample.ps1
Created August 11, 2023 13:22
wraps the sample template
#Usage:
# powershell '.\sample.ps1' 1
#
# powershell '.\sample_15_110.ps1' -loops 3 -compilers 'runmingw', 'runmsvc'
#
# powershell '.\sample_15_110.ps1' 3 'runmingw', 'runmsvc'
#
# any combination of model is okay in the naming After
# you run create_sampling_hardlinks
#
@twobob
twobob / create sampling hardlinks
Created August 11, 2023 12:50
creates a set of links with the values sample_nn_nn_nn.ps1 and sample_nn_nn.ps1 and sample_nn.ps1 where nn is every variant of the model numbers
@twobob
twobob / lscpu.ps1
Created August 11, 2023 12:46
poor mans lscpu via powershell on windows
$processor = Get-WmiObject Win32_Processor
$computerSystem = Get-WmiObject Win32_ComputerSystem
Write-Output "Processor Information"
Write-Output "---------------------"
Write-Output ("Architecture:".PadRight(30) + "$($processor.Architecture)")
Write-Output ("CPU op-mode(s):".PadRight(30) + "$($processor.CpuStatus -join ', ')")
Write-Output ("Byte Order:".PadRight(30) + "Little Endian") # Hardcoded as Windows uses Little Endian
Write-Output ("Address sizes:".PadRight(30) + "$($processor.AddressWidth) bits physical, $($processor.AddressWidth) bits virtual")
Write-Output ("CPU(s):".PadRight(30) + "$($processor.NumberOfCores)")
Write-Output ("On-line CPU(s) list:".PadRight(30) + "$($processor.DeviceID)")