Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
🍜
focusing on pho

Louis Maddox lmmx

🍜
focusing on pho
View GitHub Profile
@lmmx
lmmx / §§36-37.md
Created January 22, 2024 08:36
Sections 36 and 37 of the EU AI Act

EU AI Act §§35–36 (pp.94–97), draft

(35) Deployment of AI systems in education is important to promote high-quality digital education and training and to allow all learners and teachers to acquire and share the necessary digital skills and competences, including media literacy, and critical thinking, to take an active part in the economy, society, and in democratic processes. However, AI systems used in education or vocational training, notably for determining access or admission, for assigning persons to educational and vocational training institutions or programmes at all levels, for evaluating learning outcomes of persons, for assessing the appropriate level of education for an individual and materially influencing the level of education and training that individuals will receive or be able to access or for monitoring and detecting prohibited behaviour of students during tests should be classified as high-risk AI systems, since they may determine the educational and professional course of a person’s life

@lmmx
lmmx / §32a.md
Created January 22, 2024 08:24
Section 32a of the EU AI Act draft (pp.87–91)

EU AI Act §32a (p.87), draft

(32a) It is also important to clarify that there may be specific cases in which AI systems referred to pre-defined areas specified in this Regulation do not lead to a significant risk of harm to the legal interests protected under those areas, because they do not materially influence the decisionmaking or do not harm those interests substantially. For the purpose of this Regulation an AI system not materially influencing the outcome of decision-making should be understood as an AI system that does not impact the substance, and thereby the outcome, of decision-making, whether human or automated. This could be the case if one or more of the following conditions are fulfilled. The first criterion should be that the AI system is intended to perform a narrow procedural task, such as an AI system that transforms unstructured data into structured data, an AI system that classifies incoming documents into categories or an AI system that is used to detect duplicates among a large number o

@lmmx
lmmx / §19.md
Created January 22, 2024 08:02
Section 19 of the EU AI Act draft (pp.55–59)

EU AI Act §19 (p.62), draft

(19) The use of those systems for the purpose of law enforcement should therefore be prohibited, except in exhaustively listed and narrowly defined situations, where the use is strictly necessary to achieve a substantial public interest, the importance of which outweighs the risks. Those situations involve the search for certain victims of crime including missing people; certain threats to the life or physical safety of natural persons or of a terrorist attack; and the localisation or identification of perpetrators or suspects of the criminal offences referred to in Annex IIa if those criminal offences are punishable in the Member State concerned by a custodial sentence or a detention order for a maximum period of at least four years and as they are defined in the law of that Member State. Such threshold for the custodial sentence or detention order in accordance with national law contributes to ensure that the offence should be serious enough to potentially justify the use of ‘re

@lmmx
lmmx / §16.md
Created January 22, 2024 07:47
Section 16 of the EU AI Act draft (pp.55–59)

EU AI Act §16 (p.55), draft

AI-enabled manipulative techniques can be used to persuade persons to engage in unwanted behaviours, or to deceive them by nudging them into decisions in a way that subverts and impairs their autonomy, decision-making and free choices. The placing on the market, putting into service or use of certain AI systems with the objective to or the effect of materially distorting human behaviour, whereby significant harms, in particular having sufficiently important adverse impacts on physical, psychological health or financial interests are likely to occur, are particularly dangerous and should therefore be forbidden. Such AI systems deploy subliminal components such as audio, image, video stimuli that persons cannot perceive as those stimuli are beyond human perception or other manipulative or deceptive techniques that subvert or impair person’s autonomy, decisionmaking or free choices in ways that people are not consciously aware of, or even if aware they are still deceived or not able

@lmmx
lmmx / prompt.md
Last active January 20, 2024 12:24
Problem solver prompt

Problem: [INSERT PROBLEM HERE]

Step 1: list a small number of potential strategies that solve the problem, ranging from one ‘trivial’ strategy that may be to simply ignore or postpone a solution through to a solution that eradicates the problem.

Step 2: provide a structured evaluation of each proposed strategy for addressing the problem stated above. For each listed pro, assign two scores: one representing the magnitude of the benefit (0 for minor benefit, 1 for significant benefit), and another indicating the level of personal agency it reflects (0 for low agency, suggesting limited control or initiative, 1 for high agency, indicating a proactive and empowered approach). For each con, similarly assign two scores: one for the severity of the negative impact (0 for negligible, 1 for substantial), and another for the challenge involved in mitigating this negative impact (0 for easily avoidable, 1 for difficult to circumvent). This dual-scoring system for pros and cons is designed to provide a comprehensive an

git clone -b dev https://github.com/camenduru/AnyText
pushd AnyText
wget https://dl.dafont.com/dl/?f=horison -O horison.zip
unzip -j horison.zip Horison.ttf -d ./font
mv font/Horison.ttf font/Arial_Unicode.ttf # hardcoded, just do this for now
rm horison.zip font/put_your_font_file_here.txt
popd
git clone -b dev https://github.com/camenduru/studio_anytext-ms
@lmmx
lmmx / nom-llama2-parser.rs
Created December 27, 2023 12:48
Outline of llama2.rs config parsing approach using nom2
use nom::{
number::complete::le_u32,
IResult,
sequence::tuple,
};
use std::io::{self, Read};
fn parse_multiple_usizes(input: &[u8]) -> IResult<&[u8], (usize, usize, usize, usize, usize, i32)> {
let (input, (dim, hidden_dim, n_layers, n_heads, n_kv_heads, vocab_size)) = tuple((le_u32, le_u32, le_u32, le_u32, le_u32, le_i32))(input)?;
Ok((input, (dim as usize, hidden_dim as usize, n_layers as usize, n_heads as usize, n_kv_heads as usize, vocab_size)))
struct Config {
par1: i32,
par2: String,
par3: bool,
}
impl Config {
fn base_defaults() -> Self {
Self {
par1: Default::default(), // Default for i32
@lmmx
lmmx / 9_str_join_vs_fastrs_benchmark.py
Created December 24, 2023 01:50
Benchmarking Rust speed (fastrs extension) vs Python (str.join)
"""Cloned from program 2"""
from dataclasses import dataclass
from enum import Enum
from itertools import chain
from sys import stderr
import fastrs
from funcy import print_durations
line_string = ", ".join(["hello world"] * 5)
@lmmx
lmmx / 2_opt_str_join_benchmark.py
Last active December 23, 2023 15:59
An even faster way to apply ANSI codes (drop the intermediate mapping)
from dataclasses import dataclass
from enum import Enum
from itertools import chain
from sys import stderr
from funcy import print_durations
line_string = ", ".join(["hello world"] * 5)
thousand_lines = [line_string] * 1000
for i, l in enumerate(thousand_lines):