"megatron/deprecated_data_utils/datasets.py" did not exist on "93ab4bea59dc5cbf97c079d313741866af4deac9"
test.py 675 Bytes
Newer Older
yongshk's avatar
yongshk committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import candle

print(f"mkl:         {candle.utils.has_mkl()}")
print(f"accelerate:  {candle.utils.has_accelerate()}")
print(f"num-threads: {candle.utils.get_num_threads()}")
print(f"cuda:        {candle.utils.cuda_is_available()}")

t = candle.Tensor(42.0)
print(t)
print(t.shape, t.rank, t.device)
print(t + t)

t = candle.Tensor([3.0, 1, 4, 1, 5, 9, 2, 6])
print(t)
print(t + t)

t = t.reshape([2, 4])
print(t.matmul(t.t()))

print(t.to_dtype(candle.u8))
print(t.to_dtype("u8"))

t = candle.randn((5, 3))
print(t)
print(t.dtype)

t = candle.randn((16, 256))
quant_t = t.quantize("q6k")
dequant_t = quant_t.dequantize()
diff2 = (t - dequant_t).sqr()
print(diff2.mean_all())