gitlab的ci

记录备存一下,gitlab是很多公司的常用ci工具,可以定义.gitlab-ci.yml,现在肯定用轻量级的gitea了,但是这个上古的古物万一要用到,还是需要思考一下用法的。 需要提交代码就用sonar扫描,.gitlab-ci.yml如下: stages: - sonarqube_scan # 定义job(任务),多个任务分开定义 sonarqube_scan_job: #阶段,取自开始的stages stage: sonarqube_scan #定义该job执行的脚本 #注意-Dsonar.host.url 是sonarqube服务器地址 #-Dsonar.login 是sonarqube服务器地址账号 #-Dsonar.password 是sonarqube服务器地址密码 #-Dsonar.java.binaries=. sonar4.12版本之后,分析java代码需要提供该参数。 script: - sonar-scanner -Dsonar.projectName=$CI_PROJECT_PATH -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.language=java -Dsonar.java.binaries=. - echo "sonarqube_scan is done" #标签,只有这个标签的runner才会执行任务;在gilab-runner注册时填写的tag-list tags: - default #只有指定的分支提交才会执行 #only: # - master #when: manual

2026年06月12日 · 1 分钟 · 43 字 · 八戒

Java古早程序class源代码的修改

公司的古早java程序,上传视频的时候有50M的限制,结果前端开发新功能,就不行了 必须解开这个限制,首先从链路开始,先到Nginx,放开500M 然后还是报错,看到是后端tomcat的报错 先修改tomcat的xml,放大到500M <!-- 文件上传 start 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- 默认编码 --> <property name="defaultEncoding" value="UTF-8"/> <!-- 文件大小最大值 上传文件大小限制为500M,50*1024*1024 --> <property name="maxUploadSize" value="524288000"/> <!-- 内存中的最大值 --> <property name="maxInMemorySize" value="4096"/> </bean> <!--文件上传 end--> 重启tomcat,依然报错! 不过这次不是tomcat报错,而是程序内提示报错,这下拉了,得改代码 程序是2019年的,人早找不到了 完犊子,查查class吧,结果grep到是一个FileUploadRule.class做了限制 只能反编译class再放回去吧 mkdir test cd test # 下载反编译jar包 wget https://www.benf.org/other/cfr/cfr-0.152.jar cp /xxx/FileUploadRule.class . java -jar cfr-0.152.jar FileUploadRule.class ... public class FileUploadRule implements Rule { public EvaluateResult evaluate(Object file) { EvaluateResult result = new EvaluateResult(); if (file != null && file instanceof FileEntity) { FileEntity fe = (FileEntity)file; if ("UNION".equals(fe.getPlatformId()) && "VIDEO".equals(fe.getSourceEntityType())) { if (fe.getFileLength() > 0x3200000L) { result.addViolation("\u89c6\u9891\u6587\u4ef6\u4e0d\u80fd\u5927\u4e8e50M"); } } else if (fe.getFileLength() > 0xA00000L) { result.addViolation("\u666e\u901a\u6587\u4ef6\u4e0d\u80fd\u5927\u4e8e10M"); } } return result; } public boolean suitsFor(Object obj) { return FileEntity.class.isInstance(obj); } } 唉,还得算: 0x3200000L = 0x3200000 换算成十进制:3 * 16^6 + 2 * 16^5 + 0*... 但更简单:0x3200000 = 3*16^6 + 2*16^5 = 3*16777216 + 2*1048576 = 50331648 + 2097152 = 52428800 字节。52428800 字节 = 50 MB (因为 1 MB = 1024*1024 = 1048576, 52428800 / 1048576 = 50)。所以 0x3200000L = 50MB。 0xA00000L = 0xA00000 = 10 * 16^5 = 10 * 1048576 = 10485760 字节 = 10 MB (因为 10485760 / 1048576 = 10)。所以 10MB。 改成500M: 500 MB = 500 × 1024 × 1024 = 524,288,000 字节 524,288,000 转换为十六进制 = 0x1F400000 编译回去,注意jar包和其它都要放在cp路径里 javac -cp "WEB-INF/lib/*:WEB-INF/classes" -d . FileUploadRule.java 最后把class替换回去,重启就解决了。 ...

2026年06月12日 · 2 分钟 · 214 字 · 八戒

Cloudflare优选IP

