pensieve复现(转载)

转载自博客

环境配置

环境:python2.7,Ubuntu 16.04,

1、mahimahi安装需要用到add-apt-repository,因此需要执行:

sudo apt-get install python-software-properties

    
    
  • 1

2、selenium安装2.39.0版本

wget 'https://pypi.python.org/packages/source/s/selenium/selenium-2.39.0.tar.gz
  • 1
  • 2

3、py virtual display安装0.2.1版本

sudo pip install pyvirtualdisplay==0.2.1

 
 
  • 1

4、google-chrome游览器安装54.0.2840.90稳定版,可访问google-chrome-stable下载
chromedriver使用默认的 pensieve-master/abr_browser_dir/chromedriver-2.27.440175版

5、tensorflow安装1.1.0版本

sudo pip install tensorflow==1.1.0

 
 
  • 1

6、tflearn安装0.3.1版本

sudo pip install tflearn==0.3.1

 
 
  • 1

修改后的setup.py文件参见:

执行过程

  1. 模型训练
    (1) 将训练数据放在 sim/cooked_trace 中,测试数据放在 sim/cooked_test_trace 中(需要创建文件夹)。
    (2) 运行 python get_video_sizes.py,得到 video_size
    (3) 运行 python multi_agent.py,训练模型。训练后的模型将保存在 sim/results/ 中。

  2. 数值仿真
    (1) 将测试数据放入 test/cooked_trace 中(需要创建文件夹)。
    (2) 运行 python get_video_sizes.py
    (3) 将训练好的RL模型( sim/results/ 文件夹中)复制到 test/models/ 中。
    (4) 在test/rl_no_training.py中,修改NN_MODEL = './model/pretrain_linear_reward.ckpt'
    (5) 运行python rl_no_training.py,进行测试。测试结果将被保存在 test/results/ 中。
    (6) 类似地,可测试 bb.py,mpc.py 以及 dp. py (dp.py没有log输出,和dp.cc完全相同,可以用g++编译运行)。测试结果将被保存在 test/results/ 中。
    (7) 修改 plot_results.py中的 SCHEMES ,画出结果图,在接下来的实验中可通用。
    注:数据包在“测试数据集”文件夹中。

  3. mahimahi网络仿真
    (1) 轨迹存放在 cooked_trace/ (在Pensieve主目录中)。
    (2) 将训练好的RL模型保存在 rl_server/results/ 中。
    (3) 在 rl_server/rl_no_training.py 中,修改NN_MODEL同数值仿真
    (4) 在 run_exp/ 中运行python run_all_traces.py开始实验。结果将保存在 run_exp/results 文件夹中
    注:数据包在“Mahimahi数据集”文件夹中。

  4. 实际平台测试
    (1) setup.py初始化apache服务器并自动将视频数据放置在 /var/www/html 中。
    (2) 将训练好的RL模型保存在 rl_server/results/ 中。
    (3) 在 rl_server/rl_no_training.py 中,修改NN_MODEL同数值仿真。
    (4) 修改 real_exp/run_video.py 中的url为服务器url,本机实验使用localhost
    (5) 在 real_exp/ 中运行python run_exp.py开始实验。结果将保存在 real_exp/results 文件夹中。

bug修改

  • test/dp.py中 14行 数组越界:TOTAL_VIDEO_CHUNCK = 65改为TOTAL_VIDEO_CHUNCK = 49

  • test/rl_no_training.py中 86行函数输出不匹配:video_chunk_size, next_video_chunk_sizes, \ 原来缺少 next_video_chunk_sizes

  • real_exp/run_video.pyrun_exp/run_video.py中:

    (1) 程序无法退出死循环:退出条件 return/print 'done' 修改为 return/print True,相应修改run_exp.pyrun_traces.py中循环break的退出条件 if out:

    (2)使用pyvirtualdisplay时执行display = Display(visible=0, size=(800,600))报url错误:注释~/.local/lib/python2.7/site-packages/pyvirtualdisplay/display.py中:

# TODO: check only once
# cls.check_installed()

 
 
  • 1
  • 2

(3) chrome报错(找了很久的问题,目前还是不太清楚为什么,只有解决办法),报错如下:

Message: u'timeout: cannot determine loading status\nfrom timeout: Timed out receiving message from renderer: -0.030\n  
(Session info: chrome=54.0.2840.90)\n  (Driver info: chromedriver=2.27.440175(9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.15.0-142-generic x86_64)'

 
 
  • 1
  • 2

解决方法是注释掉option:

chrome_driver = '../abr_browser_dir/chromedriver'
#options.add_argument('--user-data-dir=' + chrome_user_dir)
#options.add_argument('--ignore-certificate-errors')
driver=webdriver.Chrome(chrome_driver, chrome_options=options)

 
 
  • 1
  • 2
  • 3
  • 4

代码解读

  1. 强化学习A3C算法解读
  2. 基本框架dash.js
  3. selenium+pyvirtualdisplay+chrome 模拟视频播放过程
  4. mahimahi网络仿真

未完待续~

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值