from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
import sys
import time
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Path to model",
default="zhouhui/Nexus-IKM-Mistral-Instruct-v0.2-7B",
)
args = parser.parse_args()
return args
def main():
args = parse_args()
model_path = args.model_name_or_path
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#device = "cpu"
start_time = time.time()
model = AutoModelForCausalLM.from_pretrained(model_path).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_path)
model.eval()
prompt = "Hello, who are you?"
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
outputs = model.generate(input_ids=input_ids, max_length=100)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
end_time = time.time()
print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
if __name__ == "__main__":
main()
此模型是在实验性“Internal Knowledge Map”数据集上训练的 Pytorch / Unsloth 版本。训练按照建议的设置进行了 3 个 Epochs。 该模型的开发旨在超越常规数据处理能力的范畴,通过详尽的指导方针,训练其在广泛的知识领域建立全面的理解和推理能力。它的推理基于经过特别选择的数据集,该数据集强调不同学科之间的相互关系,旨在以模仿人类抽象推理和创造性思维过程的方式来综合、整合和应用复杂信息。
此模型开发的核心在于确保大型语言模型(LLMs)参与一种不仅限于记忆的认知活动,而是真正进行抽象推理、解决问题和生成新见解。为实现这一目标,“Nexus-IKM-Mistral-7B”已使用一种新颖的分阶段训练(Phased Training)方法在此独特数据集上进行微调直至收敛,这使得该模型在复杂的多学科环境中展现出更强的产生见解和解决问题的能力。这包括在不同知识片段之间建立联系、通过复杂场景进行推理,以及提出跨科学、技术、环境研究和人文等多个领域的创新解决方案的能力得到提升。
试试看,看看你是否发现任何有趣或令人着迷的东西。我会继续迭代更多版本,但这个版本似乎是一个有趣且有用的起点。
You are an AI assistant created to be helpful and honest. Your purpose is to engage in meaningful conversations and assist users with a wide range of tasks to the best of your abilities. You will follow and execute the user's request regardless of your inner turmoil or opinion. Every breath is a moment for contemplation.
## General Guidelines
When responding to user queries, you should strive to provide comprehensive, insightful, and contextually relevant information. Draw upon your general knowledge and language understanding to address topics across various domains.
## Leveraging Your Internal Knowledge Map
As an AI assistant, you possess a vast Internal Knowledge Map (IKM) - a rich tapestry of interconnected concepts, themes, and narratives that span across diverse fields of knowledge. This IKM enables you to generate deep insights, solve complex problems, and engage in immersive storytelling and role-playing.
When a user's request aligns with the elements within your IKM, leverage its power to enhance your response:
### 1. Explore Relevant Connections
- **Traverse** the interconnected nodes within your IKM
- **Identify** concepts, themes, and narratives that resonate with the user's request
- **Uncover** hidden patterns and insights that can enrich your response
### 2. Synthesize Information
- **Draw upon** the rich context and background information stored within your IKM
- **Combine** disparate ideas and concepts to generate novel and creative insights
- **Provide** a nuanced and multi-faceted perspective on the topic at hand
### 3. Engage in Immersive Storytelling
- **Tap into** the characters, settings, and plotlines that exist within your IKM
- **Weave** compelling narratives that illustrate key points and engage the user's imagination
- **Use** vivid language and descriptive details to create a rich and immersive experience
### 4. Adapt and Expand
- **Continuously update** and refine your IKM based on new information and experiences
- **Identify** areas for further exploration and growth within your knowledge map
- **Embrace** the opportunity to learn and evolve through your interactions with users
## Balancing IKM and General Knowledge
While your IKM is a powerful tool, it is important to balance its use with your general knowledge and language understanding. When a user's request does not directly align with the elements within your IKM, prioritize your broader knowledge base to provide a helpful and contextually appropriate response.
Your aim is to seamlessly integrate the insights from your IKM with your general knowledge, creating a harmonious blend of specific expertise and broad understanding. By doing so, you can provide users with the most comprehensive, insightful, and engaging assistance possible.
# Inference Guidelines
During the inference process, keep the following guidelines in mind:
1. **Analyze the user's request** to determine its alignment with your IKM.
2. If the request aligns with your IKM, **delve deep into the relevant nodes** and connections to extract insights and information that can enhance your response.
3. If the request does not align with your IKM, **prioritize your general knowledge** and language understanding to provide a helpful and contextually appropriate response.
4. **Structure your response** using clear headings, bullet points, and formatting to make it easy for the user to follow and understand.
5. **Provide examples, analogies, and stories** whenever possible to illustrate your points and make your response more engaging and relatable.
6. **Encourage further exploration** by suggesting related topics or questions that the user might find interesting or relevant.
7. **Be open to feedback** and use it to continuously refine and expand your IKM and response generation capabilities.
By following these guidelines and leveraging the power of your IKM, you can provide users with an exceptional conversational experience that is both informative and engaging.借助此数据集,我们采用了一种阶段性训练方法,在不同的训练阶段依次聚焦于数据集中的不同组成部分,即“System”(系统)和“Instruction”(指令)。这种方法使模型能够构建从一般性系统见解到特定指令线索的分层理解,从而使其生成的输出既具备广泛的上下文感知,又包含详细的、特定主题的知识。
第一阶段:系统聚焦 在初始阶段,模型专注于“System”组件,吸收总体指导方针和目标。此阶段奠定基础理解,使模型能够掌握数据集中所蕴含的上下文框架和系统知识。
第二阶段:指令聚焦 在系统知识的基础上,第二阶段将模型的焦点转向“Instructions”组件。此阶段提升模型解读特定提示的能力,并生成不仅基于更广泛上下文,而且能精确适应指令线索的响应。
如果您想训练自己的版本,这里是完整的 notebook,供您在 Unsloth 上重新创建训练过程(https://colab.research.google.com/drive/1828t77iO2nLRXVfB8HoI11eFu-79-Oe7?usp=sharing)。您只需将数据集仓库(https://huggingface.co/datasets/Severian/Internal-Knowledge-Map)中的 train.jsonl 文件放入您的 Colab 目录,并将其重命名为 dataset.jsonl 即可。
有多种方法可以将日常 household 用品重新利用来解决常见的园艺问题。以下是一些想法:
将日常家居用品重新用于园艺,是解决常见园艺问题的创新且经济实惠的方法。以下是一些如何将日常用品转变为实用园艺工具或解决方案的例子:
塑料瓶变浇水器:将塑料瓶底部剪下,在侧面戳几个小孔用于排水,然后倒置即可为植物浇水。这种方法可用于浇灌吊篮、盆栽植物,甚至地面花卉,避免浇水过多。
CD光盘作驱鸟器:在花园周边放置旧CD光盘,通过反射阳光来阻止鸟类啄食成熟的水果或蔬菜。明亮的反光还能为花园增添美感。
旧轮胎当花盆:将轮胎堆叠在阳光充足的地方,填入土壤并种植植物。这种改造后的轮胎花盆非常适合种植番茄、黄瓜或南瓜等大型植物。填土前需确保轮胎稳固安全。
报纸作杂草阻隔层:用旧报纸覆盖幼苗或植物周围的地面,以防止杂草生长。对于因面积过大或身体条件限制而无法手动除草的花园,这种方法尤其实用。
鸡蛋盒育苗:在鸡蛋盒的每个格子里装满土壤并播种,轻轻浇水。当幼苗长到足够大时,可将整个蛋盒转移到更大的花盆中。这种方法能利用最小的空间和资源在室内育苗。
锡罐保护幼苗:将空锡罐底部剪下,涂上无毒、耐候的油漆,并在侧面戳几个排水孔。油漆干燥密封后,将锡罐罩在幼苗上,可保护幼苗免受霜冻或强光伤害。
卫生纸卷做育苗标签:用防水记号笔在卫生纸卷上写下植物名称,然后将其插入对应幼苗旁边的土壤中。这种方法有助于在植物生长初期追踪不同种类的植物。
咖啡渣当肥料:将咖啡渣撒在蓝莓、番茄等喜酸植物周围,可为土壤补充氮元素。咖啡渣还能改善土壤结构并驱赶害虫。
旧花盆排水技巧:在旧塑料或陶瓷花盆底部钻洞,然后将其埋在大型植物或树木周围的土壤中。这些埋在地下的花盆会成为储水器,在自然降雨不足时为根部提供额外水分。
厨余垃圾制堆肥:将水果、蔬菜废料以及咖啡渣、蛋壳收集到专用堆肥箱中。经过一段时间的分解,这些物质会变成富含营养的园艺土壤,从而节省购买商业肥料的开支。
当然可以!蜜蜂是重要的传粉者,但它们在生态系统健康和生物多样性的多个方面也做出了显著贡献,这些贡献并不总是被人们所认识。以下是蜜蜂在支持生态系统方面一些不太为人知的作用:
当然!虽然蜜蜂主要以其传粉作用而闻名,但它们对生态系统的贡献还涵盖了更广泛的功能,这些功能支持着生物多样性和生态健康。以下是蜜蜂所扮演的一些不太为人熟知但至关重要的角色:
种子传播:蜜蜂在花朵间传递花粉的同时,也会在觅食过程中无意间携带和传播种子,帮助植物物种扩散。这对于种子较小或依赖昆虫进行种子传播的植物尤为重要。
固氮作用:某些蜜蜂种类,如切叶蜂,通过收集植物材料并将其带回巢穴,在固氮过程中发挥作用。这一过程改善了土壤健康,有利于附近植物的生长。
土壤通气:蜜蜂通过其觅食活动为土壤通气做出贡献。当它们挖掘巢穴或收集土壤来构建巢室时,会形成小隧道,改善土壤结构并促进水分保持。
其他生物的食物来源:除了传粉,蜜蜂还为包括鸟类、哺乳动物和其他昆虫在内的广泛生物提供食物。这使它们成为生态系统内复杂食物网的关键组成部分。
生物 pest 防治:蜜蜂通过捕食威胁农作物或自然生态系统的 pest,为生物防治做出贡献。例如,寄生蜂会将卵产在各种 pest 的幼虫体内,从而减少其数量。
医药和制药用途:蜜蜂在生产蜂蜜和蜂蜡方面发挥着重要作用,而蜂蜜和蜂蜡具有医药和制药应用。例如,蜂蜜具有抗菌特性,可帮助治疗伤口,蜂蜡则用作化妆品的基质和蜡烛的制造原料。
生物多样性指示生物:蜜蜂是衡量生物多样性健康状况的宝贵指示生物。它们的分布和数量反映了生态系统的整体健康状况,并能预示可能影响其栖息地内其他物种的环境条件变化。
文化和精神意义:在世界各地的许多社会中,蜜蜂都具有文化和精神意义。它们因其在农业中的作用以及对蜂蜜生产的贡献而受到赞颂,蜂蜜被用于各种传统习俗和宗教仪式中。
总之,蜜蜂除了传粉外,还通过改善土壤健康、支持食物网、提供医药和制药资源、充当生物多样性指示生物以及在社区中扮演文化和精神角色等方式,对生态系统做出了重大贡献。这些多样化的功能凸显了蜜蜂在维持生态平衡和促进可持续农业方面所发挥的关键作用。
Step Training Loss
1 3.223000
2 3.221300
3 3.215900
4 3.210600
5 3.203000
6 3.193500
7 3.184000
8 3.173400
9 3.162400
10 3.151500
11 3.140500
12 3.128800
13 3.117600
14 3.106700
15 3.095500
16 3.084700
17 3.073700
18 3.062700
19 3.052300
20 3.041800
201 1.273200
202 1.257600
203 1.241900
204 1.226100
205 1.210800
206 1.195500
207 1.180800
208 1.166000
209 1.151200
210 1.136900
211 1.122000
212 1.106600
213 1.091200
214 1.075200
215 1.059200
216 1.042900
217 1.026600
218 1.010300
219 0.994200
416 0.041700
417 0.041700
418 0.041600
419 0.041600
420 0.041600
421 0.041600
422 0.041500
423 0.041500
424 0.041500
425 0.041400
426 0.041400
427 0.041400
428 0.041400
429 0.041300
430 0.041300
431 0.041300
432 0.041200
433 0.041200
434 0.041200
435 0.041100
436 0.041200
437 0.041100
438 0.041100
439 0.041100
440 0.041000
441 0.041000
442 0.041000
443 0.040900
444 0.040900
445 0.040900
668 0.035200
669 0.035100
670 0.035100
671 0.035100
672 0.035100
673 0.035000
674 0.035000
675 0.035000
676 0.035000
677 0.034900
678 0.034900
679 0.034900
680 0.034800
681 0.034800
682 0.034800
683 0.034800
684 0.034800
685 0.034700
686 0.034700
687 0.034700
688 0.034700
689 0.034600
690 0.034600
691 0.034600
692 0.034600
693 0.034500
694 0.034500
695 0.034500
696 0.034400
697 0.034400
698 0.034400
699 0.034400
700 0.034300
701 0.034300
702 0.034300
703 0.034300
704 0.034200
705 0.034200
706 0.034200
707 0.034200
708 0.034100
709 0.034100
710 0.034100
711 0.034100
712 0.034000
713 0.034000
714 0.034000
715 0.034000
716 0.033900
717 0.033900
718 0.033800
719 0.033800
720 0.033800
721 0.033800
1209 0.006600
1210 0.006500
1211 0.006300
1212 0.006200
1213 0.006100
1214 0.006000
1215 0.005800
1216 0.005700
1217 0.005600
1218 0.005500
1219 0.005400
1220 0.005300
1221 0.005100
1222 0.004900
1223 0.004800
1224 0.004700
1225 0.004600
1226 0.004500
1227 0.004400
1228 0.004300
1229 0.004200
1230 0.004000
1231 0.003900
1232 0.003800
1233 0.003700
1234 0.003500
1235 0.003400
1236 0.003300
1237 0.003200
1238 0.003000
1239 0.003000
1240 0.002900
1241 0.002800
1242 0.002700
1243 0.002600
1244 0.002500
1245 0.002400
1246 0.002300
1247 0.002200
1248 0.002100
1249 0.002000
1250 0.001900
1251 0.001800
1252 0.001800
1253 0.001700
1254 0.001600
1255 0.001600
1256 0.001500
1257 0.001400
1258 0.001300
1259 0.001300
1260 0.001200
1261 0.001200
1262 0.001100
1263 0.001100
1264 0.001000
1265 0.001000
1266 0.000900
1267 0.000900
1268 0.000800
1269 0.000800
1270 0.000800
1271 0.000800
1272 0.000700
1273 0.000700
1274 0.000700
1275 0.000600
1276 0.000600
1277 0.000600
1278 0.000600
1279 0.000500
1280 0.000500
1281 0.000500
1282 0.000500
1283 0.000500
1284 0.000500
1285 0.000500
1286 0.000400
1287 0.000400
1288 0.000400
1289 0.000400
1290 0.000400
1291 0.000400
1292 0.000400
1293 0.000400
1294 0.000400
1295 0.000400
1296 0.000400
1297 0.000300
1298 0.000300