+---------------------------------------------------------+ | 终端用户访问 a.public.com | +---------------------------------------------------------+ | | [ 国内用户 IP ] [ 海外/默认用户 IP ] | | v v +---------------------------------------------------------+ | DNSPod 分区解析 | +---------------------------------------------------------+ | (境内线路) | (默认线路) v v CNAME: saas.sin.fan CNAME: a.cf.com (大佬维护的优选节点) (普通 CF 节点) | | +----------------+-----------------+ | v +---------------------------------------------------------+ | Cloudflare 边缘节点 | | | | 1. 流量到达节点,节点识别出用户想访问的主机名是 a.public.com | | 2. 触发 SaaS (自定义主机名) 逻辑 | | 3. 内部路由匹配:a.public.com ---> 统一指向回源域名 a.cf.com | +---------------------------------------------------------+ | v +---------------------------------------------------------+ | 您的真实源站服务器 IP | | (实际承载 a.cf.com 的机器) | +---------------------------------------------------------+ ...

2026年06月09日 · 1 分钟 · 132 字 · 八戒

私有仓库Nexus的安装和配置

Nexus 的安装其实只要一分钟,但是配置确实要费点功夫,本文重点就是如何配置的: 一、安装: # nexus的启动用户居然是200:200 mkdir -p /app/nexus/data chown -R 200:200 /app/nexus/data cd /app/nexus cat > docker-compose.yaml <<EOF services: nexus: image: sonatype/nexus3:latest container_name: nexus restart: always ports: - "8081:8081" volumes: - /app/nexus/data:/nexus-data EOF docker compose up -d # 拿到admin管理员密码 docker exec -it nexus cat /nexus-data/admin.password 二、配置仓库: 首先需要了解一个概念,hosted、proxy、group,仓有三个类型: hosted 这里是私仓,自己产生的包和library可以放进去 proxy 这是指代理网络上公开的仓库 gropu 这里只把上面两个合并起来,暴漏出去 这样就完美了,既可以放私有的包,还能代理公共的包,最后合并成组后还能起个好记的名字暴露出去 那我们要建立一个pypi的仓,顺手就建立三个: 其中pypi-proxy代理的公仓地址:https://pypi.org/ 那就欧克了。 下一步必须进行权限管控: 首先加Role Role ID: private-repo-developer ...

2026年06月03日 · 1 分钟 · 119 字 · 八戒

蒸馏翻译模型的详细过程

模型 opus-mt-small320d-opus100-joint32k-ft-money-coffee-ct2-int8 完整训练手册 这个模型是用来做 en –> zh 的翻译用的极小模型 原本模型本体是 opus-mt ,模型大小296M。 -rw-rw-r-- 1 ubuntu ubuntu 1.4K May 19 08:20 config.json -rw-rw-r-- 1 ubuntu ubuntu 287 May 19 08:20 generation_config.json -rw-rw-r-- 1 ubuntu ubuntu 296M May 19 08:20 model.safetensors -rw-rw-r-- 1 ubuntu ubuntu 788K May 19 08:20 source.spm -rw-rw-r-- 1 ubuntu ubuntu 786K May 19 08:20 target.spm -rw-rw-r-- 1 ubuntu ubuntu 822 May 19 08:20 tokenizer_config.json -rw-rw-r-- 1 ubuntu ubuntu 1.7M May 19 08:20 vocab.json 蒸馏量化完变成了20M,这样整个en <–> zh的翻译软件,就只有60M左右,完美 -rw-rw-r-- 1 ubuntu ubuntu 223 Apr 21 05:27 config.json -rw-rw-r-- 1 ubuntu ubuntu 1007 Apr 21 05:27 generation_config.json -rw-rw-r-- 1 ubuntu ubuntu 20M Apr 21 05:27 model.bin -rw-rw-r-- 1 ubuntu ubuntu 620K Apr 21 05:27 shared_vocabulary.json -rw-rw-r-- 1 ubuntu ubuntu 778K Apr 21 05:27 source.spm -rw-rw-r-- 1 ubuntu ubuntu 778K Apr 21 05:27 target.spm -rw-rw-r-- 1 ubuntu ubuntu 819 Apr 21 05:27 tokenizer_config.json -rw-rw-r-- 1 ubuntu ubuntu 828K Apr 21 05:27 vocab.json 整个蒸馏的过程和代码都放到github了:https://github.com/zhangrr/distill-opus-mt-en-zh ...

2026年05月22日 · 1 分钟 · 151 字 · 八戒

手撕大模型GPT2

