This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- From: http://tonymorris.github.io/blog/20-intermediate-haskell-exercises/ | |
| -- which seems to be offline now | |
| class Fluffy f where | |
| furry :: (a -> b) -> f a -> f b | |
| -- Exercise 1 | |
| -- Relative Difficulty: 1 | |
| instance Fluffy [] where | |
| furry = error "todo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Error(reason: String) | |
| val eithers: List[\/[Error, String]] = List(\/-("Ok"), -\/(Error("notOk"))) | |
| eithers.sequence | |
| // error: could not find implicit value for parameter ev: scalaz.Leibniz.===[scalaz.\/[Error,String],G[B]] | |
| eithers.sequence[({type λ[α] = \/[Error, α]})#λ, String] | |
| // scalaz.\/[Error,List[String]] = -\/(Error(notOk)) | |
| eithers.sequenceU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async | |
| (let [a (await (async-task-a)) | |
| b (await (async-task-b)) | |
| c (await (async-task-c (* a b)))] | |
| (+ a b c))) | |
| ;; whish is equivalent to: | |
| (async | |
| (let [a (await (async-task-a)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (setq hs-show-all-p t) | |
| (defun hs-mode-toggle-show-all () | |
| (interactive) | |
| (if hs-show-all-p | |
| (hs-hide-all) | |
| (hs-show-all)) | |
| (setq hs-show-all-p (not hs-show-all-p))) | |
| (global-set-key (kbd "C-.") 'hs-toggle-hiding) | |
| (global-set-key (kbd "C-c C-.") 'hs-mode-toggle-show-all) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
| model_name = 'Falconsai/intent_classification' | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModelForSequenceClassification.from_pretrained(model_name) | |
| input_text = "My order hasn't been delivered." | |
| inputs = tokenizer(input_text, return_tensors='pt', padding=True, truncation=True, max_length=64) |
OlderNewer