黑苹果MACOS GPU显卡性能比较
| 类型 | 型号 | GPU 核心 | 功耗 (TDP) | 性能表现(TFLOPs) | Geekbench 6 Metal 跑分 | 制程 | 性价比 | 
| Intel | UHD 630 | 24 | 15W | 0.5 | 5805 | 14nm | 较高 | 
| AMD | RX 480 | 2304 | 150W | 5.8 | 51382 | 14nm | 较高 | 
| RX 560 | 1024 | 75W | 2.6 | 23337 | 14nm | 高 | |
| RX 580 | 2304 | 185W | 6.2 | 52863 | 14nm | 较高 | |
| RX 590 | 2304 | 225W | 7.1 | 58958 | 12nm | 一般 | |
| RX 6800XT | 3840 | 250W | 16.2 | 197707 | 7nm | 较高 | |
| RX 6900XT | 5120 | 300W | 23.0 | 237041 | 7nm | 一般 | |
| RX 6950XT | 5120 | 335W | 23.7 | 216600 | 7nm | 较低 | |
| Apple | M1 | 8 | 15W | 不适用 | 32029 | 5nm | |
| M1 Pro | 16 | 30W | 不适用 | 65694 | 5nm | ||
| M1 Max | 32 | 60W | 不适用 | 111127 | 5nm | ||
| M1 Ultra | 64 | 120W | 不适用 | 160473 | 5nm | ||
| M2 | 10 | 15W | 不适用 | 43341 | 5nm | ||
| M2 Pro | 19 | 30W | 不适用 | 77397 | 5nm | ||
| M2 Max | 38 | 60W | 不适用 | 132436 | 5nm | ||
| M2 Ultra | 76 | 120W | 不适用 | 208287 | 5nm | ||
| M3 | 10 | 15W | 不适用 | 46274 | 3nm | ||
| M3 Pro | 18 | 30W | 不适用 | 73925 | 3nm | ||
| M3 Max | 40 | 60W | 不适用 | 142988 | 3nm | ||
| M4 | 10 | 15W | 不适用 | 56704 | 3nm | ||
| M4 Pro | 18 | 30W | 不适用 | 105261 | 3nm | ||
| M4 Max | 32 | 60W | 不适用 | 180025 | 3nm | ||
| M4 Ultra | 64 | 120W | 不适用 | 未公布 | 3nm | 
MAC处理器性能比较,从M1到M4
苹果 M 系列芯片从 M1 到最新 M4 系列的综合性能对比表,包含基础版、Pro、Max 和 Ultra 版本的 CPU、GPU 核心数、最大内存、内存带宽、Geekbench 跑分、GPU Metal 跑分和理论 GPU 性能(TFLOPS)
| 芯片版本 | CPU 核心 (P/E) | GPU 核心 | 最大内存 | 内存带宽 | 单核跑分 | 多核跑分 | GPU Metal 跑分 | GPU 性能 (TFLOPS) | 
|---|---|---|---|---|---|---|---|---|
| M1 | 4P / 4E | 7 或 8 | 16GB | 68GB/s | 1700 | 7500 | ~21000 | 2.6 | 
| M1 Pro | 6 或 8P / 2E | 14 或 16 | 32GB | 200GB/s | 1770 | 12300 | ~40000 | 5.2 | 
| M1 Max | 8 或 10P / 2E | 24 或 32 | 64GB | 400GB/s | 1780 | 12750 | ~69000 | 10.4 | 
| M1 Ultra | 16P / 4E | 48 或 64 | 128GB | 800GB/s | 1800 | 24000 | ~110000 | 21 | 
| M2 | 4P / 4E | 8 或 10 | 24GB | 100GB/s | 1900 | 8700 | ~25000 | 3.6 | 
| M2 Pro | 8 或 10P / 4E | 16 或 19 | 32GB | 200GB/s | 1950 | 14900 | ~49000 | 7.6 | 
| M2 Max | 12P / 4E | 30 或 38 | 96GB | 400GB/s | 1950 | 15100 | ~83000 | 15.2 | 
| M2 Ultra | 24P / 8E | 60 或 76 | 192GB | 800GB/s | 2000 | 28000 | ~135000 | 30.4 | 
| M3 | 4P / 4E | 8 或 10 | 24GB | 100GB/s | 2300 | 9000 | ~30000 | 4.5 | 
| M3 Pro | 6 或 8P / 4E | 14 或 18 | 36GB | 150GB/s | 2350 | 16500 | ~58000 | 9 | 
| M3 Max | 12P / 4E | 30 或 40 | 128GB | 400GB/s | 2380 | 20800 | ~92000 | 18 | 
| M4 | 4P / 6E | 10 | 32GB | 120GB/s | 2600 | 10500 | ~33000 | 5 | 
| M4 Pro | 8 或 10P / 4E | 16 或 20 | 64GB | 273GB/s | 2700 | 18000 | ~61000 | 10 | 
| M4 Max | 12P / 4E | 32 或 40 | 128GB | 546GB/s | 2750 | 22000 | ~97000 | 20 | 
| M4 Ultra | 24P / 8E | 60 或 76 | 192GB | 1000GB/s | 2800 | 29000 | ~160000 | 40 | 
Stable diffusion 3(SD3) Lora训练
使用dreambooth训练自己的stable diffusion 3 Lora微调模型
train_dreambooth_lora_sd3.py参数说明
来自:https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_sd3.py
train_dreambooth_lora_sd3.py [-h] 
            --pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH  # 预训练模型的名称或路径
            [--revision REVISION]  # 模型的版本号
            [--variant VARIANT]  # 模型的变体
            [--dataset_name DATASET_NAME]  # 数据集的名称
            [--dataset_config_name DATASET_CONFIG_NAME]  # 数据集配置的名称
            [--instance_data_dir INSTANCE_DATA_DIR]  # 实例数据的目录
            [--cache_dir CACHE_DIR]  # 缓存目录
            [--image_column IMAGE_COLUMN]  # 图像列
            [--caption_column CAPTION_COLUMN]  # 标题列
            [--repeats REPEATS]  # 重复次数
            [--class_data_dir CLASS_DATA_DIR]  # 类别数据的目录
			
            --instance_prompt INSTANCE_PROMPT  # 实例提示
            [--class_prompt CLASS_PROMPT]  # 类别提示
            [--validation_prompt VALIDATION_PROMPT]  # 验证提示
            [--num_validation_images NUM_VALIDATION_IMAGES]  # 验证图像的数量
            [--validation_epochs VALIDATION_EPOCHS]  # 验证的轮数
            [--rank RANK]  # 排名
            [--with_prior_preservation]  # 是否保留先验
            [--prior_loss_weight PRIOR_LOSS_WEIGHT]  # 先验损失权重
            [--num_class_images NUM_CLASS_IMAGES]  # 类别图像的数量
            [--output_dir OUTPUT_DIR]  # 输出目录
            [--seed SEED]  # 随机种子
            [--resolution RESOLUTION]  # 分辨率
            [--center_crop]  # 是否进行中心裁剪
            [--random_flip]  # 是否进行随机翻转
            [--train_batch_size TRAIN_BATCH_SIZE]  # 训练批次大小
            [--sample_batch_size SAMPLE_BATCH_SIZE]  # 样本批次大小
            [--num_train_epochs NUM_TRAIN_EPOCHS]  # 训练的轮数
            [--max_train_steps MAX_TRAIN_STEPS]  # 最大训练步骤数
            [--checkpointing_steps CHECKPOINTING_STEPS]  # 检查点步骤数
            [--checkpoints_total_limit CHECKPOINTS_TOTAL_LIMIT]  # 检查点总数限制
            [--resume_from_checkpoint RESUME_FROM_CHECKPOINT]  # 从检查点恢复
            [--gradient_accumulation_steps GRADIENT_ACCUMULATION_STEPS]  # 梯度累积步骤数
            [--gradient_checkpointing]  # 是否进行梯度检查点
			
            [--learning_rate LEARNING_RATE]  # 学习率
            [--text_encoder_lr TEXT_ENCODER_LR]  # 文本编码器的学习率
            [--scale_lr]  # 是否缩放学习率
            [--lr_scheduler LR_SCHEDULER]  # 学习率调度器 (可选值: 'linear', 'cosine', 'cosine_with_restarts', 'polynomial', 'constant', 'constant_with_warmup')
            [--lr_warmup_steps LR_WARMUP_STEPS]  # 学习率预热步骤数
            [--lr_num_cycles LR_NUM_CYCLES]  # 学习率循环次数
            [--lr_power LR_POWER]  # 学习率的幂
            [--dataloader_num_workers DATALOADER_NUM_WORKERS]  # 数据加载器的工作线程数
            [--weighting_scheme {sigma_sqrt,logit_normal,mode}]  # 加权方案
            [--logit_mean LOGIT_MEAN]  # logit的均值
            [--logit_std LOGIT_STD]  # logit的标准差
            [--mode_scale MODE_SCALE]  # 模式缩放
            [--optimizer OPTIMIZER]  # 优化器 (可选值: 'adamw', 'adam', 'sgd')
            [--use_8bit_adam]  # 是否使用8位Adam优化器
            [--adam_beta1 ADAM_BETA1]  # Adam优化器的beta1参数
            [--adam_beta2 ADAM_BETA2]  # Adam优化器的beta2参数
            [--prodigy_beta3 PRODIGY_BETA3]  # Prodigy优化器的beta3参数
            [--prodigy_decouple PRODIGY_DECOUPLE]  # 是否解耦Prodigy优化器
            [--adam_weight_decay ADAM_WEIGHT_DECAY]  # Adam优化器的权重衰减
            [--adam_weight_decay_text_encoder ADAM_WEIGHT_DECAY_TEXT_ENCODER]  # 文本编码器的Adam优化器权重衰减
            [--adam_epsilon ADAM_EPSILON]  # Adam优化器的epsilon参数
            [--prodigy_use_bias_correction PRODIGY_USE_BIAS_CORRECTION]  # 是否使用Prodigy优化器的偏差校正
            [--prodigy_safeguard_warmup PRODIGY_SAFEGUARD_WARMUP]  # Prodigy优化器的保护预热
            [--max_grad_norm MAX_GRAD_NORM]  # 最大梯度范数
            [--push_to_hub]  # 是否推送到Hub
            [--hub_token HUB_TOKEN]  # Hub的令牌
            [--hub_model_id HUB_MODEL_ID]  # Hub模型ID
            [--logging_dir LOGGING_DIR]  # 日志目录
            [--allow_tf32]  # 是否允许使用TF32
            [--report_to REPORT_TO]  # 报告到 (可选值: 'tensorboard', 'wandb', 'comet_ml')
            [--mixed_precision {no,fp16,bf16}]  # 混合精度 (可选值: 'no', 'fp16', 'bf16')
            [--prior_generation_precision {no,fp32,fp16,bf16}]  # 先验生成精度 (可选值: 'no', 'fp32', 'fp16', 'bf16')
            [--local_rank LOCAL_RANK]  # 本地排名
			
				
								
								
				
				
				
				
			解决MacOS中Terminal第一次打开卡顿几秒的BUG