上星期花时间翻译了一篇: https://github.com/raiyanyahya/how-to-train-your-gpt 写的非常好,用简单明了的方式讲解了GPT2是怎么训练出来的 译文:https://github.com/zhangrr/how-to-train-your-gpt/ 有个问题,就是原文其中有些类比方式需要修改,更适合工程师,另外还有一些重要的细节也需要补充资料。 所以补充一些东西,也尽量保留原版的味道。 📖 这是什么? 这是一本 12 章、3,900+ 行的交互式教科书,手把手教你从零开始构建、训练和运行一个现代语言模型——和 ChatGPT、Claude、LLaMA、Mistral 背后的架构属于同一家族。 你不只是"读"关于 Transformer 的内容,而是 亲手写下每一行代码:分词器(Tokenizer)、嵌入(Embedding)、注意力、训练循环、推理引擎。每一行都有注释,解释它 做了什么 以及 为什么这么做。 🤔 为什么要做这个 大多数 ML 教程都逃不出两个坑: ❌ 太浅 ❌ 太学术 ✅ 本指南 model = GPT().fit(data) 40 页论文,密密麻麻的数学符号 五岁小孩的类比 → 完整可运行代码 你只学会了调 API 默认你有 ML 博士学位 零 ML 经验也能上手 完全不了解内部原理 没有实际示例 每一行都标注了"做什么"和"为什么" 目标: 学完之后,你不只是知道注意力"有用"。你会理解 1/√d_k 背后的方差论证、RoPE 如何通过旋转捕获相对位置、为什么 pre-norm 在深层网络中优于 post-norm,以及反向传播时每个梯度的流向。 👥 适合谁? 🧑‍💻 你是…… 📚 你需要…… 一个好奇 ChatGPT 到底怎么工作的 Python 开发者 基础 Python(函数、类、列表)。不需要 ML 经验 一个想深入理解 Transformer 的学生 愿意阅读约 3,500 行带注释代码的耐心 一个在评估 LLM 架构的工程师 理解各种技术权衡(RoPE vs 学习式位置编码、RMSNorm vs LayerNorm) 一个在其他教程里被"注意力"搞晕的人 派对类比 + 用真实数字走一遍的完整示例 🔧 前置要求: Python 基础(变量、函数、类、pip install)。就这些。不需要微积分、线性代数或 PyTorch 经验——我们边做边教。 ...

2026年05月19日 · 2 分钟 · 303 字 · 八戒

一步一步用unsloth LoRA微调Qwen3

