How to use get_datetime_path method in lisa

Best Python code snippet using lisa_python

state.py

Source:state.py Github

copy

Full Screen

...50 sys.exit(1)51 [path] = paths52 if 'saves' not in path.parts:53 savefile = 'autosave.'+str(max([int(x.name.split('.')[1])54 for x in (get_datetime_path(path) / 'saves').glob('autosave.*')]))55 path = get_datetime_path(path) / 'saves' / savefile56 57 assert all(['=' in arg for arg in sys.argv[1:]])58 overrides = [arg.split('=')[0] for arg in sys.argv[1:]]59 device = None60 if 'device' in overrides:61 device=cfg.device # override the device62 mlb.green(f"loading from {path}...")63 self.load(path, device=device)64 #mlb.purple(f"It looks like the device of the model is {self.phead.output[0].weight.device}")65 if cfg.mode == 'device':66 mlb.green(f"DEVICE: {self.cfg.device}")67 print("loaded")68 print_overrides = []69 for override in overrides:...

Full Screen

Full Screen

util.py

Source:util.py Github

copy

Full Screen

...37 In: plots/x.png38 Out: 12-31-20/12-23-23/plots/x.png39 """40 return outputs_path(p).relative_to(outputs_path(''))41def get_datetime_path(p):42 """43 Path -> Path44 In: .../2020-09-14/23-31-49/t3_reverse.no_ablations_first45 Out: .../2020-09-14/23-31-4946 Harmless on shorter paths47 """48 idx = p.parts.index('outputs')+3 # points one beyond TIME dir49 return pathlib.Path(*p.parts[:idx]) # only .../DATE/TIME dir50def get_datetime_paths(paths):51 return [get_datetime_path(p) for p in paths]52def outputs_regex(*rs):53 """54 The union of one or more regexes over the outputs/ directory.55 Returns a list of results (pathlib.Path objects)56 """57 res = []58 for r in rs:59 r = r.strip()60 if r == '':61 continue # use "*" instead for this case please. I want to filter out '' bc its easy to accidentally include it in a generated list of regexes62 try:63 r = f'**/*{r}'64 res.extend(list(outputs_path('').glob(r)))65 except ValueError as e:...

Full Screen

Full Screen

cmd.py

Source:cmd.py Github

copy

Full Screen

...33 if len(results) == 0:34 print('[No matching files]')35 continue36 for result in results:37 print(f"{result} -- implies -> {get_datetime_path(result)}")38 try:39 yes = input('Type `y` to confirm deletion of the above results:').strip()40 except (EOFError,KeyboardInterrupt):41 continue42 if yes != 'y':43 print("aborting...")44 continue45 for result in results:46 result = get_datetime_path(result)47 target_parent = toplevel_path('outputs_trash') / result.parent.name # result.parent.name is DATE/48 target_parent.mkdir(parents=True,exist_ok=True) 49 result.rename(target_parent / result.name)50 print(f'moved {result} -> {target_parent / result.name}')51 return52def process(tb):53 """54 Process a tensorboard directory to get all its events. Doesn't work recursively from higher directories (that wouldnt really make sense)55 """56 try:57 tboard = EventAccumulator(tb)58 except Exception as e:59 print("unable to load file {tb}: {e}")60 return...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful