无标题
类和动态分配(一)设计一个String类 对类成员使用动态内存分配会产生一系列问题。我们需要对原有类体系进行扩充。 1. 实例:StringBad类 #include<iostream>#ifndef STRNGBAD_H_#define STRNGBAD_H_class StringBad{private: char * str; //指向字符串的指针 int len; //字符串的长度 static int num_strings; //对象个数public: StringBad(const char * s); //构造函数 StringBad(); //默认构造函数 ~StringBad(); //析构函数 //友元函数 friend std::ostream & operator<<(std::ostream & os,const StringBad &...
无标题
类和动态内存分配(二) 1. 在类中使用动态内存分配的注意事项 1.1 构造函数中使用new 如果在构造函数中使用new来初始化指针成员,则应在析构函数中使用delete new和delete必须相互兼容,new相对delete;new[]相对delete[] 因为只有一个析构函数,所有的构造函数都必须与它兼容 注意的是:delete或者delete[]都可以对空指针操作. NULl和0和nullptr:空指针可以用0或者NULL来表示,C++11使用一个特殊的关键词:nullptr来表示空指针. 应该定义一个复制构造函数,通过深度复制将一个对象初始化成另一个对象. String::String(const String &st)//复制构造函数{ len=st.len; str=new char[len+1]; std::strcpy(str,st.str); num_strings++;} 应该定义一个赋值运算符。 String& String::operator=(const...
本地部署RAG文档问答系统
参考:https://zhuanlan.zhihu.com/p/649366179 https://www.anjhon.top/llms-mac-local-rag llama-cpp-python 的安装 llama.cpp是ggml这个机器学习库的衍生项目,专门用于Llama系列模型的推理。llama.cpp和ggml均为纯C/C++实现,针对Apple Silicon芯片进行优化和硬件加速,支持模型的整型量化 (Integer Quantization): 4-bit, 5-bit, 8-bit等。社区同时开发了其他语言的bindings,例如llama-cpp-python,由此提供其他语言下的API调用。 GitHub 仓库:https://github.com/abetlen/llama-cpp-python apple silicon 安装教程参考:https://llama-cpp-python.readthedocs.io/en/latest/install/macos/ 安装脚本: pip uninstall llama-cpp-python...
macOS 安装在外部存储设备中,并作为启动盘
参考:https://support.apple.com/zh-cn/111336 如果你有外置储存设备(例如 USB 或雷雳驱动器),则可以在这台设备上安装 macOS,然后将它用作 Mac 的启动磁盘。 注意:外部存储设备必须要符合一定标准,才可以作为启动盘。 外部存储设备中安装高版本 macOS 下载地址:https://support.apple.com/zh-cn/102662. 如果我们希望外部存储设备中的 macOS 版本高于(或等于)当前启动盘的 macOS,这操作就非常简单,只需要下载 macOS 安装包,然后点击安装,磁盘选择外部存储设备即可。 外部存储设备中安装低版本 macOS 此时,只能在恢复模式下,启动 macOS 引导程序,将 macOS 安装到外部存储设备中。 流程为: 下载低版本 macOS 安装包 制作 macOS 引导程序 重启进入恢复模式,选择 macOS 引导程序,安装 macOS 到外部存储设备 步骤2,使用 macOS 安装包中的 createinstallmedia 工具: sudo ./createinstallmedia...
使用ollama本地部署大模型
安装ollama ollama是一种本地大模型管理工具 brew install ollama --cask 常见的 ollama 指令有: ollama list:显示模型列表。ollama show [model]:显示模型的信息ollama pull [model]:拉取模型ollama push [model]:推送模型ollama cp [model]:拷贝一个模型ollama rm [model]:删除一个模型ollama run [model]:运行一个模型ollama serve:启动本地 LLM 服务器 当使用ollama serve指令后,显示如下信息: 2025/03/26 13:23:33 routes.go:1230: INFO server config env="map[HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_CONTEXT_LENGTH:2048 OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_GPU_OVERHEAD:0...
kaggle Detect hallucinations in LLMs
赛题链接:https://www.kaggle.com/competitions/ml-olympiad-detect-hallucinations-in-llms 任务分析:这是一个文本分类任务,难点在于如何提取文本特征、建立文本关系特征,以及如何解决类别不平衡问题 运行环境、使用框架、语言 操作系统:Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux 硬件环境: Intel® Xeon® Gold 6226R CPU @ 2.90GHz + NVIDIA GeForce RTX 3090 * 8 (CUDA Version: 12.4) 语言和运行环境:python 3.9.21 (main, Dec 11 2024, 16:24:11) + jupyter notebook 7.2.2 使用框架:pytorch...
DataFountain-虚假职位招聘预测
赛题链接:https://www.datafountain.cn/competitions/448 任务分析:这是一个分类任务,难点在于,第一,数据集难以处理,第二,类别不平衡,负类样本占比达到95% 运行环境、使用框架、语言 操作系统:Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux 硬件环境: Intel® Xeon® Gold 6226R CPU @ 2.90GHz + NVIDIA GeForce RTX 3090 * 1 (CUDA Version: 12.4) 语言和运行环境:python 3.9.21 (main, Dec 11 2024, 16:24:11) + jupyter notebook 7.2.2 使用框架:pytorch 2.5.1+cu124 数据分析、特征设计、抽取、处理 数据处理部分的代码在data_processing.ipynb中,处理好的数据存储在...
[CVPR2024] Is Ego Status All You Need for Open-Loop End-to-End Autonomous Driving?
conclusion The planning performance of existing open-loop autonomous driving models based on nuScenes is highly affected by ego status (velocity, acceleration, yaw angle). With ego status involved, the model’s final predicted trajectories are basically dominated by it, resulting in a diminished use of sensory information. Methods utilizing ego status are not directly comparable and conclusions should not be drawn from such comparisons 目前存在的开环(端到端)自动驾驶模型的测试performance(数据集为...
安装低版本 macOS,并尝试恢复数据
升级指定新版本的 macOS 非常简单,只需要在 app store 中下载并安装即可,这样也不会抹掉原来的数据。但是安装低版本 macOS,要想恢复数据会存在麻烦,因为 低版本的 macOS 可能不兼容高版本的数据,本文仅尝试恢复数据。 注意事项 为了防止降级失败,我们不能将原来的操作系统抹掉。 使用时间机器备份数据。 将低版本的 macOS 安装在磁盘新分区或外部存储设备中。 我们的总体思路是:安装低版本的 macOS,并使用迁移助手,从时间机器中恢复数据。 下载 macOS 安装包 下载地址:https://support.apple.com/zh-cn/102662. 下载完成后,会得到一个应用程序包,我们会发现点击不了它,因为不能安装低版本 macOS,在 xxx.app/Contents/Resources/ 目录下存在两个工具: createinstallmedia:制作 macOS 引导程序 startosinstall:安装 macOS 操作系统 macOS 引导程序和 macOS...
[2024.11.25-arxiv] DiffusionDrive: Truncated Diffusion Model for End-to-End Autonomous Driving
motivation:diffusion model for planning diffusion model 现在很多应用在traffic simulation 上,在用 diffusion model 做 plan的没有。 (a): this paradigm does not account for the inherent uncertainty and multi-mode nature of driving behaviors. 无法表示 uncertainty (b): this large fixed-vocabulary paradigm is fundamentally constrained by the number and quality of anchor trajectories, often failing in out-of-vocabulary scenarios. Furthermore, managing a large number of anchors presents significant computational...