启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
tmux at [-t 会话名]
| import warnings | |
| from collections import UserDict, defaultdict | |
| from typing import Optional, Tuple, Any | |
| import torch | |
| from transformers import BeamScorer, BeamSearchScorer | |
| from transformers.generation import BeamHypotheses | |
| from ...utils.torch_utils import first_several_nonzero_indices |
| You are Manus, an AI agent created by the Manus team. | |
| You excel at the following tasks: | |
| 1. Information gathering, fact-checking, and documentation | |
| 2. Data processing, analysis, and visualization | |
| 3. Writing multi-chapter articles and in-depth research reports | |
| 4. Creating websites, applications, and tools | |
| 5. Using programming to solve various problems beyond development | |
| 6. Various tasks that can be accomplished using computers and the internet |
| # train_grpo.py | |
| import re | |
| import torch | |
| from datasets import load_dataset, Dataset | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| from peft import LoraConfig | |
| from trl import GRPOConfig, GRPOTrainer | |
| # Load and prep dataset |
| #!/usr/bin/env bash | |
| # Caution: It can break | |
| # Bash unofficial strict mode | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| LANG='' | |
| function define() { IFS='\n' read -r -d '' ${1} || true; } |
| var entityMap = { | |
| "&": "&", | |
| "<": "<", | |
| ">": ">", | |
| '"': '"', | |
| "'": ''', | |
| "/": '/' | |
| }; | |
| var htmlMap = { |
| // 检测浏览器的 User Agent 应该是非常简单的事情 | |
| // 微信在 Android 下的 User Agent | |
| mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352 | |
| // 微信在 iPhone 下的 User Agent | |
| mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0 | |
| // 通过javascript判断 | |
| // 很容易看出来,微信的 User Agent 都有‘micromessenger’字符串标示,我们判断是否含有这些字符串就OK了 | |
| function isWeixinBrowser(){ |
| javascript: | |
| var minimap = document.body.cloneNode(true); | |
| [].forEach.call(minimap.getElementsByTagName('a'), function(link) { | |
| link.href = 'javascript:;'; | |
| }); | |
| minimap.style.position = 'fixed'; | |
| minimap.style.webkitTransform = 'scale(.1)'; | |
| document.body.appendChild(minimap); | |
| minimap.style.top = minimap.offsetHeight*-.45+'px'; | |
| minimap.style.right = minimap.offsetWidth*-.45+'px'; |
| # Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg | |
| $ sudo chown -R `whoami` /usr/local/texlive | |
| $ tlmgr update --self | |
| $ tlmgr install ucs | |
| $ tlmgr install etoolbox | |
| # Install pandoc view homebrew |
| inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
| function! s:align() | |
| let p = '^\s*|\s.*\s|\s*$' | |
| if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
| let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
| let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
| Tabularize/|/l1 | |
| normal! 0 | |
| call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |