欢迎来到我的博客,这里记录着一些我最近的生活。
「每一篇文章,都是一次未完的对话,
期待与你的反馈与交流」
欢迎来到我的博客,这里记录着一些我最近的生活。
「每一篇文章,都是一次未完的对话,
期待与你的反馈与交流」
实习/入学后一直有些忙,其实学习了很多新的东西,但总感觉不太成体系,或者就是没时间,所以很久没记录了。
最近思考了很久要做什么方向,该做什么样的工作,怎么做出有影响里的工作呢。我很想做一些简单、通用、elegant 的工作,可惜过了很久的时间也没一个很具体的想法。是不是应该从小的 case 开始入手呢?多智能体最近看起来挺热门的,入手也简单,但总觉得它们太繁复了。
对比其他(RAGAS、TruLens、ARES、RGB、RECALL、NoMIRAC),RagChecker 能 从人类角度评估 RAG 系统质量和可靠性方面的有效性,对错误来源做分析。
现有评估可分为两种方法:仅评估 generators 的基本功能 和 评估 RAG 系统的端到端性能。
SYS_INSTRUCTION = """Use triton language write a kernel and wrapper according to the following instruction:
"""
INSTRUCTION_EXTRA = """The wrapper function should have same input and output as in instruction, and written with 'def xxx' DIRECTLY, do not wrap the wrapper inside a class. You may write it as:
```python
@triton.jit
def kernel([parameters]):
# your implementation
def wrapper ([parameters]):
# your implementation
```
"""
prompt = f"""{SYS_INSTRUCTION}
{ORIGINAL_INSTRUCTION}
{INSTRUCTION_EXTRA}
"""
PROBLEM_STATEMENT = """You are given a pytorch function, and your task is to write the same triton implementation for it.
The triton implementation should change the name from Model to ModelNew, and have same input and output as the pytorch function."""
PROBLEM_INSTRUCTION = """Optimize the architecture with custom Triton kernels! Name your optimized output architecture ModelNew. Output the new code in codeblocks. Please generate real code, NOT pseudocode, make sure the code compiles and is fully functional. Just output the new model code, no input and init function, no other text, and NO testing code! **Remember to Name your optimized output architecture ModelNew, do not use Model again!**"""
prompt = f"""{PROBLEM_STATEMENT}
{PROBLEM_INSTRUCTION}
Now, you need to write the triton implementation for the following pytorch code:
```
{arc_src}
```
"""
You are an expert in CUDA programming and GPU kernel optimization. Now you’re tasked with developing a
high-performance cuda implementation of Softmax. The implementation must:
• Produce identical results to the reference PyTorch implementation.
• Demonstrate speed improvements on GPU.
• Maintain stability for large input values.
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a Softmax activation.
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Applies Softmax activation to the input tensor.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, num_features).
Returns:
torch.Tensor: Output tensor with Softmax applied, same shape as input.
"""
return torch.softmax(x, dim=1)
batch_size = 16
dim = 16384
def get_inputs():
x = torch.randn(batch_size, dim)
return [x]
def get_init_inputs():