eshangj/stackoverflow_q_and_a_sample huggingface dataset:
Question: I have seen several implementations of dynamic tables with open addressing using linear probing that does not use deleted slots before resizing. Here is one example: https://gist.github.com/EntilZha/5397c02dc6be389c85d8 Is there any logical reason not to reuse a deleted slot immediately? I know why it makes sense not to set the slot's value as Empty Hash Table: Why deletion is difficult in open addressing scheme because it would create a bug with the read operation. However, what's holding from writing to this slot? Wouldn't it be better to have most slots used as much as possible for performance?

Answer: No, there’s no reason not to fill tombstone slots as soon as you find them. In fact, a recent paper by Bender et al shows that in the absence of tombstones, primary clustering (where long runs of elements arise because collisions start linking together smaller runs of elements) can largely be eliminated in linear probing tables by periodically inserting additional tombstone elements into the table.
Question: Question Hi, I am runnin' a Docker container with a Python application inside. The code performs some computing tasks and I would like to monitor it's memory consumption using logs (so I can see how different parts of the calculations perform). I do not need any charts or continous monitoring - I am okay with the inaccuracy of this approach. How should I do it without loosing performance? Using external (AWS) tools to monitor used memory is not suitable, because I often debug using logs and thus it's very difficult to match logs with performance charts. Also the resolution is too small. Setup  using python:3.10 as base docker image using Python 3.10 running in AWS ECS Fargate (but results are similar while testing on local) running the calculation method using asyncio  I have read some articles about tracemalloc, but it says it degrades the performance a lot (around 30 %). The article. Tried methods I have tried the following method, however it shows the same memory usage every time called. So I doubt it works the desired way. Using resource import asyncio import resource # Local imports from utils import logger def get_usage(): usage = round(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1000 / 1000, 4) logger.info(f"Current memory usage is: {usage} MB") return usage # Do calculation - EXAMPLE asyncio.run( some_method_to_do_calculations() )  Logs from Cloudwatch  Using psutil (in testing) import psutil # Local imports from utils import logger def get_usage(): total = round(psutil.virtual_memory().total / 1000 / 1000, 4) used = round(psutil.virtual_memory().used / 1000 / 1000, 4) pct = round(used / total * 100, 1) logger.info(f"Current memory usage is: {used} / {total} MB ({pct} %)") return True 

Answer: Fargate is using cgroup for memory limiting. As mentioned here and here, the CPU/memory values provided by /proc refer to the host, not the container. As a result, userspace tools such as top and free report misleading values. You can try with something like: with open('/sys/fs/cgroup/memory/memory.stat', 'r') as f: for line in f: if 'hierarchical_memory_limit ' in line: memory_limit = int(line.split()[1]) if 'total_rss ' in line: memory_usage = int(line.split()[1]) percentage=memory_usage*100/memory_limit
Question: I am trying to build a simple TUI based app using Python's textual package. I have one left panel where I want to display list of items and on right panel I wan to show details of the selected item from left panel. So I want add items in the left panel using keybinding provided by textual lib but when I add new item to the list it does not updates the UI of the left panel to show newly added item in the list. I am following this [doc][1] [1]: https://textual.textualize.io/guide/reactivity/#__tabbed_2_1 to add that feature but it is not working as expected. I am not able to figure out what's wrong here or my understanding of the things are incorrect. Here is my full code: import uuid from time import monotonic from textual.app import App, ComposeResult from textual.containers import Container from textual.reactive import reactive from textual.widget import Widget from textual.widgets import Button, Header, Footer, Static, ListView, ListItem, Label class LeftPanel(Widget): items = reactive([]) def compose(self) -> ComposeResult: yield Static( "All Request", expand=True, id="left_panel_header" ) yield ListView( *self.items, initial_index=None, ) class RightPanel(Widget): """A stopwatch widget.""" def compose(self) -> ComposeResult: yield ListView( ListItem(Label("4")), ListItem(Label("5")), ListItem(Label("6")), initial_index=None, ) class DebugApp(App): """A Textual app to manage stopwatches.""" CSS_PATH = "main.css" BINDINGS = [ ("d", "toggle_dark", "Toggle dark mode"), ("a", "add_item", "Add new item"), ] def compose(self) -> ComposeResult: """Called to add widgets to the app.""" yield Container(LeftPanel(id="my_list"), id="left_panel") yield Container(RightPanel(), id="right_panel") yield Footer() def action_add_item(self): self.query_one("#my_list").items.append(ListItem(Label(str(uuid.uuid4()), classes="request_item"))) self.dark = not self.dark # This works def action_toggle_dark(self) -> None: """An action to toggle dark mode.""" self.dark = not self.dark def render_ui(): app = DebugApp(watch_css=True) app.run() 

