Transformers/SpaCy安装在Android手机(Termux)的Python Data Science开发环境
安装Rust(Python库safetensors依赖Rust)并启用本地仓库crates加速下载:
$ rm -rf ~/.cargo#删除所有Rust残余旧版本
$ pkg install rust#最好安装完退出Termux所有Sessions
$ mkdir -p ~/.cargo#重建rust的用户配置目录
$ export THU='https://mirrors.tuna.tsinghua.edu.cn/rustup'
$ echo "export RUSTUP_DIST_SERVER=${THU} >> ~/.cargo/env"
$ rustc --version#重启Termux运行;Termux安装pytorch, opencv, numpy, scipy, pandas, pillow…
$ pkg install python opencv-python vim-python
$ pkg install python-{numpy,scipy,pandas,pillow}
$ pkg install python-torch{,audio,vision}
$ pkg install protobuf{,-dev} google{test,-glog}安装SpaCy(Industrial-Strength Natural Language Processing, ExplosionAI GmbH):
# 修改thinc/spacy{,-transformers}的依赖文件(pyproject.toml, setup.cfg, setup.py),
# 用最新版numpy(1.25.0);$ pip install thinc spacy spacy-pkuseg安装 SentencePiece(unsupervised tokenizer and detokenizer, from the Google)
$ git clone https://github.com/google/sentencepiece.git
$ cd sentencepiece
$ mkdir build && cd build
# Android上编译必须要指定 -llog 链接器参数
$ LDFLAGS="-llog" cmake .. \
$ -DSPM_ENABLE_SHARED=ON \
$ -DCMAKE_INSTALL_PREFIX=/data/data/com.termux/files/usr
$ make install
$ cd ../python && python setup.py bdist_wheel
$ pip install dist/sentencepiece*.whl安装transformers库的依赖Python库
$ pip install safetensors# rust联网下载crates
$ pip install protobuf tokenizers sentencepiece安装transformers库(Transformer/BERT是Google原创论文; 前文准备工作做足即顺利):
# 这个 transformers 库是大热的 Huggingface.co 开源的全家桶系列
# 连 Google/Microsoft/Meta(Facebook)/Amazon/Intel/… 都在用 Huggingface 的
# 注册 huggingface.co 账号, Python库huggingface_hub需要的 token 可在
# 这个 https://huggingface.co/settings/tokens 页面新建与获取
$ pip install transformers[sentencepiece]
$ pip install spacy-{alignments,transformers}
$ pip install huggingface-hub
$ git config --global credential.helper store
$ huggingface-cli login# 登录并记录账号密钥下载SpaCy的多语言模型文件spacy_models:
#最新发布 https://github.com/explosion/spacy-models/releases?q=en_core
$ python -m spacy download zh_core_web_trf
$ python -m spacy download en_core_web_trf
# 下载 spacy_models 时最好用有断点续传的浏览器(例如Microsoft的Edge)
# 用 spacy 库下载前打印出下载文件的url 张贴到Edge浏览器上打开下载.
# BASEURL='https://github.com/explosion/spacy-models/releases/download'
# ENCW=\({BASEURL}/en_core_web_trf-3.5.0/en_core_web_trf-3.5.0-py3-none-any.whl
\# ZHCW=\){BASEURL}/zh_core_web_trf-3.5.0/zh_core_web_trf-3.5.0-py3-none-any.whlSpacy Package naming conventions
In general, spaCy expects all pipeline packages to follow the naming convention of:
[lang]_[name]
For spaCy’s pipelines, we also chose to divide the name into three components:- Type: Capabilities (
e.g.
core for general-purpose pipeline with tagging, parsing,
lemmatization and named entity recognition, or
dep for only tagging, parsing and lemmatization). - Genre: Type of text the pipeline is trained on, e.g. web or news.
- Size: Package size indicator, sm, md, lg or trf.
sm and trf pipelines have no static word vectors.
For pipelines with default vectors,
md has a reduced word vector table with 20k unique vectors for ~500k words,
lg has a large word vector table with ~500k entries.
For pipelines with floret vectors,
md vector tables have 50k entries and lg vector tables have 200k entries.
For example, en_core_web_sm is a small English pipeline trained on written web text (
blogs, news, comments), that includes vocabulary, syntax and entities.- Type: Capabilities (
Spacy Package versioning
Additionally, the pipeline package versioning reflects both the compatibility with spaCy,
as well as the model version. A package version a.b.c translates to:
a: spaCy major version. For example, 2 for spaCy v2.x.
b: spaCy minor version. For example, 3 for spaCy v2.3.x.
c: Model version.
Different model config: e.g. from being trained on different data, with different
parameters, for different numbers of iterations, with different vectors, etc.
For a detailed compatibility overview, see the compatibility.json.
This is also the source of spaCy’s internal compatibility check,
performed when you run the download command
Transformers/SpaCy安装在Android手机(Termux)的Python Data Science开发环境的更多相关文章
- 基于C/S模式的android手机与PC机通信系统的开发
原文链接: http://blog.csdn.net/nupt123456789/article/details/8213486 基于C/S模式的android手机与PC机通信系统的开发 作者:郑海波 ...
- 【转】android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)
原文网址:http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.html android 最新 NDK r8 在w ...
- android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)
android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创) 一直想搞NDK开发却一直给其他事情耽搁了,参考了些网上的资料今天终于把 ...
- 为eclipse安装python、shell开发环境和SVN插件
http://www.crazyant.net/1185.html 为eclipse安装python.shell开发环境和SVN插件 2013/08/27 by Crazyant 暂无评论 eclip ...
- Python For Mac 开发环境安装 以及问题记录
Python For Mac 开发环境安装记录 把自己安装的过程记录一下,亲测可用 1.Python3环境安装(转载http://www.cnblogs.com/meng1314-shuai/p/90 ...
- 【转】Pro Android学习笔记(二):开发环境:基础概念、连接真实设备、生命周期
在Android学习笔记(二):安装环境中已经有相应的内容.看看何为新.这是在source网站上的Android架构图,和标准图没有区别,只是这张图颜色好看多了,录之.本笔记主要讲述Android开发 ...
- Android Studio 0.4 + PhoneGap 3.3 开发环境的搭建
最近在尝试HTML5移动平台下的开发 由于安卓的方便性,首先开始了安卓的试验 现在安卓下的开发工具首选 Android Studio (写这文章的时候,是0.4) 而跨平台的HTML5 App比较出名 ...
- IDEA里如何安装Python插件打造开发环境(图文详解)
前言 python是一种功能强大和适用面很广的开发语言,在大数据应用和机器学习日益流行的年代,python凭借其简洁.易用和可扩展性获得很多用户的支持,近年来使用率高速增长.python环境下,集成了 ...
- Android五天乐(第一天)开发环境的部署,开发流程与调试
由于项目要求參与无线端开发,本着技多不压身的指导精神,决定依旧从web转攻client! 由于之前自己玩过两个月android(实际上仅仅是做了两个有失水准的demo级app),本来以为这次再来学习将 ...
- 【转】为eclipse安装python、shell开发环境和SVN插件
原文网址:http://www.crazyant.net/1185.html eclipse是一个非常好用的IDE,通常来说我们都用eclipse来开发JAVA程序,为了让开发python.shell ...
随机推荐
- github仓库的README文件在线预览视频
1. 新建一个 issue ,在 issue 里面上传 mp4 视频文件(有限制,不能超过10MB) 上传超过10MB的视频会提示报错 2. 拿到视频文件的上传地址 3. 将这个地址直接贴到 READ ...
- CTF_RSA解密学习
CTF_RSA解密学习 00X00 .先看了一边李永乐老师的视频 https://www.bilibili.com/video/av26639065/ 00X01.对称.非对称算法了解 对称算法,加解 ...
- maven-helper解决依赖冲突
idea中可以使用maven-helper解决依赖冲突
- SpringBoot3整合SpringSecurity6(三)基于数据库的用户认证
大家好,我是晓凡. 写在前面 上一篇文章中,我们了解了SpringSecurity怎么基于内存进行用户认证.但这还远远不够,在实际开发中. 用户往往都存在于数据库,所以从这篇文章开始,我们就要开始学习 ...
- LangChain4j比SpringAI强在哪?一文读懂
LangChain4j 和 Spring AI 是 Java 生态中实现大模型应用开发的两个最重要的框架,但二者的区别是啥?生产级别又该使用哪种框架?令很多人犯了难,所以本文就来浅聊一下,希望给大家在 ...
- 时间工具类之“Calendar时间类的函数用法”
一.时间工具类之"Calendar时间类的函数用法" // 获取当前时间 Calendar cal = Calendar.getInstance(); // start是Date时 ...
- Grid 布局-容器项
grid 网格布局是一个用于web的二维布局系统, 多行多列. flex 单行布局则更倾向于一维布局, 一行或者一列. Grid 重点 只是用表格进行排版哈, 横向内容直接无关联哦. 容器项 子项 布 ...
- 进程间通信-POSIX 消息队列
POSIX 消息队列 POSIX 消息队列可以认为是一个消息链表.进程(线程)可以往里写消息,也可以从里面取出消息.可以在不相关的进程之间发送和接收数据. 创建(打开)消息队列-mq_open()函数 ...
- C++ 11 make_shared
make_shared的使用 shared_ptr<string> p1 = make_shared<string>(10, '9'); shared_ptr<strin ...
- 赛前十天——打印输入字符串的全排列&&cls(java实现)
package javaPractice; import java.util.Scanner; public class Contest13 { public static void main(Str ...