Comments (7)
Hi @hy928302776
spu 目前是用的 fixedpoint 来编码浮点数
0.99 是一个需要很多 fraction bits 才可以相对精确表达的一个值
如果有实际需求,可以尝试使用 fm128+比较多的 fraction bits 来一定程度的改善精度损失
from spu.
这个有什么好的办法解决精度丢失问题吗?我这边该怎么做呢?上边说的 尝试使用 fm128+比较多的 fraction bits 来一定程度的改善精度损失 这个怎么做
from spu.
这个有什么好的办法解决精度丢失问题吗?我这边该怎么做呢?上边说的 尝试使用 fm128+比较多的 fraction bits 来一定程度的改善精度损失 这个怎么做
用这个做个例子
runtime_config={
'protocol': spu.spu_pb2.ABY3,
'field': spu.spu_pb2.FM128
},
如果默认的依然不够精度,可以试一下加一个
'fxp_fraction_bits': 30
30 是一个可以配置的选项,可以根据自己的 fxp 需求计算一下大概需要多少 fxp bits
from spu.
DEFAULT_SEMI2K_RUNTIME_CONFIG = {
'protocol': spu.spu_pb2.SEMI2K,
'field': spu.spu_pb2.FM128,
'fxp_fraction_bits': 30,
}
我们的是两方计算,使用的这个协议配置,测试了下,还是不行,修改了fxp_fraction_bits的值也不行。计算:
199999.97 - 100.01 结果返回还是 199899.95
from spu.
DEFAULT_SEMI2K_RUNTIME_CONFIG = { 'protocol': spu.spu_pb2.SEMI2K, 'field': spu.spu_pb2.FM128, 'fxp_fraction_bits': 30, } 我们的是两方计算,使用的这个协议配置,测试了下,还是不行,修改了fxp_fraction_bits的值也不行。计算: 199999.97 - 100.01 结果返回还是 199899.95
我仔细研究了一下现在大概是这样的的,用 FM64 举个例子:
199999.97 encode 到 fxp 是 52428791808
100.01 encode 到 fxp 是 26217022
52428791808 - 26217022 = 52402574786
result = 52402574786/(2^18)
这个数值在 f32 的时候是 199899.953125,所以结果出来会是 .95
如果用 f64, 这个值会是 199899.95874786376953
我们会在后续更新里尝试支持 f64 来解决这个精度问题
from spu.
from spu.
这个f64啥时间更新上去呢,我们着急使用发自我的 iPhone在 2023年5月18日,18:05,anakinxc @.> 写道: DEFAULT_SEMI2K_RUNTIME_CONFIG = { 'protocol': spu.spu_pb2.SEMI2K, 'field': spu.spu_pb2.FM128, 'fxp_fraction_bits': 30, } 我们的是两方计算,使用的这个协议配置,测试了下,还是不行,修改了fxp_fraction_bits的值也不行。计算: 199999.97 - 100.01 结果返回还是 199899.95 我仔细研究了一下现在大概是这样的的,用 FM64 举个例子: 199999.97 encode 到 fxp 是 52428791808 100.01 encode 到 fxp 是 26217022 52428791808 - 26217022 = 52402574786 result = 52402574786/(2^18) 这个数值在 f32 的时候是 199899.953125,所以结果出来会是 .95 如果用 f64, 这个值会是 199899.95874786376953 我们会在后续更新里尝试支持 f64 来解决这个精度问题 —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>
这个我们会尽快更新的
from spu.
Related Issues (20)
- [Bug]: gRPC Socket Shutting Down After Many Runs HOT 7
- [Bug]: gcc 11.2下的编译问题 HOT 12
- [Question]: 能否不重复编译外部库,加速编译速度? HOT 4
- [Question]: stub_method方法实现将函数交由server执行,请问如何调试server中函数的具体执行过程? HOT 4
- [Question]: Common type of Ashare and Bshare HOT 1
- [Question]: Evaluating the model with significantly reduced number of ReLUs receives limited communication savings HOT 17
- [Question]: Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.0KiB (rounded to 3072) HOT 9
- [Usability]: 运行LLaMa时报错'Config' object has no attribute 'define_bool_state' HOT 10
- 我想请问一下bumblebee的复现配置 HOT 4
- When i use spu infenrence on vit, on cifar10, the result changes every time HOT 4
- [Bug]: example/ml/flax_gpt2 文档依赖冲突 HOT 2
- 2PC下SPU返回的推理结果不正确 HOT 2
- [Bug]: Run example "simple_pphlo.cc" failed HOT 3
- 使用SPU实现Robust Scaler预处理算法
- 使用 SPU 实现 QuantileTransformer 预处理算法
- 使用 SPU 实现 OneHotEncoder
- 使用SPU实现两个accuracy函数
- 使用 SPU 实现 AP(average_precision_score) 函数
- 使用 SPU 实现 brier_score_loss 函数
- 老师们好,请问这个https://www.secretflow.org.cn/zh-CN/docs/secretflow/v1.6.1b0/tutorial/gpt2_with_spu在使用spu过程中,不需要劫持gelu函数和softmax的替换吗 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spu.