Answer: It should work if you call the .append method of the ListView instance. To achieve this you can give it its own id:  yield = ListView( *self.items, initial_index=None, id = "my_list_LV" )  and then use # ... def action_add_item(self): self.query_one("#my_list_LV").append(ListItem(Label(str(uuid.uuid4()), classes="request_item")))  (I tested this and it worked for me).
Question: I am trying to prepare a bar plot using seaborn.objects with time series data where the x-axis ticks and labels are only on the dates that really appear in the data. import pandas as pd import seaborn.objects as so df1 = pd.DataFrame({'date': pd.to_datetime(['2022-01-01', '2022-02-01']), 'val': [10,20,]}) so.Plot(df1, x='date', y='val').add(so.Bar())  The result is the following graph with a tick mark at 2022-01-15. Going to three entries in the dataframe solves the issue, but how would I do it in the presented case. Adding .scale(x=so.Nominal()) or .scale(x=so.Temporal()) does not help. As a bonus, how would I format the x-axis ticks as "Jan 2022", "Feb 2022" etc.? 

Answer: You can convert your date column as string: (so.Plot(df1.assign(date=df1['date'].dt.strftime('%b %Y')), x='date', y='val') .add(so.Bar()).show()) # Or, as suggested by @mwaskom: so.Plot(x=df1['date'].dt.strftime('%b %Y'), y=df1['val']).add(so.Bar()).show()  Output:
Question: I have the following matrices a = sp.random(150, 150) x = np.random.normal(0, 1, size=(150, 20))  and I would basically like to implement the following formula  I can calculate the inner difference like this diff = (x[:, None, :] - x[None, :, :]) ** 2 diff.shape # -> (150, 150, 20) a.shape # -> (150, 150)  I would basically like to broadcast the element-wise multiplication between the scipy sparse matrix and each internal numpy array. If A was allowed to be dense, then I could simply do np.einsum("ij,ijk->k", a.toarray(), (x[:, None, :] - x[None, :, :]) ** 2)  but A is sparse, and potentially huge, so this isn't an option. Of course, I could just reorder the axes and loop over the diff array with a for loop, but is there a faster way using numpy? As @hpaulj pointed out, the current solution also forms an array of shape (150, 150, 20), which would also immediately lead to problems with memory, so this solution would not be okay either.

