TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Never train another ML model again

4 点作者 galgia4 个月前
Hello, Hacker News community!<p>I made FlashLearn, an open-source library designed to streamline the integration of Large Language Models (LLMs) into your workflows. With FlashLearn, you can effortlessly build JSON-based pipelines for tasks like classification and labeling using just a few lines of code, while maintaining standardized outputs for seamless downstream processing.<p><i>Key Features:</i><p>* <i>Quick Setup</i>: Install FlashLearn via PyPI:<p><pre><code> ``` pip install flashlearn ``` Additionally, set your LLM provider credentials if you&#x27;re using OpenAI &#x2F; Deepseek: ``` export OPENAI_API_KEY=&quot;YOUR_API_KEY&quot; ``` </code></pre> * <i>JSON-Centric Pipelines</i>: Easily structure and process data. Here&#x27;s an example of performing sentiment analysis on IMDB movie reviews using a prebuilt skill:<p><pre><code> ```python from flashlearn.utils import imdb_reviews_50k from flashlearn.skills import GeneralSkill from flashlearn.skills.toolkit import ClassifyReviewSentiment # Load data and skills data = imdb_reviews_50k(sample=100) skill = GeneralSkill.load_skill(ClassifyReviewSentiment) tasks = skill.create_tasks(data) # Process tasks in parallel results = skill.run_tasks_in_parallel(tasks) # Save outputs as clean JSON import json with open(&#x27;sentiment_results.jsonl&#x27;, &#x27;w&#x27;) as f: for task_id, output in results.items(): input_json = data[int(task_id)] input_json[&#x27;result&#x27;] = output f.write(json.dumps(input_json) + &#x27;\n&#x27;) ``` </code></pre> * <i>Multi-Step Pipelines</i>: Chain and extend workflows by passing structured outputs to subsequent skills.<p><pre><code> ```python # Example of chaining tasks # next_skill = ... # next_tasks = next_skill.create_tasks([...based on &#x27;output&#x27;...]) # next_results = next_skill.run_tasks_in_parallel(next_tasks) ``` </code></pre> * <i>Custom Skills</i>: For domain-specific needs, easily define custom skills:<p><pre><code> ```python from flashlearn.skills.learn_skill import LearnSkill learner = LearnSkill(model_name=&quot;gpt-4o-mini&quot;) skill = learner.learn_skill(data, task=&#x27;Define categories &quot;satirical&quot;, &quot;quirky&quot;, &quot;absurd&quot;.&#x27;) tasks = skill.create_tasks(data) ``` </code></pre> * <i>Image Classification</i>: Handle visual data with ease using flexible tools for single and multi-label classification.<p><pre><code> ```python from flashlearn.skills.classification import ClassificationSkill images = [...] # Base64-encoded images skill = ClassificationSkill( model_name=&quot;gpt-4o-mini&quot;, categories=[&quot;cat&quot;, &quot;dog&quot;], max_labels=1, system_prompt=&quot;Classify images.&quot; ) tasks = skill.create_tasks(images, column_modalities={&quot;image_base64&quot;: &quot;image_base64&quot;}) results = skill.run_tasks_in_parallel(tasks) ```</code></pre>

暂无评论

暂无评论