未验证 提交 99af4a15 编写于 作者: B Bin Long 提交者: GitHub

Merge pull request #170 from ShenYuhan/release/v1.2

add windows fake fcntl dependency
import fcntl
import os import os
if os.name == "posix":
import fcntl
class WinLock(object): class WinLock(object):
...@@ -15,23 +16,22 @@ class Lock(object): ...@@ -15,23 +16,22 @@ class Lock(object):
_owner = None _owner = None
def __init__(self): def __init__(self):
self.LOCK_EX = fcntl.LOCK_EX
self.LOCK_UN = fcntl.LOCK_UN
self.LOCK_TE = ""
if os.name == "posix": if os.name == "posix":
self.lock = fcntl self.lock = fcntl
else: else:
self.lock = WinLock() self.lock = WinLock()
_lock = self.lock _lock = self.lock
self.LOCK_EX = self.lock.LOCK_EX
self.LOCK_UN = self.lock.LOCK_UN
def get_lock(self): def get_lock(self):
return self.lock return self.lock
def flock(self, fp, cmd): def flock(self, fp, cmd):
if cmd == fcntl.LOCK_UN: if cmd == self.lock.LOCK_UN:
Lock._owner = None Lock._owner = None
self.lock.flock(fp, cmd) self.lock.flock(fp, cmd)
elif cmd == fcntl.LOCK_EX: elif cmd == self.lock.LOCK_EX:
if Lock._owner is None: if Lock._owner is None:
Lock._owner = os.getpid() Lock._owner = os.getpid()
self.lock.flock(fp, cmd) self.lock.flock(fp, cmd)
......
...@@ -64,7 +64,7 @@ finetunee.py用于接受PaddleHub搜索到的超参进行一次优化过程, ...@@ -64,7 +64,7 @@ finetunee.py用于接受PaddleHub搜索到的超参进行一次优化过程,
```python ```python
print("AutoFinetuneEval"+"\t" + str(eval_acc)) print("AutoFinetuneEval"+"\t" + str(eval_acc))
``` ```
* 输出的评价效果取值范围应该为`(-∞, 1]`,取值越高,表示效果越好。 * 输出的评价效果取值范围应该为`(-∞, 1]`,取值越高,表示效果越好。
### 示例 ### 示例
...@@ -132,7 +132,7 @@ $ hub autofinetune finetunee.py --param_file=hparam.yaml --cuda=['1','2'] --pops ...@@ -132,7 +132,7 @@ $ hub autofinetune finetunee.py --param_file=hparam.yaml --cuda=['1','2'] --pops
* round0 ~ roundn记录了每一轮的数据,在每个round目录下,还存在以下文件: * round0 ~ roundn记录了每一轮的数据,在每个round目录下,还存在以下文件:
* log-0.info ~ log-m.info记录了每个搜索方向的日志 * log-0.info ~ log-m.info记录了每个搜索方向的日志
* model-0 ~ model-m记录了对应搜索的参数 * model-0 ~ model-m记录了对应搜索的参数
## 五、可视化 ## 五、可视化
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册