Answer: import numpy as np import scipy.sparse from numpy.random import default_rng rand = default_rng(seed=0) # \sigma_k = \sum_i^N \sum_j^N A_{i,j} (x_{i,k} - x_{j,k})^2 # Dense method N = 100 x = rand.integers(0, 10, (N, 2)) A = np.clip(rand.integers(0, 100, (N, N)) - 80, a_min=0, a_max=None) diff = (x[:, None, :] - x[None, :, :])**2 product = np.einsum("ij,ijk->k", A, diff) # Loop method s_loop = [0, 0] for i in range(N): for j in range(N): for k in range(2): s_loop[k] += A[i, j]*(x[i, k] - x[j, k])**2 assert np.allclose(product, s_loop) # For any i,j, we trivially know whether A_{i,j} is zero, and highly sparse matrices have more zeros # than nonzeros. Crucially, do not calculate (x_{i,k} - x_{j,k})^2 at all if A_{i,j} is zero. A_i_nz, A_j_nz = A.nonzero() diff = (x[A_i_nz, :] - x[A_j_nz, :])**2 s_semidense = A[A_i_nz, A_j_nz].dot(diff) assert np.allclose(product, s_semidense) # You can see where this is going: A_sparse = scipy.sparse.coo_array(A) diff = (x[A_sparse.row, :] - x[A_sparse.col, :])**2 s_sparse = A_sparse.data.dot(diff) assert np.allclose(product, s_sparse)  Seems reasonably fast; this completes in about a second: N = 100_000_000 print(f'Big test: initialising a {N}x{N} array') n_values = 10_000_000 A = scipy.sparse.coo_array( ( rand.integers(0, 100, n_values), rand.integers(0, N, (2, n_values)), ), shape=(N, N), ) x = rand.integers(0, 100, (N, 2)) print('Big test: calculating') s = A.data.dot((x[A.row, :] - x[A.col, :])**2) print(s)
Question: I have two lists that contains two series of numbers, such as: A = [1.0, 2.9, 3.4, 4.2, 5.5....100.3] B = [1.1, 1.2, 1.3, 2.5, 3.0, 3.1, 5.2]  I would like to create another list of labels based on whether the elements in list B falls in an (any) interval from list A. Something like this: C = [group_1, group_1, group_1, group_1, group_2, group_2, group_3]  i.e. 1.1, 1.2, 1.3, 2.5 all fall in the interval of 1.0 - 2.9 from list A, hence group_1; 3.0, 3.1 both fall in the interval of 2.9 - 3.4, hence group_2; and 5.2 falls in the interval of 4.2 - 5.5, hence group_3, etc.. It doesn't matter which interval from list A does the number from list B fall in, the point is to group/label all elements in list B in a consecutive manner. The orginal data is large so it would be impossible to manually assign labels/groups to elements in list B. Any help is appreciated.

Answer: So, assuming A is sorted, you can use binary search, which already comes with the python standard library in the (rather clunky) module bisect: >>> A = [1.0, 2.9, 3.4, 4.2, 5.5] >>> B = [1.1, 1.2, 1.3, 2.5, 3.0, 3.1, 5.2] >>> [bisect.bisect_left(A, b) for b in B] [1, 1, 1, 1, 2, 2, 4]  This takes O(N * logN) time. Note, take care to read the documentation and how bisect_left and bisect_right behave when a value in B is equal to a value in A, and how items that wouldn't fall anywhere behave.
Question: I want to know, for a package which is not installed in my virtual environment, what is the latest version available. For example, if I had to install requests library, I would want to know the version before installation. I considered pip search but that was deprecated in Python 3.11. Is there any other way to get the release version using some command before installing a Python package ?

