This file contains 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
# Sebastian Raschka 2025 | |
# | |
# | |
# Usage: | |
# python llama-vs-gemma.py \ | |
# --auth_token hf_... \ | |
# --model_name meta-llama/Llama-3.2-1B \ | |
# --prompt medium | |
import argparse |
This file contains 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 torch.nn as nn | |
class Transformer(nn.Module): | |
def __init__(self, ...): | |
super().__init__() | |
... | |
self.encoder_layers = nn.ModuleList(...) | |
self.decoder_layers = nn.ModuleList(...) | |
... |
This file contains 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
# pip install openai | |
import openai | |
import os | |
# export API key environment variable before | |
# running this script (see https://platform.openai.com/account/api-keys) | |
# E.g., | |
# | |
# export OPENAI_API_KEY=copy_paste_key_from_your_account |
This file contains 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
# Setup: | |
# conda create -n whisper python=3.9 | |
# conda activate whisper | |
# https://github.com/openai/whisper | |
# pip install git+https://github.com/openai/whisper.git | |
# Usage: | |
# python whisper-audio-to-text.py --audio_dir my_files --out_dir texts | |
import argparse |
This file contains 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
# Sebastian Raschka 09/24/2022 | |
# Create a new conda environment and packages | |
# conda create -n whisper python=3.9 | |
# conda activate whisper | |
# conda install mlxtend -c conda-forge | |
# Install ffmpeg | |
# macOS & homebrew | |
# brew install ffmpeg | |
# Ubuntu |
This file contains 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
categorical | measurement1 | measurement2 | label | measurement3 | |
---|---|---|---|---|---|
F | 1.428571429 | 2.721312902 | 0 | 2.089 | |
R | 0.685939167 | 0.982976329 | 0 | 0.637 | |
P | 1.055817143 | 0.624210021 | 0 | 0.226 | |
S | 0.995956364 | 0.321101265 | 0 | 0.138 | |
R | 1.376773333 | 1.578308527 | 0 | 0.478 | |
R | 0.837229167 | 1.549647481 | 0 | 0.169 | |
Q | 1.552222941 | 2.641907404 | 0 | 1.599 | |
E | 1.492519333 | 2.634558656 | 0 | 1.052 | |
W | 0.816596667 | 1.168353374 | 0 | 0.432 |
This file contains 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 | |
from sklearn.datasets import make_classification | |
from sklearn.model_selection import cross_val_score | |
from sklearn.tree import DecisionTreeClassifier | |
from sklearn.calibration import CalibratedClassifierCV | |
X, y = make_classification( | |
n_samples=1000, n_features=5, n_redundant=2, | |
n_clusters_per_class=1, random_state=123) |
This file contains 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
### EYECANDY ### | |
autoload -U colors && colors | |
PS1="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " | |
export CLICOLOR=1 | |
#export LSCOLORS=ExFxBxDxCxegedabagacad | |
#alias ls='ls -GFh' | |
### END |
This file contains 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
name: base | |
channels: | |
- conda-forge | |
dependencies: | |
- absl-py=1.0.0=pyhd8ed1ab_0 | |
- aiohttp=3.8.1=py39h5161555_0 | |
- aiosignal=1.2.0=pyhd8ed1ab_0 | |
- anyio=3.5.0=py39h2804cbe_0 | |
- appnope=0.1.2=py39h2804cbe_2 | |
- argh=0.26.2=pyh9f0ad1d_1002 |
This file contains 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 time | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torchvision import datasets | |
from torchvision import transforms | |
from torch.utils.data import DataLoader | |
if torch.cuda.is_available(): |
NewerOlder