0%



test

  • 测试信息打印

    默认情况下,pytest 会捕获所有的输出。这意味着在测试运行期间, print 语句的输出不会显示在控制台上。

    如果想看到 print 语句的输出,需要使用 -s 选项来告诉 pytest 不要捕获输出

    1
    pytest -s test_web_base.py
  • 测试指定方法

    1
    pytest tests/unit_tests/document_loaders/test_web_base.py::类名::方法名
  • 测试被标记的方法

    1
    2
    3
    @pytest.mark.finished
    def test_func1():
    assert 1 == 1
    1
    pytest -m finished tests/test-function/test_with_mark.py

keywords

  • 提示内容写入 ➡️

  • 下一个提示 option + ],上一个提示 option + [

  • 接收一行command + 右方向 ,多行 control/fn + command + 右方向

命令

  • 查看卡的数量

    nvidia-smi -L

  • 查看显卡上运行的程序,以及所占内存情况

    nvidia-smi --query-compute-apps=pid,process_name,used_memory,gpu_uuid --format=csv

  • 查看显卡所剩内存

    nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits

model_validator

model_validator 是 Pydantic 库提供的一个装饰器,用于定义模型验证器函数。模型验证器函数是一种特殊的方法,用于在创建模型实例或更新模型属性时执行自定义的验证逻辑。

1
2
3
4
5
@model_validator(mode="after")
def validate_engine_and_run_func(self):
if self.search_engine is None:
self.search_engine = SearchEngine.from_search_config(self.config.search, proxy=self.config.proxy)
return self

1
2
3
4
5
6
@model_validator(mode="before")
@classmethod
def validate_google(cls, values: dict) -> dict:
...

其中values 是实例化对象的所有参数

extension

cake

  • 庆祝彩纸

    1
    confetti
  • 弹跳窗口

    1
    Toggle Bounce Animation