Answer: You can use the currently-experimental pip index: C:\>pip index versions requests WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning. requests (2.28.2) Available versions: 2.28.2, 2.28.1, 2.28.0, 2.27.1, 2.27.0, 2.26.0, 2.25.1, 2.25.0, 2.24.0, 2.23.0, 2.22.0, 2.21.0, 2.20.1, 2.20.0, 2.19.1, 2.19.0, 2.18.4, 2.18.3, 2.18.2, 2.18.1, 2.18.0, 2.17.3, 2.17.2, 2.17.1, 2.17.0, 2.16.5, 2.16.4, 2.16.3, 2.16.2, 2.16.1, 2.16.0, 2.15.1, 2.14.2, 2.14.1, 2.14.0, 2.13.0, 2.12.5, 2.12.4, 2.12.3, 2.12.2, 2.12.1, 2.12.0, 2.11.1, 2.11.0, 2.10.0, 2.9.2, 2.9.1, 2.9.0, 2.8.1, 2.8.0, 2.7.0, 2.6.2, 2.6.1, 2.6.0, 2.5.3, 2.5.2, 2.5.1, 2.5.0, 2.4.3, 2.4.2, 2.4.1, 2.4.0, 2.3.0, 2.2.1, 2.2.0, 2.1.0, 2.0.1, 2.0.0, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.14.2, 0.14.1, 0.14.0, 0.13.9, 0.13.8, 0.13.7, 0.13.6, 0.13.5, 0.13.4, 0.13.3, 0.13.2, 0.13.1, 0.13.0, 0.12.1, 0.12.0, 0.11.2, 0.11.1, 0.10.8, 0.10.7, 0.10.6, 0.10.4, 0.10.3, 0.10.2, 0.10.1, 0.10.0, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.9, 0.8.8, 0.8.7, 0.8.6, 0.8.5, 0.8.4, 0.8.3, 0.8.2, 0.8.1, 0.8.0, 0.7.6, 0.7.5, 0.7.4, 0.7.3, 0.7.2, 0.7.1, 0.7.0, 0.6.6, 0.6.5, 0.6.4, 0.6.3, 0.6.2, 0.6.1, 0.6.0, 0.5.1, 0.5.0, 0.4.1, 0.4.0, 0.3.4, 0.3.3, 0.3.2, 0.3.1, 0.3.0, 0.2.4, 0.2.3, 0.2.2, 0.2.1, 0.2.0
Question: I am tryng to update a MultiIndex frame with derived data. My multiframe is a time series where 'Vehicle_ID' and 'Frame_ID' are the levels of index and I iterate through each Vehicle_ID in order and compute exponential weighted avgs to clean the data and try to merge the additional columns to the original MultiIndex dataframe. Example Code: v_ids = trajec.index.get_level_values('Vehicle_ID').unique().values for id in v_ids: ewm_x = trajec.loc[(id,), 'Local_X'].ewm(span=T_pos/dt).mean() ewm_y = trajec.loc[(id,), 'Local_Y'].ewm(span=T_pos_x/dt).mean() smooth = pd.DataFrame({'Vehicle_ID': id, 'Frame_ID': ewm_y.index.values, 'ewm_y': ewm_y, 'ewm_x': ewm_x}).set_index(['Vehicle_ID', 'Frame_ID']) trajec.join(smooth)  And this works outside of the loop, to join the values to the trajec dataframe. But when implemented in the loop seems to overwrite on each loop.  Local_X, Local_Y, v_Length, v_Width, v_Class, v_Vel, v_Acc, Lane_ID, Preceding, Following, Space_Headway, Time_Headway Vehicle_ID Frame_ID 1 12 16.884 48.213 14.3 6.4 2 12.50 0.0 2 0 0 0.00 0.00 13 16.938 49.463 14.3 6.4 2 12.50 0.0 2 0 0 0.00 0.00 14 16.991 50.712 14.3 6.4 2 12.50 0.0 2 0 0 0.00 0.00 15 17.045 51.963 14.3 6.4 2 12.50 0.0 2 0 0 0.00 0.00 16 17.098 53.213 14.3 6.4 2 12.50 0.0 2 0 0 0.00 0.00 ... ... ... ... ... ... ... ... ... ... ... ... ... ... 2911 8588 53.693 1520.312 14.9 5.9 2 31.26 0.0 5 2910 2915 78.19 2.50 8589 53.719 1523.437 14.9 5.9 2 31.26 0.0 5 2910 2915 78.26 2.50 8590 53.746 1526.564 14.9 5.9 2 31.26 0.0 5 2910 2915 78.41 2.51 8591 53.772 1529.689 14.9 5.9 2 31.26 0.0 5 2910 2915 78.61 2.51 8592 53.799 1532.830 14.9 5.9 2 30.70 5.9 5 2910 2915 78.81 2.57  dataframe exerpt.

Answer: You can create an empty dataframe outside the loop to store the results, and then concatenate the results from each iteration to this empty dataframe. v_ids = trajec.index.get_level_values('Vehicle_ID').unique().values results = pd.DataFrame() # empty dataframe to store results for id in v_ids: ewm_x = trajec.loc[(id,), 'Local_X'].ewm(span=T_pos/dt).mean() ewm_y = trajec.loc[(id,), 'Local_Y'].ewm(span=T_pos_x/dt).mean() smooth = pd.DataFrame({'Vehicle_ID': id, 'Frame_ID': ewm_y.index.values, 'ewm_y': ewm_y, 'ewm_x': ewm_x}).set_index(['Vehicle_ID', 'Frame_ID']) results = pd.concat([results, smooth]) # concatenate results from each iteration # join the results to the original dataframe trajec = trajec.join(results)
Question: From the below branca colormap import branca color_map = branca.colormap.linear.PuRd_09.scale(0, 250) colormap = color_map.to_step(index=[0, 10, 20, 50, 70, 90, 120, 200])   How can I extract hex colours for all the steps(index) from the above Branca colormap?

