【LLM RAG】GritLM:统一嵌入和生成的大语言模型浅谈

前言

目前,所有基于文本的语言问题都可以归结为生成问题,并通过单一的LLM来处理。然而,使用嵌入的任务(如聚类或检索)在这种视角下往往被忽视了。文本嵌入在许多关键的实际应用中扮演着重要角色。如RAG,在向量表征时,通过一些表征模型如:BGE、BCE等进行嵌入。因此,当前的方法在处理生成任务和嵌入任务时通常是分开的,这导致了效率和性能的损失。本文提出了GRIT(Generative Representational Instruction Tuning),这是一种统一嵌入和生成任务的方法。GRIT通过指令区分这两种任务,使得模型能够根据给定的指令执行相应的任务。这种方法在保持生成和嵌入任务性能的同时,实现了两者的统一。

模型架构

GRITLM架构

Representation

  • GRITLM 在处理嵌入任务时使用双向注意力机制来处理输入。在嵌入任务中,对最终隐藏状态进行平均池化(Mean Pooling),以产生最终的表示。该任务使用contrastive objectivein-batch negatives来计算损失。损失函数如下:

    Generation

  • GRITLM 在处理生成任务时使用因果注意力机制。在隐藏状态之上,Language Modeling Head,用于预测下一个标记的损失,即图中的“{response}< /s>”部分。该格式支持多轮对话(用“…”表示)。因此其损失函数为预测 token 和真实 token 之间的交叉熵:

该架构是一个多任务学习的框架,因此,总体损失函数表示如下:

实验结果

  1. 嵌入性能

    比较了GRITLM 7B和GRITLM 8X7B与现有的生成和嵌入模型的性能。他们发现,GRITLM 7B在MTEB上的表现优于所有先前的开放模型,并且在生成任务上也优于所有参数规模相当的模型。GRITLM 8X7B在所有开放的生成语言模型中表现最佳,同时在嵌入任务上也表现出色。

  2. 生成性能

    GRITLM在多个生成任务上的性能超过了其他模型,包括Llama 2 7B和Mistral 7B等。

简化RAG

在传统的RAG设置中,通常需要两个独立的模型:一个用于检索(检索模型),另一个用于生成(生成模型)。这要求将用户查询传递给两个模型,并且在生成阶段,还需要将检索到的上下文传递给生成模型。

GRIT方法通过统一嵌入和生成任务,简化了RAG。由于GRITLM能够处理两种任务,它可以在不需要单独检索模型的情况下,直接在生成过程中利用检索到的上下文。

传统RAG(左)和简化RAG(右)

提出了几种缓存策略来提高RAG的效率,这些策略包括查询缓存(Query Caching)、文档缓存(Doc Caching)、查询-文档缓存(Query-Doc Caching)文档-查询缓存(Doc-Query Caching)

  • 查询缓存:在这种方法中,检索阶段计算的查询表示被缓存,并在生成阶段重用,避免了对查询的重复前向传递。
  • 文档缓存:在这种方法中,检索阶段计算的文档表示被缓存,并在生成阶段直接使用,避免了对文档的重复前向传递。
  • 查询-文档缓存(Query-Doc Caching) 和 **文档-查询缓存(Doc-Query Caching)**结合了查询缓存和文档缓存。它们在缓存策略上有所不同,但都是为了进一步减少在生成阶段所需的计算量。

推理代码

开箱即用

