Categories
Tag: KeyError
Cannot connect to the server, what am I missing? – JupyterHub
The hub on the host severed directly on my machine (not via docker image). I run the jupyterhub with command arg –debug, and got the terminal infomation as follows: root@DESKTOP-L60P4Q8:~/my_docker/main# jupyterhub –debug -f ../jupyterhub_config.py [D 2023-12-07 23:00:23.417 JupyterHub application:908] Looking for ../jupyterhub_config in /root/my_docker/main [D 2023-12-07 23:00:23.417 JupyterHub application:929] Loaded…
Customizing OpenAPI Authorization Method for FastAPI
from fastapi import FastAPI, HTTPException from pydantic import BaseModel app = FastAPI() class Token(BaseModel): “”” Token model to represent the structure of the token data. “”” expiresIn: int token: str def get_token(token_data: dict) -> str: “”” Function to extract the token from the given token data. Parameters: – token_data: dict…
How can I amend the output of a DIAMOND python script?
Hello, please help a struggling wet-lab biologist. I am trying to identify Cluster of Orthologous Groups (COG) categories for a list of gene sequences. I configured a COG database and used DIAMOND to blast query sequences against this database. This provides a results.cog file that in my case is formatted…
Hierarchical bayesian interaction model specification using pymc3
I’m currently working on modeling a 2-level hierarchical Bayesian regression using pymc3 in Python. I’ve extensively searched for resources on Bayesian hierarchical regression, but most examples I found involve hierarchical models with a categorical variable at the second level, resembling the Hierarchical Linear model from the pymc3 documentation: GLM-hierarchical. However,…
cellphonedb results visualization
I want to visualize cellphonedb results but I get several error. I do visualization by ktplotspy package. First, I read the required files based on its tutorials and when I try to create the heatmap, it gives an error: code: kpy.plot_cpdb_heatmap( adata=adata, pvals=pvals, celltype_key=”celltype”, figsize = (5,5), title = “Sum…
Cookie_options argument on Spawner is returning an error – The Littlest JupyterHub
I’m trying to secure the xsrf cookie passing the tornado_settings through arguments of the Spawner with the following code: c.Spawner.args = [“–ServerApp.tornado_settings= “cookie_options”: {“SameSite”: “None”,”Secure”: True }, “xsrf_cookie_kwargs”: {“httponly”: True,”secure”: True,”expires_days”:1} }”] But the jupyterHub service is giving me this error: Nov 13 19:39:07 myserver python3[205310]: [E 2023-11-13 19:39:07.546 JupyterHub…
pytorch – Converting a hugging face model into complete .pt file
I have downloaded a Hugging Face model, and it comes with various files, including pytorch_model.bin, config.json, and others. My goal is to integrate this model into my project, and I would like to convert it into a single .pt file for ease of use. Can someone guide me through the…
Error finetuning wav2vec2-xls-r-300m on kaggle TPU – Models
Here is my current code:from transformers import Wav2Vec2ForCTC`model = Wav2Vec2ForCTC.from_pretrained(“facebook/wav2vec2-xls-r-300m”,attention_dropout=0.1,hidden_dropout=0.1,feat_proj_dropout=0.0,mask_time_prob=0.0,layerdrop=0.1,ctc_loss_reduction=“mean”,pad_token_id=processor.tokenizer.pad_token_id,vocab_size=len(processor.tokenizer),) from transformers import TrainingArguments training_args = TrainingArguments(output_dir=run_config[“hub_repo”],per_device_train_batch_size=64,per_device_eval_batch_size=64,gradient_accumulation_steps=1,evaluation_strategy=“steps”,num_train_epochs=30,gradient_checkpointing=True,torch_compile=True,bf16=True,save_steps=400,eval_steps=400,logging_steps=400,learning_rate=3e-4,warmup_steps=500,save_total_limit=2,push_to_hub=True,dataloader_num_workers=2,tpu_num_cores=8,)trainer.train()` Error `KeyError Traceback (most recent call last)Cell In[67], line 1—-> 1 trainer.train() File /usr/local/lib/python3.8/site-packages/transformers/trainer.py:1547, in Trainer.train(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)1544 try:1545 # Disable progress bars when uploading models during checkpoints to avoid polluting…
python – Exception in Pytorch multi-output regression
I’m quite new to both Python and Pytorch and I’m attempting to create a multi-output regression neural network with 4 inputs and 2 outputs, all numerical. Here is my code: import pandas as pd #For working with dataframes import matplotlib.pyplot as plt #For representation import torch from torch import nn…
Adding ‘SameSite’ to ‘tornado_settings.cookie_options’ causes an error – Zero to JupyterHub on Kubernetes
kghoon September 12, 2023, 6:29am 1 When adding the SameSite option to c.JupyterHub.tornado_settings, an error occurs while spawning a singleuser notebook. I am using the helm chart release version 3.0.3. The contents of the config.yaml file are as follows. hub: baseUrl: /jupyter config: Authenticator: admin_users: – root – “542380” JupyterHub:…
python – Pandas KeyError in Kaggle set
I am new to pandas and manipulated some internet code to work with this dataset. I made minor adjustments to the dataset (broke down pressure to two columns, rename headers, etc) and spend some reasonable time debugging. I cannot get this code to work, I always get a KeyError for…
How to implement the code in MonkeyBread package
I get the following error when I want to implement this : (older_path=”/Users/Desktop/MonkeyBread adata = mb.util.load_merscope(folder_path) … reading from cache file cache/Users-pedram-Desktop-MonkeyBread-cell_by_gene.h5ad) KeyError Traceback (most recent call last) Input In [16], in <cell line: 2>() 1 folder_path = “/Users/pedram/Desktop/MonkeyBread’ —-> 2 adata = mb.util.load_merscope(folder_path) File ~/opt/anaconda3/lib/python3.9/site-packages/monkeybread/util/_load_merscope.py:74, in load_merscope(folder, use_cache, cell_bounds,…
Jhub failing with Missing required environment $JUPYTERHUB_SERVICE_URL jupyterhub version 3.4.6 – JupyterHub
We are trying to run jhub single user with nvidia gpu running on eks failing with below error [E 2023-06-30 15:35:59.931 JupyterHubSingleUser] Failed to load JupyterHubSingleUser server extensionTraceback (most recent call last):File “/opt/conda/lib/python3.10/site-packages/jupyterhub/singleuser/extension.py”, line 274, in wrappedr = f(self, *args, **kwargs)File “/opt/conda/lib/python3.10/site-packages/jupyterhub/singleuser/extension.py”, line 472, in load_config_fileraise KeyError(“Missing required environment $JUPYTERHUB_SERVICE_URL”)KeyError:…
KeyError: ‘No action for destination key “trainer.devices” to set its default.’ – Trainer
I have been creating a wrapper for CLIP using pytorch-lightning in order to finetune CLIP on Image Remote Sesing Captioning. I have been using LightningCLI to handle the argument parsing for the model, the trainer etc. I am finetuning CLIP using RSICD dataset. When I start the training, something strange…
rstudio connection to galaxy – Galaxy Community Help
chufz June 13, 2023, 1:15pm 1 Hi all,i tried rstudio as interactive tool, however, the proposed commands of gx_put() and gx_get() seem not to work in the moment. Please find the received error message in the console of rstudio in the screenshot below. wm75 June 13, 2023, 6:26pm 2 Is…
h5ad cellxgene to R
I am trying to bring this small dataset (1496 cells, 43MB) from cellxgene. 1 R SeuratDisk h5ad to h5seurat and then to seurat. library(SeuratDisk) SeuratDisk::Convert(“local.h5ad”, dest = “local.h5seurat”, overwrite=TRUE) g <- SeuratDisk::LoadH5Seurat(“local.h5seurat”, meta.data=FALSE, misc=FALSE) Validating h5Seurat file Initializing RNA with data Adding counts for RNA Adding feature-level metadata for RNA…
Named Server and unique Workdirectories – JupyterHub
Is there somehow possible to define individual working directories for each named server?(e.g. /home/jupyter-USERNAME/Servername/) The background is that I would like to use a named server for each project I am working on and only have access to the data for this project. Currently, all Named Servers use the same…
pytorch geometric dgcnn
package manager since it installs all dependencies. (defualt: 5), num_electrodes (int) The number of electrodes. I plugged the DGCNN model into my semantic segmentation framework in which I use other models like PointNet or PointNet++ without problems. This commit does not belong to any branch on this repository, and may…
‘validation/main/loss’ in pytorch when use multiple gpu in training
hi, I use aishell recipe and running asr_train.py. When I use single GPU, it work well. However, when I use 2GPU, it finish training at the end of first epoch and throw the error: KeyError: ‘validation/main/loss’ error. [J/home/lcf/anaconda3/envs/python36/lib/python3.6/site-packages/torch/nn/parallel/_functions.py:61: UserWarning: Was asked to gather along dimension 0, but all input tensors…
Failed to start service – nbgrader with jupyterhub – JupyterHub
csee May 16, 2023, 12:39pm 1 I try to get nbgrader to run with a jupyterhub 2.3 but get an error (Failed to start service)It seems to be because a user is not found as it says:jupyterhub | File “/usr/local/lib/python3.8/dist-packages/jupyterhub/spawner.py”, line 1487, in user_envjupyterhub | home = pwd.getpwnam(self.user.name).pw_dirjupyterhub | KeyError:…
pytorch – I’m having trouble applying mmdetection
I made the custom format dataset follow the MS coco format. Then, I placed the jpg image where the json file is. The train dataset file structure is as follows. mmdetection/data/coco/train/annotation_data/, mmdetection/data/coco/train/image_data test dataset follows.. mmdetection/data/coco/test/image_data, no annotaion data! val dataset follows.. mmdetection/data/coco/val/annotation_data, mmdetection/data/coco/val/image_data The annotaion json file is organized…
Jupyerhub spawner failing with an exception: “Initial list of events failed” – Zero to JupyterHub on Kubernetes
I am installing jupyterhub on k8s cluster using the following instructions z2jh.jupyter.org Installing JupyterHub With a Kubernetes cluster cluster available and Helm installed, we can install JupyterHub in the Kubernetes cluster using the JupyterHub Helm chart. Initialize a Helm chart configuration file: Helm… Kubectl Client Version: v1.27.1Kubectl Server Version: v1.20.12helm…
How to Auto-Create Users for SimpleLocalProcessSpawner on 3rd Party Login alongside Conda? – JupyterHub
Context:I am trying to setup JupyterHub (on a single EC2 server, HTTPS is provided via a reverse Nginx proxy URL) such that a small number of users authenticate with a 3rd party Solution (KeyCloak) and upon redirect back to the JupyterHub/Lab will automatically have a user created for them locally….
python – KeyError while printing trace in pymc3
I’m tring to perform the spectral unmixing technique with the MCMC algorithm. But I encountered a problem while I ran it. This is the part of the code I’m running: import pymc3 as pm import theano.tensor as tt import arviz as az “”” Perform the spectral unmixing through a MCMC…
Error when running prepDE.py in Stringtie
Error when running prepDE.py in Stringtie 0 Hi, I was trying to execute prepDE.py and Command: prepDE.py -i sample_gene.lst I get the following error: $ prepDE.py -i sample_gene.lst Error: could not locate transcript ENST00000618889 entry for sample CASE2 Traceback (most recent call last): File “/data/leehyobin/Step0_RawFile/stringtie/stringtie/prepDE.py”, line 284, in geneDict.setdefault(geneIDs[i],{}) #gene_id…
Biopython to compute the distance between residues
Biopython to compute the distance between residues 1 Hello, I am trying to use Biopython to find the distance between the alpha carbons for a pair of residues in a model: from Bio.PDB.PDBParser import PDBParser parser = PDBParser() structure = parser.get_structure(“4HHB”, “4HHB.pdb”) # Create a list of all the residues…
find the mate of a read using pysam
I just came across this problem, and this is the solution I’m using right now. I’m sharing it here as it is one of the first and most recent posts that comes after googling. My use case is as follows: I have a list of positions I need to analyze…
How to include spatial coordinate data into anndata within scanpy
Hello I am working on 10X visium spatial transcriptome data which was processed in seurat pacakge with image data. For my downstream analysis, I am trying to import seurat normalized data into scanpy. For this I converted seurat object to h5ad using these steps. SaveH5Seurat(test_object, overwrite = TRUE, filename =…
python – Error occurred while selecting a specific atom in a PDB file using Biopython
The following is a partial content of my PDB file. I want to set the C2 atom as the coordinate origin, but the code shows an error. HETATM 1 C1 UNL A 1 -2.791 -1.310 0.787 1.00 0.00 C HETATM 2 C2 UNL A 1 -3.711 -0.441 0.007 1.00 0.00…
Define roles that allow my users to access to custom managed services – Zero to JupyterHub on Kubernetes
Hello, I try to allow my users to access my subservices I definied. The service renders an extra HTML Page on the Screen in Jupyterhub. It works fine as long as I use it as admin, but in production, the users don´t have admin rights and get a permission denied…
KubeSpawner failed to start pod due to key error – Zero to JupyterHub on Kubernetes
Using kubespawner to spawn , but get below error future: <Task finished coro=<KubeSpawner._start_reflector..catch_reflector_start() done, defined at /opt/middleware/anaconda_python/3.7.11/lib/python3.7/site-packages/kubespawner/spawner.py:2418> exception=SystemExit(1)>Traceback (most recent call last):File “/opt/middleware/anaconda_python/3.7.11/lib/python3.7/site-packages/kubespawner/spawner.py”, line 2420, in catch_reflector_startawait fFile “/opt/middleware/anaconda_python/3.7.11/lib/python3.7/site-packages/kubespawner/reflector.py”, line 383, in startawait self._list_and_update()File “/opt/middleware/anaconda_python/3.7.11/lib/python3.7/site-packages/kubespawner/reflector.py”, line 233, in _list_and_updatefor p in initial_resources[“items”]KeyError: ‘items’ Read more here: Source link
machine learning – Python PyTorch RNN chat bot index out of range in self error
I was trying to make RNN chatbot with PyTorch but : return F.embedding( File “/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/torch/nn/functional.py”, line 2043, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse) IndexError: index out of range in self Kod bu: import torch import torch.nn as nn import torch.nn.functional as F import requests from bs4 import BeautifulSoup…
Scipy factorial ImportError on Kaggle
I am not able to import statsmodel.api into kaggle kernel … ImportError: cannot import name ‘factorial’. I’ve upgraded the scipy package, and I am still getting the same error. I am new to… Read more > issue with auto.arima import | Data Science and … – Kaggle But after that,…
How to use gseapy after scanpy?
Hello, I analyzed some data using scanpy and now I want to do some pathway analysis. I have done DE analysis between each cluster and the rest and I want to do the pathway analysis for each cluster but I have a few questions. I initially followed the instructions from…
pandas – Logistic Regression with scikit-learn giving key error while printing output as : KeyError: ‘Logistic Regression’
plt.figure(figsize = (12,7)) ax = sns.barplot(x = models,y = accuracy_list) plt.xlabel(“Classifiers”,fontsize = 15) plt.ylabel(“Accuracy (%)”, fontsize =15) for p in ax.patches: width = p.get_width() height = p.get_height() x= p.get_x() y = p.get_y() ax.annotate(f”{height} %”,(x + width/2 , y + height*1.01),ha = “center”) plt.show() while i’m runing the above code i…
Substitute variables in an expression in Sagemath
Somewhat similar to this question, I was trying to evaluate a Boolean expression given the right hand side variables in Sage. For simplicity, say, my Boolean expression is, $y=x_0+x_1$. For each of $(x_0,x_1) in {(0,0),(0,1),(1,0),(1,1)}$, I want to evaluate $y$. This is the basic code block to get started. Note…
Leaderboard download fails if leaderboard only contains one page
kaggle competitions leaderboard –download lux-ai-2021 ✔ kaggle Traceback (most recent call last): File “/usr/local/Caskroom/miniforge/base/envs/kaggle/bin/kaggle”, line 11, in <module> sys.exit(main()) File “/usr/local/Caskroom/miniforge/base/envs/kaggle/lib/python3.9/site-packages/kaggle/cli.py”, line 67, in main out = args.func(**command_args) File “/usr/local/Caskroom/miniforge/base/envs/kaggle/lib/python3.9/site-packages/kaggle/api/kaggle_api_extended.py”, line 831, in competition_leaderboard_cli self.competition_leaderboard_download(competition, path, quiet) File “/usr/local/Caskroom/miniforge/base/envs/kaggle/lib/python3.9/site-packages/kaggle/api/kaggle_api_extended.py”, line 784, in competition_leaderboard_download self.download_file(response, outfile, quiet) File…
Get chromosome sizes from fasta file
Get chromosome sizes from fasta file 4 Hello, I’m wondering whether there is a program that could calculate chromosome sizes from any fasta file? The idea is to generate a tab file like the one expected in bedtools genomecov for example. I know there’s the fetchChromSize program from UCSC, but…