-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update version * ui/anglicize(#51) * update ui * add english --------- Co-authored-by: KAAANG <cunykang@gmail.com> * Feat/pypi (#54) * add version * fix init * update import * delete experiment_name * fix #51 * 对 #9 做了一些调整,优化性能。新增index字段,并向下兼容 * update ui * add version to header * update script * fix: minute * add version * add blank * Feat/log (#57) 1. [enchancement] add class FONT to handle text colors 2. [bug, enchancement] switch logging stream to sys.strout 3. [enchancement] remove color code when write swanlog into console folder --------- Co-authored-by: KAAANG <cunykang@gmail.com> * v0.0.2beta4 * Update pyproject.toml * feat:auto publish (#58) * feat:auto publish * Feat/log show (#60) * delete: mock * 基本样式 * add font * feat: get logs * fix bugs and uis * fix scroll * feat: get recent logs * Update create_experiment.py * fix: error.log * feat: empty experiment without charts * feat: loading * refactor: not return error when it is none * fix: limit max lines * fix some bugs --------- Co-authored-by: KAAANG <cunykang@gmail.com> * Refactor/log line number (#62) * fix some bugs * console log refactor --------- Co-authored-by: Zirui Cai <1575079435@qq.com> * v0.0.2beta5 * Update pyproject.toml * add version * Update pyproject.toml * ui: hide links (#63) --------- fix #50 #52 #53 #45 #44 #41 Co-authored-by: cunyue-4060 <cunykang@gmail.com> Co-authored-by: Bote Huang <106975133+KashiwaByte@users.noreply.github.com> Co-authored-by: KAAANG <79990647+SAKURA-CAT@users.noreply.github.com>
- Loading branch information
1 parent
fa0d1ec
commit b60a6b7
Showing
52 changed files
with
1,050 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Set Nodejs | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.15.0 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
npm install | ||
pip install -r requirements.txt | ||
pip install build | ||
pip install twine | ||
- name: Build and Publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
|
||
run: | | ||
npm run build.release | ||
python -m build | ||
python -m twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,9 @@ | ||
from .log import swanlog as swl | ||
from .env import swc | ||
# 导出初始化函数和log函数 | ||
from .database import ( | ||
init, | ||
log, | ||
) | ||
from .utils import get_package_version | ||
|
||
_sd = None | ||
""" | ||
swandatabase对象 | ||
使用动态导入的方式有助于环境隔离 | ||
比如cli不需要此对象,就不需要导入 | ||
""" | ||
|
||
|
||
def init(experiment_name: str = None, description: str = "", config: dict = {}): | ||
"""初始化swanlab的配置 | ||
Parameters | ||
---------- | ||
experiment_name : str, optional | ||
实验名称, 如果不指定则自动生成一个 | ||
description : str, optional | ||
实验描述, 如果不指定默认为空 | ||
config : dict, optional | ||
实验可选配置,在此处可以记录一些实验的超参数等信息 | ||
""" | ||
global _sd | ||
if _sd is not None: | ||
raise RuntimeError("swanlab has been initialized") | ||
from .database import swandatabase as sd | ||
|
||
# 挂载对象 | ||
_sd = sd | ||
# 初始化数据库 | ||
_sd.init( | ||
experiment_name=experiment_name, | ||
description=description, | ||
config=config, | ||
) | ||
# 初始化日志对象 | ||
swl.init(swc.output) | ||
swl.info("Run data will be saved locally in " + swc.exp_folder) | ||
swl.info("Experiment_name: " + _sd.experiment.name) | ||
swl.info("Run `swanlab watch` to view SwanLab Experiment Dashboard") | ||
|
||
|
||
def log(data: dict): | ||
"""以字典的形式记录数据,字典的key将作为列名,value将作为记录的值 | ||
例如: | ||
```python | ||
sw.log({"loss": 0.1, "accuracy": 0.9}) | ||
``` | ||
Parameters | ||
---------- | ||
data : dict | ||
此处填写需要记录的数据 | ||
""" | ||
if _sd is None: | ||
raise RuntimeError("swanlab has not been initialized") | ||
|
||
if not isinstance(data, dict): | ||
raise TypeError("log data must be a dict") | ||
for key in data: | ||
# 遍历字典的key,记录到本地文件中 | ||
_sd.add(key, data[key]) | ||
|
||
|
||
__all__ = ["init", "log"] | ||
__version__ = get_package_version() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.