Answer: You can use matplotlib.colors.to_hex on colormap.colors: from matplotlib.colors import to_hex out = [to_hex(c) for c in colormap.colors] # or out = list(map(to_hex, colormap.colors))  Output: ['#f7f4f9', '#f0ebf4', '#e3d9eb', '#d0aad2', '#d084bf', '#e44199', '#67001f']
Question: I have a dag which contains 1 custom task, 1 @task.branch task decorator and 1 taskgroup, inside the taskgroup I have multiple tasks that need to be triggered sequentially depending on the outcome of the @task.branch. PROCESS_BATCH_data_FILE = "batch_upload" SINGLE_data_FILE_FIRST_OPERATOR = "validate_data_schema_task" ENSURE_INTEGRITY_TASK = "provide_data_integrity_task" PROCESS_SINGLE_data_FILE = "process_single_data_file_task" default_args = { "retries": 0, "retry_delay": timedelta(seconds=30), "trigger_rule": "none_failed", } default_args = update_default_args(default_args) flow_name = "data_ingestion" with DAG( flow_name, default_args=default_args, start_date= airflow.utils.dates.days_ago(0), schedule=None, dagrun_timeout=timedelta(minutes=180) ) as dag: update_status_running_op = UpdateStatusOperator( task_id="update_status_running_task", ) @task.branch(task_id = 'check_payload_type') def is_batch(**context): # data = context["dag_run"].conf["execution_context"].get("data") if isinstance(data, dict): subdag = "validate_data_schema_task" elif isinstance(data, list): subdag = PROCESS_BATCH_data_FILE return subdag with TaskGroup(group_id='group1') as my_task_group: validate_schema_operator = ValidatedataSchemaOperator(task_id=SINGLE_data_FILE_FIRST_OPERATOR) ensure_integrity_op = EnsuredataIntegrityOperator(task_id=ENSURE_INTEGRITY_TASK) process_single_data_file = ProcessdataOperatorR3(task_id=PROCESS_SINGLE_data_FILE) validate_schema_operator >> ensure_integrity_op >> process_single_data_file update_status_finished_op = UpdateStatusOperator( task_id="update_status_finished_task", dag=dag, trigger_rule="all_done", ) batch_upload = DummyOperator( task_id=PROCESS_BATCH_data_FILE ) for batch in range(0, BATCH_NUMBER): batch_upload >> ProcessdataOperatorR3( task_id=f"process_data_task_{batch + 1}", previous_task_id=f"provide_data_integrity_task_{batch + 1}", batch_number=batch + 1, trigger_rule="none_failed_or_skipped" ) >> update_status_finished_op branch_task = is_batch() update_status_running_op >> branch_task branch_task >> batch_upload branch_task >> my_task_group >> update_status_finished_op  When I trigger below tag I get the following error: airflow.exceptions.AirflowException: 'branch_task_ids' must contain only valid task_ids. Invalid tasks found: {'validate_data_schema_task'}.  I dont understand why I get the error because 'validate_data_schema_task' is defined at the top of the file. I have tried to hard code 'validate_data_schema_task' as task_id but that gives me the same error.

Answer: When referring to a task nested in a task group you need to specify their task _id as "group_id.task_id". This should work:  @task.branch(task_id = 'check_payload_type') def is_batch(**context): # data = context["dag_run"].conf["execution_context"].get("data") if isinstance(data, dict): subdag = "group1.validate_data_schema_task" elif isinstance(data, list): subdag = "group1." + PROCESS_BATCH_data_FILE return subdag
Question: From a pair of dates, I would like to create a list of dates at monthly frequency, including the months of both dates indicated. import pandas as pd import datetime # Option 1 pd.date_range(datetime(2022, 1, 13),datetime(2022, 4, 5), freq='M', inclusive='both') # Option 2 pd.date_range("2022-01-13", "2022-04-05", freq='M', inclusive='both')  both return the list: DatetimeIndex(['2022-01-31', '2022-02-28', '2022-03-31'], dtype='datetime64[ns]', freq='M'). However, I am expecting the outcome with a list of dates (4 long) with one date for each month: [january, february, mars, april] If now we run: pd.date_range("2022-01-13", "2022-04-05", freq='M', inclusive='right')  we still obtain the same result as before. It looks like inclusive has no effect on the outcome. Pandas version. 1.5.3

