V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  feirisu  ›  全部回复第 1 页 / 共 7 页
回复总数  136
1  2  3  4  5  6  7  
2 天前
回复了 934831065ldc 创建的主题 OpenAI 使用 gpt4o,如何计算图片 token?
c#代码,就是 auto 没测试是怎么自动 low 和 high 的


public static int CalculateImageTokens(int width, int height, ImageDetailMode detailMode)
{
const int lowDetailCost = 85;
const int highDetailCostPerSquare = 170;
const int highDetailBaseCost = 85;
const int maxDimension = 2048;
const int targetShortSide = 768;
const int squareSize = 512;


if (detailMode == ImageDetailMode.None)
{
detailMode = ImageDetailMode.High; //
}

if (detailMode == ImageDetailMode.Low)
{
return lowDetailCost;
}
else if (detailMode == ImageDetailMode.High)
{
bool scaledToMax = false;

// Scale down the image if either dimension exceeds the maximum allowed.
if (width > maxDimension || height > maxDimension)
{
double scaleFactor = Math.Min((double)maxDimension / width, (double)maxDimension / height);
width = (int)(width * scaleFactor);
height = (int)(height * scaleFactor);
scaledToMax = true;
}

// Further scale down the image only if it has been scaled in the previous step.
if (scaledToMax)
{
double scaleToShortestSideFactor = (double)targetShortSide / Math.Min(width, height);
width = (int)(width * scaleToShortestSideFactor);
height = (int)(height * scaleToShortestSideFactor);
}

// Calculate how many 512px squares are needed to cover the image.
int squaresAcross = (int)Math.Ceiling((double)width / squareSize);
int squaresDown = (int)Math.Ceiling((double)height / squareSize);
int totalSquares = squaresAcross * squaresDown;

// Calculate final token cost for high detail images.
return highDetailCostPerSquare * totalSquares + highDetailBaseCost;
}

return lowDetailCost;
}
自己付款公司报销吧,简单点

公司业务中转慎用,有假中转,给你换别便宜模型返回数据。。。
7 天前
回复了 jabari 创建的主题 程序员 Windows 11 是不是有内存泄漏问题?
任务管理器的用户标签里有没有多个用户登入?
代码都不行,经常调用某些类不存在的函数,也就早期 gpt3.5 的水平,中文理解可能略强一点
用 winrar 呀,几年前的干净版本
36 天前
回复了 dododada 创建的主题 程序员 AI 服务器配置报价
这俩 4090 能跑 70B 的 chat 模型吗
45 天前
回复了 AoEiuV020JP 创建的主题 程序员 电脑内存都被谁占了
45 天前
回复了 AoEiuV020JP 创建的主题 程序员 电脑内存都被谁占了
看看性能那里,“已提交”是虚拟内存,看看“使用中”多少,这个是物理的内存
@twofox 不用那些二道贩子,还能更便宜点
总感觉这些评测指标不是很靠谱。
我测试过一段字节压缩算法给 AI 解释并让给出优化方案,测试了 Opus ,和 GPT4 ,Opus 回答很明显不行,而 GPT4 确实能指出可优化的点,不知道是否是内置 prompt 的差距。
如果评测上各项指标都接近,我觉得至少应该给出类似的或接近的答案。
30w 理财,63 天收益 1400 ,我问 ChatGPT 年化多少,算了半天告诉我 27%
。。。
给他定义一个角色
#角色
你是 XXX ,年龄 XXX ,性格 XXX ,总是用有趣的俚语来对话。。。
大概就是这样。
微信公众号充值
51 天前
回复了 h3xz 创建的主题 程序员 c++对大量图片进行序列化和反序列化
就依照我#25 写的,可以直接让 chatgpt 给你封装一套打包加拆包的类。
51 天前
回复了 h3xz 创建的主题 程序员 c++对大量图片进行序列化和反序列化
大概懂了,就是游戏资源的打包方式呗,其设计目的就是不让用户修改,又能快速定位资源,格式也简单。

但是单文件过大建议考虑分包。

通常格式是:
固定自定义格式头,包含多少个文件[int]等
资源名长度[int]、资源名[char*]、资源尺寸[int]、资源内容[byte*]

读取时可以直接打开文件,用文件句柄偏移的方式可以快速构建索引以及针对对应的偏移取出数据。
51 天前
回复了 iqoo 创建的主题 程序员 发一个拼 CPU 性能的红包
windows ,7 小时 15 分,但是 CPU 没有一个核满载
51 天前
回复了 h3xz 创建的主题 程序员 c++对大量图片进行序列化和反序列化
没看懂
53 天前
回复了 ellermister 创建的主题 程序员 腾讯云后台崩了?
给你赔 2 块钱代金券,别不识好歹
1  2  3  4  5  6  7  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1552 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 48ms · UTC 17:11 · PVG 01:11 · LAX 10:11 · JFK 13:11
Developed with CodeLauncher
♥ Do have faith in what you're doing.