一、Tensorflow Tederated安装
基础环境:
操作系统:Ubuntu20.04
首先,安装Anaconda:
具体的安装步骤可以查看这篇文章,亲测实用,https://blog.csdn.net/ITBigGod/article/details/85690257
然后,安装TensorFlow:
conda create -n tff (创建名为tff的虚拟环境)
conda activate tff (激活虚拟环境,并切换进去,如果想退出,输入conda deactivate)
conda install tensorflow
安装jupyter notebook
conda install jupyter notebook
使得jupyter中的内核能显示 tf: python -m ipykernel install --user --name tf --display-name "tf"
安装TFF(TensorFlow federated)
pip install tensorflow==2.5.0 tensorflow-federated==0.19.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
这里解释一下,我直接安装pip install tensorflow-federated会有错误,所以我就指定了具体的版本,因为TensorFlow和TFF有版本对应要求,所以我这样安装。具体对应关系可以看这篇博客:http://t.zoukankan.com/linglanhuakai-p-14651231.html
二、TensorFlow Federated 使用
打开jupyter: jupyter notebook,会弹出一个浏览器页面(稍等一会)。
选择New --> tff,
尝试用下列代码测试:
import tensorflow as tf
import tensorflow_federated as tf
import numpy as np
print(tf.__version__)
print(tff.__version__)
print(np.__version__)
标签:tff,Linux,Federated,conda,tensorflow,tf,TensorFlow,安装 From: https://www.cnblogs.com/wsxcode/p/16594476.html