Answer: using MonthEnd and Day offsets This is because 2022-04-05 is before your month end (2022-04-30). You can use: pd.date_range("2022-01-13", pd.Timestamp("2022-04-05")+pd.offsets.MonthEnd(), freq='M', inclusive='both')  A more robust variant to also handle the case in which the input date is already the month end: pd.date_range("2022-01-13", pd.Timestamp("2022-04-05")-pd.offsets.Day()+pd.offsets.MonthEnd(), freq='M', inclusive='both')  Output: DatetimeIndex(['2022-01-31', '2022-02-28', '2022-03-31', '2022-04-30'], dtype='datetime64[ns]', freq='M')  alternative: using Period pd.date_range(pd.Period('2022-01-13', 'M').to_timestamp(), pd.Period('2022-04-30', 'M').to_timestamp(how='end'), freq='M', inclusive='both')  Intermediates: pd.Period('2022-01-13', 'M').to_timestamp() # Timestamp('2022-01-01 00:00:00') pd.Period('2022-04-30', 'M').to_timestamp(how='end') # Timestamp('2022-04-30 23:59:59.999999999')  or as periods: period_range pd.period_range('2022-01-13', '2022-04-30', freq='M')  Output: PeriodIndex(['2022-01', '2022-02', '2022-03', '2022-04'], dtype='period[M]')
Question: here is what is tried I changed the status of O Auth Consent screen from testing to publish and the app scope is external then i created the O Auth client Id token and then i tried this code but this is giving error when i try to authenticate to the app. from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request SCOPES = ['https://www.googleapis.com/auth/drive'] CLIENT_SECRETS_FILE = 'client.json' REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob' flow = InstalledAppFlow.from_client_secrets_file(CLIENT_SECRETS_FILE, SCOPES, redirect_uri=REDIRECT_URI) auth_url, _ = flow.authorization_url(prompt='consent') print(f'Please go to this URL to authorize the application: {auth_url}') auth_code = input('Enter the authorization code: ') flow.fetch_token(code=auth_code) creds = flow.credentials print(f'Access token: {creds.token}') print(f'Refresh token: {creds.refresh_token}')  Can you spot how to do it in python and solve this error.

Answer: you cant use urn:ietf:wg:oauth:2.0:oob, this was discontinued. You would have better luck following the official QuickStart This sample will use creds = flow.run_local_server(port=0) to open the consent screen for you rather then asking you to click a link which will probably return a 404 error because you don't have a local web server running. from __future__ import print_function import os.path from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build from googleapiclient.errors import HttpError # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'] def main(): """Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open('token.json', 'w') as token: token.write(creds.to_json()) try: service = build('drive', 'v3', credentials=creds) # Call the Drive v3 API results = service.files().list( pageSize=10, fields="nextPageToken, files(id, name)").execute() items = results.get('files', []) if not items: print('No files found.') return print('Files:') for item in items: print(u'{0} ({1})'.format(item['name'], item['id'])) except HttpError as error: # TODO(developer) - Handle errors from drive API. print(f'An error occurred: {error}') if __name__ == '__main__': main()
Question: I'm trying to run whisper and I want to set the DecodingOptions.language with France (instead of using it's language detection). I have tried to write: options = whisper.DecodingOptions() options.language = "fr"  but I'm getting error: FrozenInstanceError: cannot assign to field 'language'  How can I set the language in DecodingOptions ?

Answer: You can change the language in the DecodingOptions in Whisper with the following command (as, for example, shown here): options = whisper.DecodingOptions(language="en")