$ sudo xcode-select -p
$ sudo xcode-select -switch /Library/Developer/CommandLineTools
$ sudo xcode-select -p
				
								
								
				
				
				
				
			解决BigSur Arduino ESP8266编译错误
vi ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list_ports_osx.py
#iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
#cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
				
								
								
				
				
				
				
			解决BigSur Arduino esp32 编译错误
cp ~/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/tools/esptool.py ~/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py
chmod 755 ~/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py
vi  /Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/platform.txt
#tools.esptool_py.cmd=esptool
tools.esptool_py.cmd=esptool.py
sudo pip3 install pyserial
				
								
								
				
				
				
				
			MacOs下git,maven,port,terminal使用代理
1 git
//全局配置
git config --global http.proxy socks5://127.0.0.1:1087
//编辑全局配置文件
git config --global -e
//取消全局配置
git config --global --unset http.proxy
2 maven
~/.m2/setting.xml
 <proxies>
     <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0。1</host>
      <port>1087</port>
      <nonProxyHosts>repo.njava.com</nonProxyHosts>
    </proxy>
</proxies>
//命令行方式
mvn clean compile -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=1087
3 mac port
 /opt/local/etc/macports/macports.conf 
proxy_override_env yes 
proxy_http 127.0.0.1:1087
4 terminal
//1 命令行
export http_proxy=http://127.0.0.1:1087
//2 配置文件.bashrc或者.zshrc
export http_proxy="http://127.0.0.1:1087"
export https_proxy="http://127.0.0.1:1087"
				
								
								
				
				
				
				
			ubuntu交互式界面修改时区
sudo dpkg-reconfigure tzdata
安装ucmq
1 安装libevent ucmq需求>2.0.10
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz $ tar zxvf libevent-2.0.21-stable.tar.gz $ cd libevent-2.0.21-stable $ ./configure --prefix=/usr/local/libevent $ make $ sudo make install
2 安装ucmq
$ git clone git://github.com/ucopensource/ucmq.git $ cd ucmq $ ./configure --with-libevent=/usr/local/libevent --prefix=/usr/local/ucmq $ make $ sudo make install
3 配置启动关闭ucmq
ucmq目录/usr/local/ucmq/
启动UCMQ /usr/local/ucmq/bin/ucmq –c /usr/local/ucmq/conf/ucmq.ini –d
关闭UCMQ killall ucmq 或者 curl http://0.0.0.0:8803/exec?cmd=kill
4 遇到libpthread.so.0: error adding symbols: DSO missing from command line编译错误
在
source/Makefile Makefile
中添加-lpthread
LIBS = -lz -lrt -lresolv -lnsl -lm -ldl -lbz2 -lpthread