I'm running into an odd problem on an embedded device. When I run qt5
someQt5App -platform eglfs -plugin tslib
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
QTsLibMouseHandler "tslib" ""
Loading module /usr/lib/ts//input.so
Loading module /usr/lib/ts//pthres.so
Couldnt load module pthres
Error configuring
: No such file or directory
So this first made me think there is no pthres.so, but there is, I checked. I think pthres is failing to load properly and I'm not sure why. I have some strace output
write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = 13
read(13, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0p\5\0\0004\0\0\0"..., 512) = 512
fstat64(13, {st_mode=S_IFREG|0755, st_size=3940, ...}) = 0
mmap2(NULL, 35424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 13, 0) = 0x2aae4000
mprotect(0x2aae5000, 28672, PROT_NONE) = 0
mmap2(0x2aaec000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 13, 0) = 0x2aaec000
close(13) = 0
munmap(0x2aae4000, 35424) = 0
write(2, "Couldnt load module pthres\n", 27) = 27
close(12) = 0
munmap(0x2aae0000, 4096) = 0
write(2, "Error configuring\n: No such file"..., 46) = 46
write(5, "\1\0\0\0\0\0\0\0", 8) = 8
So here I can see that the module loaded, and for whatever reason closed and I'm not sure why it closed.
Pthres is available
# ls -l /usr/lib/ts/pthres.so
-rwxr-xr-x 1 root root 3940 Feb 24 2014 /usr/lib/ts/pthres.so
just for reference i moved pthres, here is the strace from that attempt
write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "Couldnt load module pthres\n", 27) = 27
close(12) = 0
munmap(0x2abaa000, 4096) = 0
write(2, "Error configuring\n: No such file"..., 46) = 46
Device environment (works with qt4/qws)
# env
TSLIB_TSDEVICE=/dev/input/event2
USER=root
OLDPWD=/
HOME=/
PAGER=/usr/bin/less
TERM=vt102
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TSLIB_CONFFILE=/etc/ts.conf
MANPAGER=/usr/bin/less
SHELL=/bin/sh
PWD=/usr/lib/ts
TZ=US/Eastern
POINTERCAL_FILE=/thermo/pointercal
TSLIB_CALIBFILE=/thermo/pointercal
Figured it out, it turns out that tslib's errors were misleading. It was a linking error with pthres and someone somewhere has a patch for it.
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c54a690..4aedac2 100644
## -107,15 +107,19 ## pluginexec_LTLIBRARIES = \
variance_la_SOURCES = variance.c
variance_la_LDFLAGS = -module $(LTVSN)
+variance_la_LIBADD = $(top_builddir)/src/libts.la
dejitter_la_SOURCES = dejitter.c
dejitter_la_LDFLAGS = -module $(LTVSN)
+dejitter_la_LIBADD = $(top_builddir)/src/libts.la
linear_la_SOURCES = linear.c
linear_la_LDFLAGS = -module $(LTVSN)
+linear_la_LIBADD = $(top_builddir)/src/libts.la
pthres_la_SOURCES = pthres.c
pthres_la_LDFLAGS = -module $(LTVSN)
+pthres_la_LIBADD = $(top_builddir)/src/libts.la
# hw access
corgi_la_SOURCES = corgi-raw.c
You can either modify the makfile.am as Kevin has mentioned or you can run the below command and run your application without any hastle.
export LD_PRELOAD=/usr/lib/libts-x.x.so.x.x.x
where x is the version of tslib you are using
Related
I am following a tutorial and I did every possible thing to get rid of this error but all in vain.
Can you help?
directory =r"C://Users/Ansari/PycharmProjects/Music/dataset"
f = open("my.dat", 'wb')
i = 0
for folder in os.listdir(directory):
i += 1
if i == 11:
break
for files in os.listdir(directory+folder):
(rate,sig) = wav.read(directory+folder+"/"+my.dat)
mfcc_feat = mfcc(sig,rate ,winlen=0.020, appendEnergy = False)
covariance = np.cov(np.matrix.transpose(mfcc_feat))
mean_matrix = mfcc_feat.mean(0)
feature = (mean_matrix , covariance , i)
pickle.dump(feature , f)
f.close()
I am trying to run RBERT in tensorflow on small dataset. I have installed Tensorflow using the miniconda environment. Below is the code which throws the error:
> Sys.setenv(RETICULATE_PYTHON =
> "/Users/applemacbookpro/opt/miniconda3/envs/tensorflowa/bin/python")
>
> #Make virtual environment in anaconda
>
> reticulate::conda_list()[[1]][8] %>%
> reticulate::use_condaenv(required = TRUE)
>
>
> #Load the libraries library(keras) library(tidyverse) library(stringr) library(tidytext) library(caret) library(dplyr) library(tm)
> library(RBERT) library(tensorflow) library(reticulate)
>
> #Install RBERT
>
> devtools::install("/Users/applemacbookpro/Downloads/RBERT")
>
> #Initiate BERT BERT_PRETRAINED_DIR <- RBERT::download_BERT_checkpoint(model = "bert_base_uncased")
>
>
> #Extract tokenized words from agency trainset BERT_feats <- extract_features( examples = agency_trainset$agency, ckpt_dir =
> BERT_PRETRAINED_DIR, layer_indexes = 1:12, )
Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: ValueError: Tried to convert 'size' to a tensor and failed.
Error: Cannot convert a partially known TensorShape to a Tensor: (128, ?).
Traceback:
stop(structure(list(message = "RuntimeError: Evaluation error: ValueError: Tried to convert 'size' to a tensor and failed. Error: Cannot convert a partially known TensorShape to a Tensor: (128, ?).",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = structure(list(file = "", line = -1L, stack = c("1 reticulate.so 0x000000010773d3de _ZN4Rcpp9exceptionC2EPKcb + 222",
"2 reticulate.so 0x0000000107746245 _ZN4Rcpp4stopERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 53", ...
13.
python_function at call.py#21
12.
fn at <string>#4
11.
_call_model_fn at tpu_estimator.py#1524
10.
call_without_tpu at tpu_estimator.py#1250
9.
_model_fn at tpu_estimator.py#2470
8.
_call_model_fn at estimator.py#1169
7.
_call_model_fn at tpu_estimator.py#2186
6.
predict at estimator.py#551
5.
predict at tpu_estimator.py#2431
4.
raise_errors at error_handling.py#128
3.
predict at tpu_estimator.py#2437
2.
result_iterator$`next`()
1.
extract_features(examples = agency_trainset$agency, ckpt_dir = BERT_PRETRAINED_DIR,
layer_indexes = 1:12, )
There is a lot of literature on the topic but none of those I could find use a GeoPandas reader.
My code purpose is to identify if a point is located into a polygone described in a .shp file stored in S3. It's then expected to return a boolean True or False.
I use python-lambda-local python module to test my python script located on PyCharm.
import geopandas as gpd
from geopandas.geoseries import *
import boto3
from io import BytesIO
def search(event, context):
dep = event['Dep']
arr = event['Arr']
point_1 = GeoSeries(dep)
point_2 = GeoSeries(arr)
s3 = boto3.client("s3")
bucket = "mybucket"
obj_key = "filename.shp"
# bytes_buffer = BytesIO()
# client.download_fileobj(Bucket=bucket, Key=obj_key, Fileobj=bytes_buffer)
obj = s3.download_file(Bucket=bucket, Key="filename.shp", Filename=obj_key)
geo = obj['body'].read().decode('ISO-8859-9')
# geo = bytes_buffer.get_key(obj_key).get_contents_as_string()
answer = gpd.read_file(geo)
print(answer)
As you can see in the code, I tried a few different lines to use IO and the reader() in different ways. Always unsuccessfully though.
#And this is the error message:#
MacBook-Pro:IdPolygons me$ python-lambda-local -l lib/ -f search -t 4 IdAircraft.py event.json
*This is the point I'm trying to identify inside or outside the polygon:*
[root - INFO - 2019-12-24 07:33:54,388] Event: {'Dep': '(40.7128, 74.0060)', 'Arr': '(48.8566, 2.3522)'}
[root - INFO - 2019-12-24 07:33:54,388] START RequestId: 629c76c7-1008-40cc-8c09-6c5dd3877125 Version:
[botocore.credentials - INFO - 2019-12-24 07:33:54,923] Found credentials in shared credentials file: ~/.aws/credentials stored
[root - INFO - 2019-12-24 07:33:55,576] END RequestId: 629c76c7-1008-40cc-8c09-6c5dd3877125
[root - INFO - 2019-12-24 07:33:55,577] REPORT RequestId: 629c76c7-1008-40cc-8c09-6c5dd3877125 Duration: 663.91 ms
[root - INFO - 2019-12-24 07:33:55,577] RESULT:
{
"errorMessage": "'NoneType' object has no attribute 'startswith'",
"stackTrace": [
" File \"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/lambda_local/main.py\", line 153, in execute\n result = func(event, context._activate())\n",
" File \"IdAircraft.py\", line 30, in search\n df1 = gpd.read_file(obj)\n",
" File \"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/geopandas/io/file.py\", line 77, in read_file\n with reader(path_or_bytes, **kwargs) as features:\n",
" File \"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fiona/env.py\", line 397, in wrapper\n return f(*args, **kwargs)\n",
" File \"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fiona/__init__.py\", line 249, in open\n path = parse_path(fp)\n",
" File \"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/fiona/path.py\", line 132, in parse_path\n elif path.startswith('/vsi'):\n"
],
"errorType": "AttributeError"
}
Thank you for taking the time.
Recently, our lab bought a new server with 9 GPUs and I want to run my programming on this machine. However, I do not change my right code and I got an unexpected error like the following.
THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1535491974311/work/aten/src/THC/THCGeneral.cpp line=663 error=11 : invalid argument
Traceback (most recent call last):
File "main.py", line 166, in <module>
p_img.copy_(netG(p_z).detach())
File "/usr/local/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/szhangcj/python/GBGAN/celebA_attention/sagan_models.py", line 100, in forward
out,p1 = self.attn1(out)
File "/usr/local/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/szhangcj/python/GBGAN/celebA_attention/sagan_models.py", line 32, in forward
energy = torch.bmm(proj_query,proj_key) # transpose check
RuntimeError: cublas runtime error : the GPU program failed to execute at /opt/conda/conda-bld/pytorch_1535491974311/work/aten/src/THC/THCBlas.cu:411
However, I can run my programming successfully on the old machine with 4 GPUs. I am not sure what the problem is and it seems that the error is caused by the detach() function. My code is as the following.
z_b = torch.FloatTensor(opt.batch_size, opt.z_dim).to(device)
img_b = torch.FloatTensor(opt.batch_size, 3, 64, 64).to(device)
img_a = torch.FloatTensor(opt.batch_size, 3, 64, 64).to(device)
p_z = torch.FloatTensor(pool_size, opt.z_dim).to(device)
p_img = torch.FloatTensor(pool_size, 3, 64, 64).to(device)
## evaluation placeholder
show_z_b = torch.FloatTensor(100, opt.z_dim).to(device)
eval_z_b = torch.FloatTensor(250, opt.z_dim).to(device) # 250/batch * 120 --> 300000
optim_D = optim.Adam(netD.parameters(), lr=opt.lr_d) # other param?
optim_G = optim.Adam(netG.parameters(), lr=opt.lr_g) #?suitable
criterion_G = nn.MSELoss()
eta = 1
loss_GD = []
pre_loss = 0
cur_loss = 0
G_epoch = 1
for epoch in range(start_epoch, start_epoch + opt.num_epoch):
print('Start epoch: %d' % epoch)
## input_pool: [pool_size, opt.z_dim] -> [pool_size, 32, 32]
netD.train()
netG.eval()
p_z.normal_()
# print(netG(p_z).detach().size())
p_img.copy_(netG(p_z).detach())
for t in range(opt.period):
for _ in range(opt.dsteps):
t = time.time()
### Update D
netD.zero_grad()
## real
real_img, _ = next(iter(dataloader)) # [batch_size, 1, 32, 32]
img_b.copy_(real_img.squeeze().to(device))
real_D_err = torch.log(1 + torch.exp(-netD(img_b))).mean()
print("D real loss", netD(img_b).mean())
# real_D_err.backward()
## fake
z_b_idx = random.sample(range(pool_size), opt.batch_size)
img_a.copy_(p_img[z_b_idx])
fake_D_err = torch.log(1 + torch.exp(netD(img_a))).mean() # torch scalar[]
loss_gp = calc_gradient_penalty(netD, img_b, img_a)
total_loss = real_D_err + fake_D_err + loss_gp
print("D fake loss", netD(img_a).mean())
total_loss.backward()
optim_D.step()
## update input pool
p_img_t = p_img.clone().to(device)
p_img_t.requires_grad_(True)
if p_img_t.grad is not None:
p_img_t.grad.zero_()
fake_D_score = netD(p_img_t)
fake_D_score.backward(torch.ones(len(p_img_t)).to(device))
p_img = img_truncate(p_img + eta * p_img_t.grad)
print("The mean of gradient", torch.mean(p_img_t.grad))
The error is caused by the version mismatching between the RTX GPU cards and the CUDA driver.
I'm trying to figure out how to turn "TrueColor" on for a Microsoft LifeCam. I have a couple big USB logs from USBSniffer, and some sequences which consistently show up when I click the checkbox in Microsoft's software. Here's a request from the beginning of the enable sequence, and the device response (please correct me if I'm misinterpreting this data btw):
[156918643 ms] UsbSnoop - FilterDispatchAny(ac56afd2) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[156918643 ms] UsbSnoop - FdoHookDispatchInternalIoctl(ac56b1ea) : fdo=88b25448, Irp=889911d8, IRQL=0
[156918643 ms] >>> URB 1482 going down >>>
-- URB_FUNCTION_CLASS_INTERFACE:
TransferFlags = 00000001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000002
TransferBuffer = abb04b86
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000085
Value = 00001600
Index = 00000500
[156918644 ms] UsbSnoop - MyInternalIOCTLCompletion(ac56b126) : fido=00000000, Irp=889911d8, Context=894d6c98, IRQL=2
[156918644 ms] <<< URB 1482 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 885639a0
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000002
TransferBuffer = abb04b86
TransferBufferMDL = 8837fee0
00000000: 40 00
UrbLink = 00000000
SetupPacket =
00000000: a1 85 00 16 00 05 02 00
Now, I'd like to send the sequence of requests I've seen via PyUSB, but when I send that first one, I get:
>>> ret = dev.ctrl_transfer(0x80, 0x85, 0x1600, 0x0500, 8)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\Python24\Lib\site-packages\usb\core.py", line 702, in ctrl_transfer
self.__get_timeout(timeout)
File "c:\Python24\Lib\site-packages\usb\backend\libusb0.py", line 539, in ctrl_transfer
timeout
File "c:\Python24\Lib\site-packages\usb\backend\libusb0.py", line 387, in _check
raise USBError(errmsg, ret)
usb.core.USBError: (None, 'usb_control_msg: invalid request 0x85')
For what it's worth, a simple GET_STATUS seems to work:
>>> ret = dev.ctrl_transfer(0x80, 0, 0, 0, 8)
>>> print ret
array('B', [0, 0])
Why would a request which gets answered in one case be invalid in another? Syntax? Device state?
From the very helpful USB Made Simple, the request type's highest 3 bits are formatted like so:
D7 Data direction
0 - Host-to-device
1 - Device-to-host
D6:5 Type
0 = Standard
1 = Class
2 = Vendor
3 = Reserved
The log says I'm using USB's Class interface (cf. "URB_FUNCTION_CLASS_INTERFACE"), so the RequestType is specific to the device class (audio, physical... in this case video). The GET_STATUS command works because it is of the Standard type.
So a more correct command is
ret = dev.ctrl_transfer(0xa0, 0x85, 0x1600, 0x0500, 8)
I say more correct because the command returns data, but it's still not the data I expect!
EDIT: for complete verisimilitude, I needed to specify the recipient as the interface, according to the rest of the request type table from USB Made Simple:
D4:0 Recipient
0 = Device
1 = Interface
2 = Endpoint
3 = Other
4-31 = Reserved
...and also set the length to be the same as the sniffed request, so the true version of the command is:
ret = dev.ctrl_transfer(0xa1, 0x85, 0x1600, 0x0500, 2)