LoRA(Low-Rank Adaptation,低秩微调)。 全面微调(Full Fine-Tuning)一个几百亿参数的大模型像是在“重新装修整栋摩天大楼”(成本极高、极易塌房),那么 LoRA 就是在摩天大楼外面搭几根轻量级的“外挂管道”。 我们来一步一步实现这个过程: 准备 uv pip install --no-deps bitsandbytes accelerate xformers==0.0.29.post3 peft trl==0.15.2 triton cut_cross_entropy unsloth_zoo uv pip install sentencepiece protobuf datasets huggingface_hub hf_transfer uv pip install --no-deps unsloth 一、加载底模: from unsloth import FastLanguageModel import torch MODEL = "unsloth/Qwen3-14B" model, tokenizer = FastLanguageModel.from_pretrained( model_name =MODEL, max_seq_length = 2048, dtype = None, load_in_4bit = True, full_finetuning = False ) model = FastLanguageModel.get_peft_model( model, r = 32, target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj",], lora_alpha = 32, lora_dropout = 0, bias = "none", use_gradient_checkpointing = "unsloth", use_rslora = False, loftq_config = None, ) 140 亿(14B 参数) 的庞然大物(通义千问最新版)塞进你的电脑里。 ...

2026年05月18日 · 12 分钟 · 2406 字 · 八戒

huggingface.co得模型文件及其dataset的下载管理

我们蒸馏模型的过程中会要到 huggingface.co 下载底模和数据文件,有必要单独拿出来说一下 安装 uv venv --python 3.12 source .venv/bin/activate uv pip install huggingface_hub hf_transfer hf auth login --token hf_xxxxx #使用国内加速站下载 HF_ENDPOINT=https://hf-mirror.com hf download # 下载所有文件,直接下载 hf download google/gemma-4-1b-it --local-dir ./gemma-4-1b-it hf download google/translategemma-4b-it --local-dir ./translategemma-4b # 下载多个文件,不指定下载目录 # 文件会放到 # ~/.cache/huggingface/hub/models--lmstudio-community--Qwen3.5-9B-GGUF/snapshots/1379f25c6b505a3fc737bd7818cb09389cf807c1/Qwen3.5-9B-Q4_K_M.gguf \ # ~/.cache/huggingface/hub/models--lmstudio-community--Qwen3.5-9B-GGUF/snapshots/1379f25c6b505a3fc737bd7818cb09389cf807c1/mmproj-Qwen3.5-9B-BF16.gguf \ hf download lmstudio-community/Qwen3.5-9B-GGUF Qwen3.5-9B-Q4_K_M.gguf mmproj-Qwen3.5-9B-BF16.gguf --revision main # 下载多个文件,指定下载目录 uv tool run hf download facebook/m2m100_418M config.json vocab.json sentencepiece.bpe.model special_tokens_map.json tokenizer_config.json pytorch_model.bin --local-dir Translate/m2m100 # 下载单个文件,指定下载目录 hf download Jackrong/Qwopus3.5-9B-v3-GGUF --local-dir Jackrong/Qwopus3.5-9B-v3-GGUF Qwopus3.5-9B-v3.Q4_K_M.gguf # 下载无限制的gemma4 uv tool run hf download HauhauCS/Gemma-4-E4B-Uncensored-HauhauCS-Aggressive Gemma-4-E4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf mmproj-Gemma-4-E4B-Uncensored-HauhauCS-Aggressive-f16.gguf # 下载所有Q4和多模 hf download unsloth/gemma-4-26B-A4B-it-GGUF \ --local-dir unsloth/gemma-4-26B-A4B-it-GGUF \ --include "*mmproj-BF16*" \ --include "*UD-Q4_K_XL*" # 动态 2 位请使用 "*UD-Q2_K_XL*" 那一些非常好的训练数据集: ...

2026年05月17日 · 1 分钟 · 116 字 · 八戒

多Token预测MTP技术-dflash

DFlash 项目 问:能加快 model 运行吗? 能。 DFlash 是一个专门用于加速大语言模型推理的项目,通过 Speculative Decoding(投机解码) 技术显著提升Token生成速度。 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 核心原理分析: 标准 LLM 推理是 自回归 的——每次只生成 1 个 token,每个 token 都需要完整的 target model forward pass,这是瓶颈所在(GPU 利用率低,受 memory bandwidth 限制)。 DFlash 的做法是 Block Diffusion + Speculative Decoding: 轻量级 Draft Model(草稿模型):一个很小的 diffusion 模型,它不是独立的 LM,而是复用 target model 的 embedding 层和 lm_head,只有几层自己的 transformer layers。 并行草拟一个 block:Draft model 一次性并行生成 block_size(通常 15-16)个候选 token,而不是逐个生成。它通过以下方式实现: 从 target model 的中间层提取 hidden states(extract_context_feature 从指定的 target_layer_ids 拼接隐藏状态) 将这些 hidden states 作为条件,对一个 masked block 做去噪(类似 diffusion),一步生成整个 block 的预测 Target Model 并行验证:Target model 对这 block_size 个候选 token 做一次 forward pass(而非 block_size 次),验证哪些是正确的。 ...

2026年05月09日 · 2 分钟 · 295 字 · 八戒

ComfyUI生成视频

之前写了一篇文章:ComfyUI配置z-image-turbo工作流生成图片 能百无禁忌,生成图片了,那我们来试试生成视频 环境:操作系统是debian 12,搭配AMD 6700 xt 12G的显卡,已按上文搭好了ComfyUI 同样,要先去下载模型文件,这回我们直接去huggingface.co的 Mirro r站下: # ComfyUI的目录是/root/ComfyUI cd /root mkdir -p ComfyUI/models/diffusion_models/wan-fusionx/ # 3个模型文件 wget -O "ComfyUI/models/diffusion_models/wan-fusionx/WanT2V_MasterModel.safetensors" "https://hf-mirror.com/vrgamedevgirl84/Wan14BT2VFusioniX/resolve/main/WanT2V_MasterModel.safetensors" wget -O "ComfyUI/models/vae/wan_2.1_vae.safetensors" "https://hf-mirror.com/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors" wget -O "ComfyUI/models/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" "https://hf-mirror.com/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" 下载、打开加载我们的视频工作流文件:video_wan2.1_fusionx.json 看看模型文件都对不对,然后修改提示词:草地上有个小马在奔跑 然后就生图吧 搞好后,就要弄我们的下一步,搞个自动营销生推广视频的玩意了。

2026年05月09日 · 1 分钟 · 35 字 · 八戒