mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #81] errors in finetuning the clip using my own datasets #75
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lycutter on GitHub (Apr 7, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/81
Traceback (most recent call last):
File "E:\PyCharm Community Edition 2020.1.4\plugins\python-ce\helpers\pydev\pydevd.py", line 1438, in exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "E:\PyCharm Community Edition 2020.1.4\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "G:/PythonWorkplace/ImageCLEF2021/train_clip.py", line 207, in
loss.backward(create_graph=True)
File "E:\Anaconda\envs\clip\lib\site-packages\torch\tensor.py", line 221, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "E:\Anaconda\envs\clip\lib\site-packages\torch\autograd_init.py", line 132, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: default_program(58): error: identifier "aten_mul_flat__1" is undefined
default_program(59): error: no operator "=" matches these operands
operand types are: half = float
2 errors detected in the compilation of "default_program".
nvrtc compilation failed:
#define NAN __int_as_float(0x7fffffff)
#define POS_INFINITY __int_as_float(0x7f800000)
#define NEG_INFINITY __int_as_float(0xff800000)
template
device T maximum(T a, T b) {
return isnan(a) ? a : (a > b ? a : b);
}
template
device T minimum(T a, T b) {
return isnan(a) ? a : (a < b ? a : b);
}
#define __HALF_TO_US(var) *(reinterpret_cast<unsigned short *>(&(var)))
#define __HALF_TO_CUS(var) *(reinterpret_cast<const unsigned short *>(&(var)))
#if defined(__cplusplus)
struct align(2) __half {
host device __half() { }
protected:
unsigned short __x;
};
/* All intrinsic functions are only available to nvcc compilers /
#if defined(CUDACC)
/ Definitions of intrinsics */
device __half __float2half(const float f) {
__half val;
asm("{ cvt.rn.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(f));
return val;
}
#endif /* defined(CUDACC) /
#endif / defined(__cplusplus) */
#undef __HALF_TO_US
#undef __HALF_TO_CUS
typedef __half half;
extern "C" global
void func_25(half* t0, half* t1, half* t2, half* t3, half* aten_add_flat, half* aten_mul_flat, half* aten_add_flat_1, half* aten_mul_flat_1) {
{
float v = __half2float(t0[512 * blockIdx.x + threadIdx.x]);
aten_add_flat_1[512 * blockIdx.x + threadIdx.x] = _float2half((0.f - v) + 1.f);
float t1 = _half2float(t1[512 * blockIdx.x + threadIdx.x]);
float t2 = _half2float(t2[512 * blockIdx.x + threadIdx.x]);
float aten_mul_flat = _half2float(aten_mul_flat_1[512 * blockIdx.x + threadIdx.x]);
aten_mul_flat__1 = float2half(t1 * t2);
aten_mul_flat_1[512 * blockIdx.x + threadIdx.x] = aten_mul_flat;
float v_1 = __half2float(t0[512 * blockIdx.x + threadIdx.x]);
float v_2 = __half2float(t0[512 * blockIdx.x + threadIdx.x]);
aten_mul_flat[512 * blockIdx.x + threadIdx.x] = __float2half(((0.f - v_1) + 1.f) * v_2);
float v_3 = __half2float(t3[512 * blockIdx.x + threadIdx.x]);
float v_4 = __half2float(t0[512 * blockIdx.x + threadIdx.x]);
float v_5 = _half2float(t0[512 * blockIdx.x + threadIdx.x]);
aten_add_flat[512 * blockIdx.x + threadIdx.x] = float2half(t1 * v_3 + ((((0.f - v_4) + 1.f) * v_5) * (t1 * t2)) * 1.702000021934509f);
}
}
@vinson2233 commented on GitHub (Apr 8, 2021):
It will be much helpful if you can show your training code, and point out which line is giving the error.
Is there any reason to put
create_graph=Truein the backward? I don't use that when training the CLIP and it works fine for me.@lycutter commented on GitHub (Apr 8, 2021):
It works, thanks!