pip install gritlm
  1. basic

    from gritlm import GritLM# Loads the model for both capabilities; If you only need embedding pass `mode="embedding"` to save memory (no lm head)
    model = GritLM("GritLM/GritLM-7B", torch_dtype="auto")
    # To load the 8x7B you will likely need multiple GPUs.
    # All the kwargs are passed to HF from_pretrained so you can just do the below to load on multiple GPUs:
    # model = GritLM("GritLM/GritLM-8x7B", torch_dtype="auto", device_map="auto")
    # You can also load other models e.g.
    # model = GritLM("Muennighoff/SGPT-125M-weightedmean-nli-bitfit", pooling_method="weighted_mean", attn=None)
    # model = GritLM("hkunlp/instructor-base", pooling_method="mean", attn=None)### Embedding/Representation ###
    instruction = "Given a scientific paper title, retrieve the paper's abstract"
    queries = ['Bitcoin: A Peer-to-Peer Electronic Cash System', 'Generative Representational Instruction Tuning']
    documents = ["A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as a majority of CPU power is controlled by nodes that are not cooperating to attack the network, they'll generate the longest chain and outpace attackers. The network itself requires minimal structure. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone.","All text-based language problems can be reduced to either generation or embedding. Current models only perform well at one or the other. We introduce generative representational instruction tuning (GRIT) whereby a large language model is trained to handle both generative and embedding tasks by distinguishing between them through instructions. Compared to other open models, our resulting GritLM 7B sets a new state of the art on the Massive Text Embedding Benchmark (MTEB) and outperforms all models up to its size on a range of generative tasks. By scaling up further, GritLM 8X7B outperforms all open generative language models that we tried while still being among the best embedding models. Notably, we find that GRIT matches training on only generative or embedding data, thus we can unify both at no performance loss. Among other benefits, the unification via GRIT speeds up Retrieval-Augmented Generation (RAG) by > 60% for long documents, by no longer requiring separate retrieval and generation models. Models, code, etc. are freely available at https://github.com/ContextualAI/gritlm."
    ]def gritlm_instruction(instruction):return "<|user|>\n" + instruction + "\n<|embed|>\n" if instruction else "<|embed|>\n"# No need to add instruction for retrieval documents
    d_rep = model.encode(documents, instruction=gritlm_instruction(""))
    q_rep = model.encode(queries, instruction=gritlm_instruction(instruction))from scipy.spatial.distance import cosine
    cosine_sim_q0_d0 = 1 - cosine(q_rep[0], d_rep[0])
    cosine_sim_q0_d1 = 1 - cosine(q_rep[0], d_rep[1])
    cosine_sim_q1_d0 = 1 - cosine(q_rep[1], d_rep[0])
    cosine_sim_q1_d1 = 1 - cosine(q_rep[1], d_rep[1])print("Cosine similarity between \"%s\" and \"%s\" is: %.3f" % (queries[0][:15], documents[0][:15], cosine_sim_q0_d0))
    # Cosine similarity between "Bitcoin: A Peer" and "A purely peer-t" is: 0.608
    print("Cosine similarity between \"%s\" and \"%s\" is: %.3f" % (queries[0][:15], documents[1][:15], cosine_sim_q0_d1))
    # Cosine similarity between "Bitcoin: A Peer" and "All text-based " is: 0.101
    print("Cosine similarity between \"%s\" and \"%s\" is: %.3f" % (queries[1][:15], documents[0][:15], cosine_sim_q1_d0))
    # Cosine similarity between "Generative Repr" and "A purely peer-t" is: 0.120
    print("Cosine similarity between \"%s\" and \"%s\" is: %.3f" % (queries[1][:15], documents[1][:15], cosine_sim_q1_d1))
    # Cosine similarity between "Generative Repr" and "All text-based " is: 0.533### Generation ###
    # We did not finetune GritLM models with system prompts, as you can just include system-like instructions together with your user instruction
    messages = [{"role": "user", "content": "Please write me a poem about my recent hike of Mt. Fuji at midnight in the style of Shakespeare."},
    ]
    encoded = model.tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
    encoded = encoded.to(model.device)
    gen = model.generate(encoded, max_new_tokens=256, do_sample=False)
    decoded = model.tokenizer.batch_decode(gen)
    print(decoded[0])
    """
    <s> <|user|>
    Please write me a poem about my recent hike of Mt. Fuji at midnight in the style of Shakespeare.
    <|assistant|>
    Oh, Mt. Fuji, mountain grand,
    A sight to see, a climb to command,
    At midnight, in the dark of night,
    I climbed your slopes, with all my might.The stars above, they shone so bright,
    A beacon in the darkness, guiding light,
    The wind did blow, with a gentle sigh,
    As I climbed higher, with a steady eye.The path was steep, the climb was tough,
    But I pressed on, with a steadfast rough,
    For the summit, I longed to see,
    The view from the top, a sight to be.At last, I reached the peak, and stood,
    With awe and wonder, I gazed aloud,
    The world below, a sight to see,
    A view that's worth the climb, you'll agree.Mt. Fuji, mountain grand,
    A sight to see, a climb to command,
    At midnight, in the dark of night,
    I climbed your slopes, with all my might.</s>
    """
    
  2. Caching

    import numpy as np
    import torch
    from gritlm import GritLM# Loads the model for both capabilities; If you only need embedding pass `mode="embedding"` to save memory (no lm head)
    model = GritLM("GritLM/GritLM-7B", torch_dtype="auto")
    # To load the 8x7B you will likely need multiple GPUs.
    # All the kwargs are passed to HF from_pretrained so you can just do the below to load on multiple GPUs:
    # model = GritLM("GritLM/GritLM-8x7B", torch_dtype="auto", device_map="auto")
    # You can also load other models e.g.
    # model = GritLM("Muennighoff/SGPT-125M-weightedmean-nli-bitfit", pooling_method="weighted_mean", attn=None)
    # model = GritLM("hkunlp/instructor-base", pooling_method="mean", attn=None)queries = ['Please explain to me how Bitcoin works.', 'What is "Generative Representational Instruction Tuning"?']
    documents = ["A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as a majority of CPU power is controlled by nodes that are not cooperating to attack the network, they'll generate the longest chain and outpace attackers. The network itself requires minimal structure. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone.","All text-based language problems can be reduced to either generation or embedding. Current models only perform well at one or the other. We introduce generative representational instruction tuning (GRIT) whereby a large language model is trained to handle both generative and embedding tasks by distinguishing between them through instructions. Compared to other open models, our resulting GritLM 7B sets a new state of the art on the Massive Text Embedding Benchmark (MTEB) and outperforms all models up to its size on a range of generative tasks. By scaling up further, GritLM 8X7B outperforms all open generative language models that we tried while still being among the best embedding models. Notably, we find that GRIT matches training on only generative or embedding data, thus we can unify both at no performance loss. Among other benefits, the unification via GRIT speeds up Retrieval-Augmented Generation (RAG) by > 60% for long documents, by no longer requiring separate retrieval and generation models. Models, code, etc. are freely available at https://github.com/ContextualAI/gritlm."
    ]CACHE_FORMAT_DOC = "\n<|user|>\n{query}\n\nAnswer the prior query while optionally using the context prior to it\n<|assistant|>\n"
    CACHE_FORMAT_QUERY = "\n<|user|>\n{doc}\n\nOptionally using the prior context answer the query prior to it\n<|assistant|>\n"
    CACHE_FORMAT_QUERY_DOC = "\n<|user|>\nOptionally using the prior context answer the query prior to it\n<|assistant|>\n"
    CACHE_FORMAT_DOC_QUERY = "\n<|user|>\nAnswer the prior query while optionally using the context prior to it\n<|assistant|>\n"def gritlm_instruction(instruction):return "<|user|>\n" + instruction + "\n<|embed|>\n" if instruction else "<|embed|>\n"### GRIT DOC CACHING ###
    # cache: Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`
    d_rep, d_cache = model.encode(documents, instruction=gritlm_instruction(""), get_cache=True)
    q_rep = model.encode(queries, instruction=gritlm_instruction(""))from scipy.spatial.distance import cosine
    sims = {q: [1 - cosine(q_rep[i], d_rep[j]) for j in range(len(d_rep))] for i, q in enumerate(queries)}for q, q_sims in sims.items():sim_idx = np.argmax(q_sims)cache = tuple([(d_cache[i][0][sim_idx:sim_idx+1], d_cache[i][1][sim_idx:sim_idx+1]) for i, c in enumerate(d_cache)])# BOS is already in the cacheinputs = model.tokenizer(CACHE_FORMAT_DOC.format(query=q), return_tensors="pt", add_special_tokens=False).to(model.device)inputs["use_cache"] = True# Attend to the cache tooinputs["attention_mask"] = torch.cat((torch.ones((cache[0][0].shape[0], cache[0][0].shape[2]), dtype=torch.long, device=inputs["attention_mask"].device),inputs["attention_mask"],), dim=1)generation = model.generate(**inputs, max_new_tokens=256, past_key_values=cache, do_sample=False)decoded = model.tokenizer.batch_decode(generation)print(decoded[0])"""
    <|user|>
    What is "Generative Representational Instruction Tuning"?Answer the prior query while optionally using the context prior to it
    <|assistant|>
    Generative Representational Instruction Tuning (GRIT) is a method for training language models that can perform both generative and embedding tasks. It involves training a large language model to handle both types of tasks by distinguishing between them through instructions. GRIT is designed to improve the performance of language models on both generative and embedding tasks, and it can be used to unify both types of tasks at no performance loss.</s>
    """### GRIT QUERY CACHING ###
    # cache: Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`
    d_rep = model.encode(documents, instruction=gritlm_instruction(""))
    q_rep, q_cache = model.encode(queries, instruction=gritlm_instruction(""), get_cache=True)from scipy.spatial.distance import cosine
    sims = {d: [1 - cosine(q_rep[i], d_rep[j]) for j in range(len(d_rep))] for i, d in enumerate(documents)}for d, d_sims in sims.items():sim_idx = np.argmax(d_sims)cache = tuple([(q_cache[i][0][sim_idx:sim_idx+1], q_cache[i][1][sim_idx:sim_idx+1]) for i, c in enumerate(q_cache)])# BOS is already in the cacheinputs = model.tokenizer(CACHE_FORMAT_QUERY.format(doc=d), return_tensors="pt", add_special_tokens=False).to(model.device)inputs["use_cache"] = True# Attend to the cache tooinputs["attention_mask"] = torch.cat((torch.ones((cache[0][0].shape[0], cache[0][0].shape[2]), dtype=torch.long, device=inputs["attention_mask"].device),inputs["attention_mask"],), dim=1)generation = model.generate(**inputs, max_new_tokens=256, past_key_values=cache, do_sample=False)decoded = model.tokenizer.batch_decode(generation)print(decoded[0])"""
    <|user|>
    All text-based language problems can be reduced to either generation or embedding. Current models only perform well at one or the other. We introduce generative representational instruction tuning (GRIT) whereby a large language model is trained to handle both generative and embedding tasks by distinguishing between them through instructions. Compared to other open models, our resulting GritLM 7B sets a new state of the art on the Massive Text Embedding Benchmark (MTEB) and outperforms all models up to its size on a range of generative tasks. By scaling up further, GritLM 8X7B outperforms all open generative language models that we tried while still being among the best embedding models. Notably, we find that GRIT matches training on only generative or embedding data, thus we can unify both at no performance loss. Among other benefits, the unification via GRIT speeds up Retrieval-Augmented Generation (RAG) by > 60% for long documents, by no longer requiring separate retrieval and generation models. Models, code, etc. are freely available at https://github.com/ContextualAI/gritlm.Optionally using the prior context answer the query prior to it
    <|assistant|>
    GRIT stands for generative representational instruction tuning. It is a method for training large language models to handle both generative and embedding tasks by distinguishing between them through instructions. GritLM is a large language model trained using GRIT that sets a new state of the art on the Massive Text Embedding Benchmark (MTEB) and outperforms all models up to its size on a range of generative tasks. GritLM 8X7B is a larger version of GritLM that outperforms all open generative language models that were tried while still being among the best embedding models. GRIT matches training on only generative or embedding data, thus unifying both at no performance loss. This unification via GRIT speeds up Retrieval-Augmented Generation (RAG) by > 60% for long documents, by no longer requiring separate retrieval and generation models. Models, code, etc. are freely available at <https://github.com/ContextualAI/gritlm>.</s>
    """### GRIT QUERY-DOC CACHING ###
    # cache: Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`
    d_rep, d_cache = model.encode(documents, instruction=gritlm_instruction(""), get_cache=True, add_special_tokens=False)
    q_rep, q_cache = model.encode(queries, instruction=gritlm_instruction(""), get_cache=True)from scipy.spatial.distance import cosine
    sims = {q: [1 - cosine(q_rep[i], d_rep[j]) for j in range(len(d_rep))] for i, q in enumerate(queries)}for i, (q, q_sims) in enumerate(sims.items()):sim_idx = np.argmax(q_sims)cache_query = tuple([(q_cache[j][0][i:i+1], q_cache[j][1][i:i+1]) for j, c in enumerate(q_cache)])cache_doc = tuple([(d_cache[j][0][sim_idx:sim_idx+1], d_cache[j][1][sim_idx:sim_idx+1]) for j, c in enumerate(d_cache)])# For DOC-QUERY simply swap the order of the cache, change the format to CACHE_FORMAT_DOC_QUERY & set add_special_tokens=True in the `model.encode(..` abovecache = [(torch.cat((layer[0], cache_doc[i][0]), dim=2),torch.cat((layer[1], cache_doc[i][1]), dim=2),) for i, layer in enumerate(cache_query)]# BOS is already in the cacheinputs = model.tokenizer(CACHE_FORMAT_QUERY_DOC, return_tensors="pt", add_special_tokens=False).to(model.device)inputs["use_cache"] = True# Attend to the cache tooinputs["attention_mask"] = torch.cat((torch.ones((cache[0][0].shape[0], cache[0][0].shape[2]), dtype=torch.long, device=inputs["attention_mask"].device),inputs["attention_mask"],), dim=1)generation = model.generate(**inputs, max_new_tokens=256, past_key_values=cache, do_sample=False)decoded = model.tokenizer.batch_decode(generation)print(decoded[0])"""
    <|user|>
    Optionally using the prior context answer the query prior to it
    <|assistant|>
    Sure, here's an example of how the prior context could be used to answer a query:Query: "What is GRIT?"Prior context: "We introduce generative representation instruction tuning (GRIT) whereby a large language model is trained to handle both generative and embedding tasks by distinguishing between them through instructions."Answer: GRIT is a method for training language models to handle both generative and embedding tasks by distinguishing between them through instructions.</s>
    """
    

总结

本文主要介绍了一种新的统一架构,GRIT成功地将文本嵌入和生成任务统一到了一个单一的模型(GRITLM)中,并提出简化RAG的策略。为大模型多任务训练提供了一个方法论。

参考文献

【1】Generative Representational Instruction Tuning,https://arxiv.org/abs/2402.09906

【2】https://github.com/ContextualAI/gritlm/tree/main

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/712962.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AIGC下一步:如何用AI再度重构或优化媒体处理?

让媒资中“沉默的大多数”再次焕发光彩。 邹娟&#xff5c;演讲者 编者按 AIGC时代下&#xff0c;媒体内容生产领域随着AI的出现也涌现出更多的变化与挑战。面对AI的巨大冲击&#xff0c;如何优化或重构媒体内容生产技术架构&#xff1f;在多样的应用场景中媒体内容生产技术又…

JavaScript 基本数据类型的详解

JavaScript的基本数据类型 以下都是JS内置的几种类型 数据类型描述number数字&#xff0c;不区分整数和小数string字符串类型booleantrue 真, false 假undefined表示未定义的值null只有唯一的值 null&#xff0c;表示空值 number 数字类型 JavaScript 中不区分整数和浮点数&…

itertools, 一个超好用的Python库

前言 Python用来处理迭代器的工具你想到了啥&#xff1f;itertools 就是一个特别有用的库&#xff0c;它提供了一系列用于创建和操作迭代器的工具&#xff0c;以下是10个常用的操作&#xff0c;可用在实际工作中&#xff0c;熟练掌握这些操作&#xff0c;将极大提升你在 Pytho…

栈(顺序栈)实现Language C

###王道考研的学习领悟&#xff0c;个人喜好讲解清晰 何为栈&#xff1f; 定义:栈&#xff08;stack&#xff09;是只允许在一端进行插入或删除的线性表。 其重要术语&#xff1a;栈顶&#xff0c;栈底&#xff0c;空栈。 我们只需要把这个图看明白了&#xff0c;理解起来就…

学校机房Dev c++解决中文乱码问题

工具->编译选项->勾选 编译时加入以下命令 -fexec-charsetGBK -finput-charsetUTF-8 显示中文&#xff1a;工具->编辑器选项->去掉第一个的勾勾。

Github上最值得学习的10个Android开源项目,安卓面试题

1.Java语言进阶与Android相关技术核 Android应用是由Java语言进行开发的&#xff0c;SDK也是由Java语言编写&#xff0c;对于Android来说&#xff0c;只要SDK没有用Kotlin重写&#xff0c;那么Java语言是都需要学习的。而且Android APK的后台服务器程序大概率是Java语言构建&a…

【计算机网络】应用层自定义协议

自定义协议 一、为什么需要自定义协议&#xff1f;二、网络版计算器1. 基本要求2. 序列化和反序列化3. 代码实现&#xff08;1&#xff09;封装 socket&#xff08;2&#xff09;定制协议和序列化反序列化&#xff08;3&#xff09;客户端&#xff08;4&#xff09;计算器服务端…

Javaweb之SpringBootWeb案例之自动配置以及常见方案的详细解析

3.2 自动配置 我们讲解了SpringBoot当中起步依赖的原理&#xff0c;就是Maven的依赖传递。接下来我们解析下自动配置的原理&#xff0c;我们要分析自动配置的原理&#xff0c;首先要知道什么是自动配置。 3.2.1 概述 SpringBoot的自动配置就是当Spring容器启动后&#xff0c…

【论文笔记】An Effective Adversarial Attack on Person Re-Identification ...

原文标题&#xff08;文章标题处有字数限制&#xff09;&#xff1a; 《An Effective Adversarial Attack on Person Re-Identification in Video Surveillance via Dispersion Reduction》 Abstract 通过减少神经网络内部特征图的分散性攻击reid模型。 erbloo/Dispersion_r…

Vue3中组件通讯的方式

Vue3中组件通讯的方式 1 &#x1f916;GPT&#x1f916;: (答案有点问题混淆了vue2的内容) 父组件向子组件传递数据 props 子组件通过 props 属性从父组件接收数据。emit事件子组件通过emit 事件 子组件通过 emit事件子组件通过emit 发射事件向父组件发送消息。provide / in…

Chrome插件 | WEB 网页数据采集和爬虫程序

无边无形的互联网遍地是数据&#xff0c;品类丰富、格式繁多&#xff0c;包罗万象。数据采集&#xff0c;或说抓取&#xff0c;就是把分散各处的内容&#xff0c;通过各种方式汇聚一堂&#xff0c;是个有讲究要思考的体力活。君子爱数&#xff0c;取之有道&#xff0c;得注意遵…

mobile app 安全扫描工具MobSF了解下

可以干啥&#xff1a; static 静态分析 dynamic 动态分析 可以用来渗透了 如何docker安装 docker image 下载地址https://hub.docker.com/r/opensecurity/mobile-security-framework-mobsf/ setup 两行即可 1 docker pull opensecurity/mobile-security-framework-mobsf…

年轻人怎么搞钱?

年轻人想要搞钱&#xff0c;可以考虑以下几个方面&#xff1a; 1. 创业&#xff1a;年轻人可以通过自己的创意&#xff0c;找到一个市场的空缺&#xff0c;开创自己的业务。可以从比较小的项目开始&#xff0c;逐渐扩大范围&#xff0c;积累经验和财富。 2. 投资&#xff1a;…

Hadoop之HDFS——【模块二】数据管理

一、Namespace的概述 1.1.集群与命名空间的关系 类似于大集群与小集群之间的关系,彼此之间独立又相互依存。每个namespace彼此独立,Namespace工作时只负责维护本区域的数据,同时所有的namespace维护的文件都可以共用DataNode节点,为了区分数据属于哪些Namespace,DataNode…

强大而灵活的python装饰器

装饰器&#xff08;Decorators&#xff09; 一、概述 在Python中&#xff0c;装饰器是一种特殊类型的函数&#xff0c;它允许我们修改或增强其他函数的功能&#xff0c;而无需修改其源代码。装饰器在函数定义之后立即调用&#xff0c;并以函数对象作为参数。装饰器返回一个新…

CrossOver 24下载-CrossOver 24 for Mac下载 v24.0.0中文永久版

CrossOver 24是一款可以让mac用户能够自由运行和游戏windows游戏软件的虚拟机类应用&#xff0c;虽然能够虚拟windows但是却并不是一款虚拟机&#xff0c;也不需要重启系统或者启动虚拟机&#xff0c;类似于一种能够让mac系统直接运行windows软件的插件。它以其出色的跨平台兼容…

NVMe开发——PCIe复位

简介 PCIe中有4种复位机制&#xff0c;早期的3种被称为传统复位(Conventional Reset)。传统复位中的前2种又称为基本复位(Fundamental Resets)&#xff0c;分别为冷复位(Cold Reset)&#xff0c;暖复位(Warm Reset)。第3种复位为热复位(Hot Reset)。第4种复位被称为功能级复位…

179基于matlab的2D-VMD处理图像

基于matlab的2D-VMD处理图像&#xff0c;将图片进行VMD分解&#xff0c;得到K个子模态图&#xff0c;将每个模态图进行重构&#xff0c;得到近似的原图。可以利用这点进行图像去噪。程序已调通&#xff0c;可直接运行。 179 2D-VMD 图像分解重构 图像处理 (xiaohongshu.com)

每日五道java面试题之spring篇(九)

目录&#xff1a; 第一题. 说一下Spring的事务传播行为第二题. 说一下 spring 的事务隔离&#xff1f;第三题. Spring AOP and AspectJ AOP 有什么区别&#xff1f;AOP 有哪些实现方式&#xff1f;第四题. JDK动态代理和CGLIB动态代理的区别第五题. 解释一下Spring AOP里面的几…

【白嫖8k买的机构vip教程】Appium自动化(3):Appium-Desktop界面介绍

Appium-Desktop主界面包含三个菜单Simple、Advanced、Presets Simple界面&#xff1a; Host设置Appium server的ip地址&#xff0c;本地调试可以将ip地址修改为127.0.0.1&#xff1b;Port设置端口号&#xff0c;默认是4723不用修改Start Server 启动 Appium serverEdit Confi…