[Solved] TypeError: str returned non-string (type NoneType)

The Python error “TypeError: str returned non-string (type NoneType)” means you aren’t returning a string from your class’ __str__ method. To fix this, make sure you’re actually returning a string. Python has methods called “dunder” methods, which is shorthand for “double underscore”. They are special methods you can add to your classes to do things … Read more

[Solved] ModuleNotFoundError: No module named ‘cryptography’

This error means you don’t have cryptography installed. Install it with pip install cryptography or by using the user interface in your IDE to install additional python packages. The cryptography package in Python has cryptographic “recipes” which make working with encryption easier and safer for developers. Easier because most of the hard work has already … Read more

[Solved] ModuleNotFoundError: No module named ‘boto3’

This error is caused by trying to import boto3 when it’s not installed. Fix this by simply running pip install boto3. Problem: boto3 is not installed If you don’t have the boto3 Python package installed, running the following code will give you an error: The error: Fix 1: install boto3 using pip Fix this by … Read more

How to Round to 2 Decimal Places in Javasacript

There’s a couple different ways to round to two decimal places in Javascript. Which one you use will depend on your situation. Use Math.round The best way to do this is using Math.round, especially if you still need a number on the other end to do math on. Here is the most accurate and correct … Read more

How to Load LLaMA 13b for Inference on a single RTX 4090

These large language models are huge. Until fairly recently, using 1-billion+ parameter versions of them on consumer hardware was unthinkable. Earlier this year, Facebook (or, Meta I guess) released their own LLM called LLaMA. They released it in a number of different sizes, with the smallest being 7-billion parameters, and the largest at a whopping … Read more

Categories AI

Javascript: How to filter an array of objects by property

A very common task in Javascript (and lots of other programming languages) is creating a subset of an array. Luckily, there’s lots of ways available to do this in Javascript. We’ll go over each from best (Array.filter) to worst (for loop). Use the Array.filter method Filtering an array of objects in Javascript can be done … Read more