This commit is contained in:
2025-03-10 17:25:01 +08:00
parent fffc0949ce
commit 20361f87d1
4 changed files with 289 additions and 130 deletions
+53
View File
@@ -1825,6 +1825,8 @@ wsl --install -d <Distribution Name>
#### 通过FinalShell连接WSL2
##### 方式1
1. 需要先删除ssh,再安装ssh
```shell
@@ -1860,6 +1862,30 @@ dpkg-reconfigure openssh-serve
FinalShell就可以连接WSL2了
##### 方式2
(1)查看wsl的地址
- 安装`ifconfig`工具
```
apt install net-tools
```
- 查看IP地址,红框位置为wsl地址
```
ifconfig
```
![image-20250310130413226](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20250310130413226.png)
(2)将端口转发到wsl,在Power Shell下执行命令,将[IP]和[PORT] 替换为wsl的IP(对应图片中红框标注的)和端口(对应sshd中设置)。
```
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=2222 connectaddress=[IP] connectport=[PORT]
```
#### 启用systemctl
进入当前发行版
@@ -1879,6 +1905,33 @@ systemd=true
wsl --shutdown
```
#### 取消密码复杂度及长度限制
```shel
vim /etc/pam.d/system-auth
password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= ​​minlen=6 ucredit=1 lcredit=1 ocredit=1 dcredit=1​​
```
如下图:
![image-20250310125937362](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20250310125937362.png)
#### WSL玄学bug之SSH连接找不到nvidia-smi
本地正常,但是通过SSH连接WSL,执行nvidia-smi找不到
## 解决方式
在.bashrc中加入
```shell
export PATH=/usr/lib/wsl/lib:$PATH
```
## 参考
[https://github.com/microsoft/WSL/issues/8794](https://github.com/microsoft/WSL/issues/8794)
## 安装 7zip
```shell
+5
View File
@@ -0,0 +1,5 @@
---
title: Python
date: 2025-03-10 14:26:30
tags:
---
+108
View File
@@ -0,0 +1,108 @@
---
title: 大模型
date: 2025-02-18 10:06:57
tags:
---
# Ollama
## 1. 安装
首先需要下载并安装Ollama,这是运行模型的基础环境。
![image-20250218102658870](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20250218102658870.png)
## 2. 下载模型
打开命令行终端,根据需要运行以下命令之一来下载对应版本的模型:
![image-20250218104847668](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20250218104847668.png)
以DeepSeek为例:
7B 版本(推荐显存 8G):
```bash
ollama pull deepseek-coder:7b
```
8B 版本(推荐显存 8G):
```bash
ollama run huihui_ai/deepseek-r1-abliterated:8b
```
14B 版本(推荐显存 12G):
```BASH
ollama run huihui_ai/deepseek-r1-abliterated:14b
```
32B 版本(推荐显存 32G):
```bash
ollama run huihui_ai/deepseek-r1-abliterated:32b
```
70B 版本(需要高端显卡支持):
```bash
ollama run huihui_ai/deepseek-r1-abliterated:70b
```
## 3. Ollama 常用命令
在使用 Ollama 时,以下是一些常用的命令操作:
```bash
# 启动 Ollama 服务
ollama serve
# 从 Modelfile 创建模型
ollama create <模型名称>
# 显示模型信息
ollama show <模型名称>
# 运行模型
ollama run <模型名称>
# 停止运行中的模型
ollama stop <模型名称>
# 从仓库拉取模型
ollama pull <模型名称>
# 推送模型到仓库
ollama push <模型名称>
# 列出所有已安装的模型
ollama list
# 列出正在运行的模型
ollama ps
# 复制模型
ollama cp <源模型> <目标模型>
# 删除模型
ollama rm <模型名称>
```
## 4. Ollama模型存储目录
- macOS: `~/.ollama/models`
- Linux: `/usr/share/ollama/.ollama/models`
- Windows: `C:\Users\%username%\.ollama\models`
### 如何将它们设置为不同的位置?
如果需要使用不同的目录,可以将环境变量 `OLLAMA_MODELS` 设置为你选择的目录。
> 注意:在 Linux 上使用标准安装程序时,`ollama` 用户需要对指定目录有读写权限。要将目录分配给 `ollama` 用户,请运行 `sudo chown -R ollama:ollama <directory>`.
请参考[上面的部分](https://ollama.readthedocs.io/faq/#how-do-i-configure-ollama-server)了解如何在你的平台上设置环境变量。
![image-20250218132430850](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20250218132430850.png)