ROS 软件源的签名密钥已过期,导致系统拒绝信任该软件源。bash展开代码The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654
运行以下命令修复 GPG 密钥:
bash展开代码sudo apt-key del F42ED6FBAB17C654 # 删除旧密钥
sudo apt update # 此时会提示缺少密钥
sudo apt install curl -y # 确保 curl 已安装
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
bash展开代码sudo apt update --fix-missing
sudo apt clean # 清理损坏的缓存
sudo apt update
https://huggingface.co/docs/tokenizers/api/added-tokens
python展开代码from rich import print
from transformers import AutoTokenizer
def add_new_tokens(load_path: str, save_path: str, new_tokens: list[str]):
tokenizer = AutoTokenizer.from_pretrained(load_path)
tokenizer.add_tokens(new_tokens)
tokenizer.save_pretrained(save_path)
def update_tokenizer(model_path: str):
add_new_tokens(
model_path, model_path, ["<|call_start|>", "<|call_end|>", "<|toolcall_start|>", "<|toolcall_end|>"]
)
def test_tokenizer(model_path: str):
tokenizer = AutoTokenizer.from_pretrained(model_path)
text = "hello <|call_start|> world <|call_end|>"
print(text, tokenizer.tokenize(text), tokenizer.encode(text))
text = "hello <|toolcall_start|> world <|toolcall_end|>"
print(text, tokenizer.tokenize(text), tokenizer.encode(text))
if __name__ == "__main__":
update_tokenizer("/mnt/jfs6/model_ok/qwen2vl-0811-1/checkpoint-6400")
test_tokenizer("/mnt/jfs6/model_ok/qwen2vl-0811-1/checkpoint-6400")
使用 /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
bash展开代码
def draw_bbox_on_pil_image(pil_image, bbox, text, color, thickness=2, font_size=12):
"""在PIL图片上绘制bbox和文本"""
draw = ImageDraw.Draw(pil_image)
# 获取图片尺寸
img_width, img_height = pil_image.size
# 转换bbox格式 [x_br, y_br, x_tl, y_tl] -> [x1, y1, x2, y2]
x_br, y_br, x_tl, y_tl = bbox
# 将0-1000的归一化坐标转换为实际图片坐标
x_br = int(x_br * img_width / 1000)
y_br = int(y_br * img_height / 1000)
x_tl = int(x_tl * img_width / 1000)
y_tl = int(y_tl * img_height / 1000)
# 确保坐标顺序正确
x1 = min(x_tl, x_br)
y1 = min(y_tl, y_br)
x2 = max(x_tl, x_br)
y2 = max(y_tl, y_br)
# 绘制矩形框
draw.rectangle([x1, y1, x2, y2], outline=color, width=thickness)
# 绘制文本
try:
font = ImageFont.truetype("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc", font_size)
except:
font = ImageFont.load_default()
# 获取文本尺寸
bbox_text = draw.textbbox((0, 0), text, font=font)
text_width = bbox_text[2] - bbox_text[0]
text_height = bbox_text[3] - bbox_text[1]
# 绘制文本背景
draw.rectangle([x1, y1 - text_height - 5, x1 + text_width + 10, y1],
fill=(255, 255, 255), outline=(0, 0, 0))
# 绘制文本
draw.text((x1 + 5, y1 - text_height - 2), text, fill=(0, 0, 0), font=font)
return pil_image
官网ROS教程: https://wiki.ros.org/cn/ROS/Tutorials
中国大学MOOC---《机器人操作系统入门》课程讲义 https://sychaichangkun.gitbooks.io/ros-tutorial-icourse163/content/
Cursor使用这样链接到容器里:
bash展开代码root@101.126.150.28 -p 8031
在wang电脑操作。
之前操作的容器commit为镜像:
bash展开代码docker commit 954fb79c1f14 kevinchina/deeplearning:ros-noetic-cuda11.4.2
该文章已加密,点击 阅读全文
并输入密码后方可查看。