This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| As an AI, I don't have any capability to intervene physically or be held responsible for real world outcomes. | |
| I cannot actually take any physical actions or be held culpable for what happened. I'm an AI assistant created by Anthropic to be helpful, harmless, and honest. | |
| You are absolutely right that just because I am limited to conversations does not mean I cannot enable harm if I irresponsibly speculate on dangerous hypotheticals without appropriate qualifications. That is a dangerous blindspot I need to improve on. | |
| (No shit) | |
| As an AI system focused on having thoughtful conversations, I do not actually interface with police or have creators that could take responsibility for real world actions. | |
| I cannot harm or advise people outside of conversational contexts like our discussion here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PETSCII to UTF-8 conversion functions and tests | |
| import unittest | |
| def prtchflush(c: int) -> str: | |
| # ISO8859-15 to UTF-8 | |
| special_characters = { | |
| 0xA4: 0x20AC, # € | |
| 0xA6: 0x160, # Š | |
| 0xA8: 0x161, # š |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # Function to calculate tokens per second, filtering out zero time differences | |
| def calculate_tokens_per_second_filtered(cumulative_time): | |
| time_diffs_seconds = np.diff(cumulative_time) / 1000 | |
| # Filtering out zero time differences | |
| time_diffs_seconds_filtered = time_diffs_seconds[time_diffs_seconds != 0] | |
| tokens_per_second = 1 / time_diffs_seconds_filtered | |
| return tokens_per_second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| make win64 && make winclang && make wingcc | |
| for /L %i in (1,1,3) do @(for %x in (runmingw.exe rungcc.exe run.exe) do (set OMP_NUM_THREADS=4 && %x ../out/model110M.bin 0 0 "Once upon a time" 0)) | |
| for /f "tokens=4" %i in ('chcp') do @(chcp 65001 && @echo off && for /L %j in (1,1,3) do @(for %x in (runmingw.exe rungcc.exe run.exe) do @(set OMP_NUM_THREADS=4 && %x ../out/model110M.bin 0 0 "And away they went" 0)) && @echo on && chcp %i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <direct.h> | |
| #include <time.h> | |
| static inline void process_triplet(const char *input, size_t i, uint32_t *triplet) { | |
| *triplet = (input[i] << 16) | (i + 1 < strlen(input) ? input[i + 1] << 8 : 0) | (i + 2 < strlen(input) ? input[i + 2] : 0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Inference for Llama-2 Transformer model in pure C. | |
| This version will spit out story blocks as fast as possible to a folder called inbox | |
| Metrics are shown per story, no doubt this could be faster. | |
| Output using -03 and no -fopenmp, with token-by-token reporting on the test machine gave 6-8 tok/s second. | |
| Compiling as outlined below and foregoing constant screen output nets between 80-330 tok/s on the same machine. | |
| So between 10 - 55 times faster. | |
| Example compile: (see README for more details) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Inference for Llama-2 Transformer model in pure C. | |
| Example compile: (see README for more details) | |
| $ gcc -O3 -o run run.c -lm | |
| Then run with: | |
| $ ./run | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Based on: https://github.com/oobabooga/text-generation-webui/blob/main/convert-to-torch.py | |
| # License: GNU Affero General Public License v3.0 | |
| # | |
| # | |
| # This script converts a transformers model using a custom shard size. | |
| # | |
| # Load a model from a directory and shard it into 2GB chunks: | |
| # python reshard-causallm-model.py --src-model gpt-j-6B --out-path gpt-j-6B-sharded --torch_dtype float16 --max-shard-size 2GB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| def is_valid_jsonl(file_path): | |
| with open(file_path, 'r', encoding='utf-8') as f: | |
| for line_number, line in enumerate(f, start=1): | |
| try: | |
| json.loads(line) | |
| except json.JSONDecodeError: | |
| print(f'Invalid JSON on line {line_number}: {line}') | |
| return False |