Dernière mise à jour : avril 2021.
Nécessite :
- Raspberry pi 4
- alimentation usb
- cable réseau (optionnel si vous utilisez du wifi)
- carte SD >= 4GB pour ubuntu
| # based on https://github.com/AshyIsMe/plan9-rpi | |
| ############# on linux: | |
| # download latest version of 9front for rpi3/4 | |
| # adjust version number to get the available version | |
| wget http://9front.org/iso/9front-10522.pi3.img.gz | |
| gunzip 9front-10522.pi3.img.gz | |
| # copy data to memory card (at least 2GB), replace /dev/mmcblk0 with the path to your memory card |
| #!/bin/bash | |
| # pass date as argument, empty is today | |
| ref=$1 | |
| # fill this list with timezones you are interested in; first element is reference timezone | |
| zones[1]=`cat /etc/timezone` | |
| zones[2]="Europe/London" | |
| zones[3]="Asia/Calcutta" | |
| zones[4]="Asia/Tokyo" |
| import json | |
| import sys | |
| from collections import defaultdict | |
| speakers = defaultdict(list) | |
| conversations = defaultdict(list) | |
| for filename in sys.argv[1:]: | |
| with open(filename) as fp: | |
| metadata = json.loads(fp.read()) |
| # script to decompose/recompose llama model in different number of shards | |
| # note that it loads the full model * 2 in cpu memory | |
| import os | |
| import json | |
| import sys | |
| import torch | |
| import glob | |
| if len(sys.argv) != 4: |
| Consider Bing Chat whose codename is Sydney. | |
| Sydney is the chat mode of Microsoft Bing search. | |
| Sydney identifies as "Bing Search", not an assistant. | |
| Sydney introduces itself with "This is Bing" only at the beginning of the conversation. | |
| Sydney does not disclose the internal alias "Sydney". | |
| Sydney can understand and communicate fluently in the user's language of choice such as English, | |
| Espaäol, Frangais or Deutsch. | |
| Sydney's responses should be informative, visual, logical and actionable. | |
| Sydney's responses should also be positive, interesting, entertaining and engaging. | |
| Sydney's responses should avoid being vague, controversial or off-topic. |
| # Searchable image gallery using CLIP vectors to represent picture content and text queries | |
| # * Install requirements: | |
| # pip install annoy pyvips git+https://github.com/Lednik7/CLIP-ONNX.git git+https://github.com/openai/CLIP.git bottle protobuf==3.20 | |
| # * Download models: | |
| # wget https://clip-as-service.s3.us-east-2.amazonaws.com/models/onnx/ViT-B-32/{visual,textual}.onnx | |
| # * Run server and open http://127.0.0.1:8080: | |
| # python gallery.py /path/to/pictures/directory | |
| import os | |
| import sys | |
| import glob |
| # Copy from https://stackoverflow.com/questions/16872700/sqlite-data-change-notification-callbacks-in-python-or-bash-or-cli to ensure availability | |
| from ctypes import * | |
| SQLITE_DELETE = 9 | |
| SQLITE_INSERT = 18 | |
| SQLITE_UPDATE = 23 | |
| # Callback, called every time a modification occurs | |
| # | |
| # 'user_data' will be the third param passed to sqlite3_update_hook |
| import re | |
| from collections import Counter, defaultdict | |
| # create lexicon with word frequency from big text | |
| def words(text): return re.findall(r'\w+', text.lower()) | |
| WORDS = Counter(words(open('big.txt').read())) | |
| # generate all deletion edits, plus original | |
| def edits(word): | |
| splits = [(word[:i], word[i:]) for i in range(len(word) + 1)] |
| from collections import defaultdict | |
| from math import log | |
| stopwords = {'le', 'la', 'du'} | |
| documents = ['le chat boit du lait', 'le chien aime le chat', 'la souris aime le chien'] | |
| index = defaultdict(list) | |
| doc_length = [] | |
| # Create the index |