使用cuda时出现问题,此问题在没有jt.flags.use_cuda=1时没有出现

我的程序是在GRU模型下仅使用hn进行后续操作。
这在没有jt.flags.use_cuda=1的时候可以正常运行

Module部分为:

class Model(Module):
	def __init__(self):
		self.rnn = nn.GRU(50,200)
		self.layer1 = nn.Linear(200,1)
	def execute (self,x) :
		y=jt.float32([[[0]*200]*len(x[0])])
		x,y=self.rnn(x,y)
		y=self.layer1(y)
		y=jt.sigmoid(y)
		return y

训练部分为(损失函数使用差的平方同样无法运行):

		y=model(jt.float32(x))
		Y=jt.float32(Y)
#		loss=((y-Y)**2).mean()
		loss=-(Y*jt.log(y)+(1-Y)*jt.log(1-y)).mean()
		if jt.isnan(loss):
			print(y,Y,loss)
			exit(0)
		optim.step(loss)

错误信息如下:

raise_cxx_exception 3221225477
Traceback (most recent call last):
  File "C:\Users\hh826\Documents\code\code\thu_homework\AI_intro\text_classfiy\rnn.py", line 92, in <module>
    optim.step(loss)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\optim.py", line 260, in step
    self.pre_step(loss)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\optim.py", line 121, in pre_step
    grads = jt.grad(loss, params_has_grad, retain_graph)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\__init__.py", line 362, in grad
    return core.grad(loss, targets, retain_graph)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.grad)).

Types of your inputs are:
 self   = module,
 args   = (Var, list, bool, ),

The function declarations are:
 vector<VarHolder*> _grad(VarHolder* loss, const vector<VarHolder*>& targets, bool retain_graph=true)

Failed reason:exception: access violation reading 0000000000000008

如果您使用 Jittor 时遇到了安装问题、运行错误、输出错误等问题,您可以在 “问答” 区提问。
为了更好地定位您的问题,建议包含以下内容:
错误信息、Jittor 运行的完整 log、复现此问题的代码或者描述、您认为正确结果应当如何
这是一个很好的 参考模板

您好,

我们已经复现了这个问题,并正在处理,修复之后会第一时间告知您。

如果您希望马上使用 Jittor 的RNN,可以在 jt.flags.use=1 后加上一句 jt.cudnn=None。

感谢您的反馈。

1 个赞

您好,Jittor-1.3.3.13 版本已经修复这个问题,您可以更新 jittor 使用 CUDNN 加速 GRU 的计算。

谢谢,但是更新出现了问题。

ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\commands\install.py", line 405, in run
    installed = install_given_reqs(
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\req\__init__.py", line 68, in install_given_reqs
    uninstalled_pathset = requirement.uninstall(auto_confirm=True)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\req\req_install.py", line 637, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\req\req_uninstall.py", line 475, in from_dist
    installed_files = dist.iter_declared_entries()
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\metadata\base.py", line 441, in iter_declared_entries
    or self._iter_declared_entries_from_legacy()
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\metadata\base.py", line 409, in _iter_declared_entries_from_legacy
    text = self.read_text("installed-files.txt")
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 165, in read_text
    content = self._dist.get_metadata(name)
  File "C:\Users\hh826\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1424, in get_metadata
    return value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb7 in position 8394: invalid start byte in installed-files.txt file at path: c:\users\hh826\appdata\local\programs\python\python310\lib\site-packages\jittor-1.3.3.11-py3.10.egg-info\installed-files.txt

您好,可以删除 c:\users\hh826\appdata\local\programs\python\python310\lib\site-packages\jittor-1.3.3.11-py3.10.egg-info\installed-files.txt ,再尝试更新